/**
 * VICICHAT ADDON - TOWN SQUARE STYLING
 * Version: 3.10.10 - Phase 4 Compact Navigation Alignment
 * Vicilook Digital Infrastructure
 */

:root {
    /* INDEPENDENT HEIGHT CONTROLS */
    --vici-back-btn-height: 42px;        /* Control the BACK button height here */
    --vici-town-square-btn-height: 42px; /* Control the TOWN SQUARE trigger height here */

    /* THEME COLORS & ACCENTS */
    --vici-square-accent: #00ffcc; 
    --vici-square-glow: rgba(0, 255, 204, 0.3);
    --vici-square-purple: rgba(108, 92, 231, 0.5);
    --vici-mesh-bubble-self: rgba(108, 92, 231, 0.25);
    --vici-mesh-bubble-them: rgba(255, 255, 255, 0.05);
    --vici-glass-border: rgba(255, 255, 255, 0.15);
    --vici-gradient: linear-gradient(135deg, #0f0c20 0%, #15102a 100%);
}

/* ==========================================================================
   0. NAVIGATION GROUP CONTAINER OVERRIDE
   ========================================================================== */
#vici-nav-group {
    margin: 8px 0 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

/* BACK BUTTON OVERRIDE */
#vici-go-back-placeholder {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    height: var(--vici-back-btn-height) !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 12px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    flex: 0 0 42px !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
    border: 1px solid var(--vici-glass-border) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    transition: all 0.2s ease !important;
    overflow: hidden !important;
}

#vici-go-back-placeholder:hover {
    background: rgba(108, 92, 231, 0.25) !important;
    border-color: var(--vici-square-accent) !important;
}

#vici-go-back-placeholder svg,
#vici-go-back-placeholder span {
    margin: 0 !important; /* Clears hidden element margins */
}

/* ==========================================================================
   1. ENTRY TRIGGER - COMPACT SIDE-BY-SIDE
   ========================================================================== */
#vici-square-trigger {
    height: var(--vici-town-square-btn-height) !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;

    background: rgba(108, 92, 231, 0.15) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--vici-square-accent) !important;
    border-radius: 15px !important;
    padding: 0 10px !important;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    position: relative;
    overflow: hidden;
    box-sizing: border-box !important;
}

/* Normalize inner wrapper inside trigger */
#vici-square-trigger > div {
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    min-width: 0 !important;
    width: 100% !important;
    overflow: hidden !important;
}

#vici-square-trigger > div > div {
    min-width: 0 !important;
    overflow: hidden !important;
}

#vici-square-trigger > div > div > span:first-child {
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

#vici-square-trigger > div > div > span:last-child {
    white-space: nowrap !important;
}

#vici-square-radar-ping {
    flex: 0 0 8px !important;
}

#vici-square-trigger:hover {
    background: rgba(108, 92, 231, 0.25) !important;
    transform: scale(1.01);
}

/* THE PULSE GLOW ANIMATION */
.vici-pulse-glow {
    animation: vici-border-pulse 3s infinite ease-in-out;
}

@keyframes vici-border-pulse {
    0% {
        box-shadow: 0 0 5px rgba(0, 255, 204, 0.1), inset 0 0 2px rgba(0, 255, 204, 0.05);
        border-color: rgba(0, 255, 204, 0.3);
    }
    50% {
        box-shadow: 0 0 15px rgba(0, 255, 204, 0.4), inset 0 0 8px rgba(0, 255, 204, 0.1);
        border-color: rgba(0, 255, 204, 0.9);
    }
    100% {
        box-shadow: 0 0 5px rgba(0, 255, 204, 0.1), inset 0 0 2px rgba(0, 255, 204, 0.05);
        border-color: rgba(0, 255, 204, 0.3);
    }
}

/* ==========================================================================
   2. LAYOUT ENGINE
   ========================================================================== */
.vici-square-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden; 
    background: var(--vici-gradient); 
    z-index: 100;
    animation: vici-mesh-slide-up 0.4s ease-out;
}

/* LIVE STREAM VIEWPORT */
#vici-square-stream {
    flex: 1; 
    overflow-y: auto !important; 
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#vici-square-stream::before {
    content: "";
    margin-top: auto;
}

/* INPUT ZONE */
.vici-square-input-zone {
    flex-shrink: 0; 
    padding: 20px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--vici-glass-border);
}

/* ==========================================================================
   3. MESSAGE BUBBLES & INTERACTIONS
   ========================================================================== */
.vici-msg-bubble {
    background: var(--vici-mesh-bubble-them);
    border: 1px solid var(--vici-glass-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 12px 16px 18px 16px;
    border-radius: 18px;
    width: 85% !important;     /* <--- FORCES BUBBLES TO TAKE AT LEAST 85% WIDTH */
    max-width: 85% !important; /* <--- PREVENTS OVERFLOWING PAST 85% */
    box-sizing: border-box;
    font-size: 14px;
    line-height: 1.4;
    color: #fff;
    position: relative;
    word-wrap: break-word;
    transition: transform 0.2s ease;
}

.vici-msg-bubble-self {
    align-self: flex-end;
    background: var(--vici-mesh-bubble-self) !important;
    border: 1px solid var(--vici-square-accent) !important;
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.05);
    border-bottom-right-radius: 4px;
}

.vici-msg-bubble-them {
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.vici-chat-me-btn {
    outline: none;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

.vici-chat-me-btn:hover {
    background: rgba(0, 255, 204, 0.25) !important;
    box-shadow: 0 0 10px var(--vici-square-accent);
    transform: translateY(-1px);
}

.vici-chat-me-btn:active {
    transform: translateY(1px);
    box-shadow: 0 0 4px var(--vici-square-accent);
    opacity: 0.9;
}

/* ==========================================================================
   4. RADAR & PULSE
   ========================================================================== */
.vici-pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--vici-square-accent);
    border-radius: 50%;
    animation: viciPulse 2s infinite;
}

@keyframes viciPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.4; }
    100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   5. SURGICAL SCROLLBAR
   ========================================================================== */
#vici-square-stream::-webkit-scrollbar { width: 4px; }
#vici-square-stream::-webkit-scrollbar-track { background: transparent; }
#vici-square-stream::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* ==========================================================================
   6. INPUT ELEMENT
   ========================================================================== */
#vici-square-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--vici-glass-border);
    color: #fff;
    padding: 12px;
    font-size: 15px;
    border-radius: 15px 15px 0 0;
    resize: none;
    transition: all 0.3s ease;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}

#vici-square-input:focus {
    outline: none;
    border-color: var(--vici-square-accent);
    background: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   7. ANIMATIONS
   ========================================================================== */
@keyframes vici-mesh-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   8. MOBILE ADJUSTMENTS
   ========================================================================== */
@media (max-width: 600px) {
    #vici-square-trigger {
        height: 40px !important;
        padding: 0 7px !important;
        border-radius: 12px;
    }
    #vici-go-back-placeholder {
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        flex-basis: 40px !important;
        height: 40px !important;
        border-radius: 10px !important;
    }
    #vici-nav-group {
        gap: 4px !important;
    }
    #vici-nav-group {
        margin-top: 8px !important;
        margin-bottom: 8px !important;
    }
}

/* Phase 4 navigation alignment + exact Back hitbox fix */
#vici-nav-group {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

#vici-go-back-placeholder {
    position: relative !important;
    display: inline-flex !important;
    flex: 0 0 40px !important;
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
}

#vici-go-back-placeholder svg {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
    flex: 0 0 24px !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
}

#vici-go-back-placeholder::before,
#vici-go-back-placeholder::after {
    content: none !important;
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

#vici-square-trigger {
    display: inline-flex !important;
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    align-self: center !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
}

/* Phase 4 Back label + Town Square spacing */
#vici-go-back-placeholder {
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0 !important;
    line-height: 1 !important;
}

#vici-go-back-placeholder span {
    display: block !important;
    order: 1 !important;
    font-size: 8px !important;
    line-height: 9px !important;
    height: 9px !important;
    margin: 0 0 1px 0 !important;
    padding: 0 !important;
    text-transform: uppercase !important;
}

#vici-go-back-placeholder svg {
    order: 2 !important;
    flex: 0 0 20px !important;
    width: 20px !important;
    height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    margin: 0 !important;
}

#vici-square-trigger {
    margin-left: 8px !important;
    margin-bottom: 8px !important;
}

/* --- CHAT BUBBLE STATUS LABEL --- */
/* Town Square terminology: replace the outgoing bubble's SENT label with DROPPED. */
.vici-msg-bubble-self::after {
    content: "DROPPED";
    position: absolute;
    right: 12px;
    bottom: 8px;
    margin: 0;
    font-size: 7px;
    line-height: 1;
    opacity: 0.3;
    font-family: monospace;
    text-transform: lowercase;
}

/* Keep the followers badge immediately after the timestamp on the same bottom row. */
.vici-drop-meta-row .vici-followers-only-badge {
    position: static !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    flex: 0 0 auto !important;
    width: max-content !important;
    max-width: max-content !important;
}


