@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@700&family=Lato:wght@400;500;600;700&display=swap');

/* ======================================= */
/* 1. SETUP, THEME & GLOBAL STYLES         */
/* ======================================= */
:root {
    --brand-green: #97c12f;
    --brand-red: #C42217;
    --brand-pets-blue: #018496;
    --brand-dating-red: #c90614;
    --brand-productions-gold: #dabe4a;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

#app-container {
    display: none; /* Make sure the main app is hidden initially */
    width: 100%;
    height: 100vh;
    overflow: hidden; /* Prevent scrolling on the main container itself */
}

h1,
h2,
h3,
.font-heading {
    font-family: 'Poppins', sans-serif;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #e2e8f0; }
::-webkit-scrollbar-thumb { background: #94a3b8; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* --- BRAND UTILITIES (Colors) --- */

/* Green (Standard) */
.bg-brand-green { background-color: var(--brand-green); }
.text-brand-green { color: var(--brand-green); }
.border-brand-green { border-color: var(--brand-green); }
.hover\:bg-brand-green-dark:hover { background-color: #82a828; }

/* Red (Standard) */
.text-brand-red { color: var(--brand-red); }
.bg-brand-red { background-color: var(--brand-red); }
.hover\:bg-brand-red-dark:hover { background-color: #a31c13; }

/* Pets Blue */
.text-brand-pets-blue { color: var(--brand-pets-blue); }
.bg-brand-pets-blue { background-color: var(--brand-pets-blue); }
.border-brand-pets-blue { border-color: var(--brand-pets-blue); }

/* Dating Red */
.text-brand-dating-red { color: var(--brand-dating-red); }
.bg-brand-dating-red { background-color: var(--brand-dating-red); }
.border-brand-dating-red { border-color: var(--brand-dating-red); }

/* Productions Gold */
.text-brand-gold { color: var(--brand-productions-gold); }
.bg-brand-gold { background-color: var(--brand-productions-gold); }
.border-brand-gold { border-color: var(--brand-productions-gold); }

/* Custom green focus ring for inputs */
.form-input:focus {
    outline: none;
    border-color: var(--brand-green);
    box-shadow: 0 0 0 3px rgba(151, 193, 47, 0.4);
}

/* Custom Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.toggle-slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked+.toggle-slider { background-color: var(--brand-green); }
input:checked+.toggle-slider:before { transform: translateX(22px); }

/* ======================================= */
/* 2. MAIN LAYOUT & NAVIGATION             */
/* ======================================= */
.nav-button.active { background-color: var(--brand-green); color: white; }
#nav-dating.active { background-color: var(--brand-dating-red); color: white; }
.nav-button:hover,
.nav-button.active:hover { background-color: #82a828; color: white; }
#nav-dating.active span { color: white; }
#nav-dating.active img { filter: brightness(0) invert(1); }
.view-fade-in { opacity: 0; transition: opacity 0.3s ease-in-out; }

/* Channel / DM List Styling */
.channel-link { display: flex; align-items: center; flex-grow: 1; min-width: 0; }
.channel-link.active { background-color: #e2e8f0; font-weight: 600; border-left: 4px solid var(--brand-green); padding-left: 0.75rem; }
.channel-link>.room-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-header-content { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }

/* ======================================= */
/* 3. CHAT MESSAGES                        */
/* ======================================= */
.message-wrapper { display: flex; margin-bottom: 1rem; }
.message-wrapper.is-user { justify-content: flex-end; }
.message-content-wrapper { display: flex; flex-direction: column; max-width: 75%; }
.message-wrapper.is-user .message-content-wrapper { align-items: flex-end; }
.message-avatar { width: 40px; height: 40px; border-radius: 9999px; object-fit: cover; flex-shrink: 0; }
.message-bubble-wrapper { display: flex; align-items: center; width: 100%; }
.message-wrapper.is-user .message-bubble-wrapper { justify-content: flex-end;}
.message-author-time { display: flex; align-items: baseline; margin: 0 0.75rem 0.25rem; }
.message-author { font-weight: 600; }
.message-time { font-size: 0.75rem; color: #64748b; margin-left: 0.5rem; }
.message-wrapper.is-user .message-author-time { flex-direction: row-reverse; }
.message-wrapper.is-user .message-time { margin-left: 0; margin-right: 0.5rem; }
.message-bubble { padding: 0.75rem; border-radius: 0.75rem; position: relative; word-break: break-word; }
.message-wrapper:not(.is-user) .message-bubble { background-color: #e2e8f0; border-top-left-radius: 0; }
.message-wrapper.is-user .message-bubble { background-color: var(--brand-green); color: white; border-top-right-radius: 0; }
.message-wrapper.is-user .message-author,
.message-wrapper.is-user .message-avatar { display: none; }
.message-bubble audio { display: block; }
.message-bubble img { max-width: 100%; height: auto;}

/* Universal style for ALL audio players in chat */
.message-wrapper .plyr--audio { background: white; border-radius: 0.5rem; overflow: hidden; min-width: 250px; width: 100%; }
.message-wrapper .plyr__controls { background: white !important; color: #475569 !important; }
.message-wrapper .plyr__controls button svg,
.message-wrapper .plyr__time { color: #475569 !important; }

/* Side Actions (Reply & Options) */
.message-side-actions { display: flex; align-items: center; align-self: flex-start; padding-top: 8px; margin: 0 8px; gap: 4px; opacity: 1; transition: opacity 0.2s; pointer-events: auto; }
.message-side-actions button, .message-side-actions .message-options-btn { padding: 6px; border-radius: 6px; line-height: 1; color: #64748b; background: transparent; border: none; }
.message-side-actions button:hover, .message-side-actions .message-options-btn:hover { background-color: #e2e8f0; color: #1e293b; }

/* Bottom Actions (Emoji Button) */
.message-bottom-actions { position: absolute; bottom: -20px; background-color: white; border-radius: 9999px; padding: 2px; border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,0.1); opacity: 1; transition: opacity 0.2s; pointer-events: auto; z-index: 10; }
.message-wrapper:not(.is-user) .message-bottom-actions { right: 12px; }
.message-wrapper.is-user .message-bottom-actions { left: 12px; }

/* Reaction Palette & Pills */
.reaction-button { position: relative; }
.reaction-palette { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); display: none; padding: 4px; background-color: white; border-radius: 9999px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 20; }
.message-wrapper.is-user .reaction-palette { left: auto; right: 50%; transform: translateX(50%); }
.reaction-emoji-btn { padding: 4px; border-radius: 9999px; font-size: 1.25rem; transition: transform 0.1s ease-in-out; }
.reaction-emoji-btn:hover { transform: scale(1.4); }
.reactions-display { position: absolute; bottom: -12px; left: 12px; display: flex; gap: 2px; }
.message-wrapper.is-user .reactions-display { left: auto; right: 12px; }
.reaction-pill { display: flex; align-items: center; background-color: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 9999px; padding: 1px 6px; font-size: 0.75rem; cursor: pointer; }
.reaction-pill.reacted-by-user { background-color: #dbeafe; border-color: #93c5fd; color: #3b82f6; font-weight: bold; }
.message-options-menu {
    background-color: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
}

/* --- MISSING TOGGLE LOGIC --- */
/* This is what makes the menu appear when you click "React" */
.reaction-button.show-palette .reaction-palette { 
    display: flex !important; 
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ======================================= */
/* 4. MODALS & WIDGETS                     */
/* ======================================= */
.ticket-modal-portrait { position: relative; background-color: #f5f1e9; border-radius: 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); width: 448px; max-height: 90vh; display: flex; flex-direction: column; }
.ticket-portrait-stub { padding: 1rem; text-align: center; flex-shrink: 0; position: relative; border-bottom: 2px dashed #a8a29e; }
.ticket-portrait-stub::before, .ticket-portrait-stub::after { content: ''; position: absolute; width: 24px; height: 24px; background-color: #1e293b; border-radius: 50%; bottom: -12px; z-index: 1; }
.ticket-portrait-stub::before { left: -12px; }
.ticket-portrait-stub::after { right: -12px; }
.ticket-portrait-body { padding: 1.5rem; flex-grow: 1; overflow-y: auto; border-bottom: 2px dashed #a8a29e; }
.ticket-portrait-stub-bottom { position: relative; padding: 1rem; background-color: #f5f1e9; border-radius: 0 0 16px 16px; flex-shrink: 0; }
.ticket-portrait-stub-bottom::before, .ticket-portrait-stub-bottom::after { content: ''; position: absolute; top: -12px; width: 24px; height: 24px; background-color: #1e293b; border-radius: 50%; z-index: 1; }
.ticket-portrait-stub-bottom::before { left: -12px; }
.ticket-portrait-stub-bottom::after { right: -12px; }

.signup-step { display: none; }
.signup-step.active { display: block; }

.new-messages-divider { position: relative; text-align: center; margin: 1rem 0; border-top: 2px solid var(--brand-red); }
.new-messages-divider span { position: relative; top: -12px; background-color: #f8fafc; color: var(--brand-red); padding: 0 10px; font-size: 0.75rem; font-weight: 600; }

.flip-card-modal-container { perspective: 1000px; }
.flip-card-inner { position: relative; width: 100%; height: 100%; transition: transform 0.6s; transform-style: preserve-3d; }
.flip-card-modal-container.is-flipped .flip-card-inner { transform: rotateY(180deg); }
.flip-card-front, .flip-card-back { position: absolute; width: 100%; height: 100%; -webkit-backface-visibility: hidden; backface-visibility: hidden; border-radius: 1rem; }
.flip-card-back { transform: rotateY(180deg); }

/* Flip Animation Styles */
.flip-container { perspective: 1000px; }
.flip-inner { position: relative; width: 100%; height: 100%; text-align: center; transition: transform 0.8s; transform-style: preserve-3d; }
.flip-front, .flip-back { position: absolute; width: 100%; height: 100%; -webkit-backface-visibility: hidden; backface-visibility: hidden; top: 0; left: 0; display: flex; flex-direction: column; }
.flip-back { transform: rotateY(180deg); }

.ticket-modal { background-color: #f5f1e9; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); display: flex; font-family: 'Courier New', Courier, monospace; height: 100%; }
.ticket-main-section { padding: 2rem; flex-grow: 1; display: flex; flex-direction: column; }
.ticket-stub-section { border-left: 2px dashed #a8a29e; padding: 2rem; width: 200px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; position: relative; }
.ticket-stub-section::before, .ticket-stub-section::after { content: ''; position: absolute; left: -12px; width: 24px; height: 24px; background-color: #0f172a; border-radius: 50%; }
.ticket-stub-section::before { top: -12px; }
.ticket-stub-section::after { bottom: -12px; }
.ticket-divider { border-top: 2px dashed #a8a29e; margin: 1rem 0; }
.ticket-label { font-size: 0.75rem; text-transform: uppercase; color: #78716c; letter-spacing: 1px; }
.ticket-value { font-size: 1.125rem; font-weight: bold; color: #1c1917; }
.ticket-modal.back-face { background-color: #1e293b; color: #cbd5e1; }
.ticket-modal.back-face .ticket-stub-section { border-left-color: #475569; }
.ticket-modal.back-face .ticket-divider { border-top-color: #475569; }
.ticket-modal.back-face .ticket-label { color: #94a3b8; }
.ticket-modal.back-face .ticket-value { color: #f1f5f9; }
.ticket-modal.back-face .font-heading { color: white; }
.ticket-modal.character-pass { background-color: #f8fafc; }
.ticket-modal.character-pass .ticket-stub-section { border-left-color: #cbd5e1; }
.ticket-modal.character-pass .ticket-divider { border-top-color: #cbd5e1; }
.ticket-modal.character-pass .ticket-label { color: #475569; }
.ticket-modal.character-pass .ticket-value { color: #1e293b; }

.event-ticket-grid-item { background-color: #f5f1e9; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); display: flex; font-family: 'Courier New', Courier, monospace; transition: all 0.2s ease-in-out; }
.event-ticket-grid-item:hover { transform: scale(1.05); box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
.ticket-grid-main { padding: 0.75rem; flex-grow: 1; white-space: nowrap; overflow: hidden; }
.ticket-grid-stub { border-left: 2px dashed #a8a29e; width: 50px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; color: #78716c; position: relative; }
.ticket-grid-stub::before, .ticket-grid-stub::after { content: ''; position: absolute; left: -8px; width: 16px; height: 16px; background-color: #e2e8f0; border-radius: 50%; }
.ticket-grid-stub::before { top: -8px; }
.ticket-grid-stub::after { bottom: -8px; }

/* ======================================= */
/* 5. UTILITY & MISCELLANEOUS              */
/* ======================================= */
.attendee-avatar:not(:first-child) { margin-left: -1rem; }
.avatar-upload-overlay { opacity: 0; transition: opacity 0.2s ease-in-out; }
.group:hover .avatar-upload-overlay { opacity: 1; }

.search-highlight-current { background-color: var(--brand-green) !important; color: white; }
.search-nav-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.event-item.active { border-left-color: var(--brand-green) !important; background-color: #f1f5f9; }
.event-list-item.selected-event { position: relative; background-color: #ecfdf5; border-radius: 0.5rem; margin: 0.5rem 0; padding: 1rem; transition: background-color 0.2s ease-in-out; }
.event-list-item.selected-event::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background-color: #22c55e; border-radius: 0.5rem 0 0 0.5rem; }
.event-list-item.selected-event h3,
.event-list-item.selected-event div,
.event-list-item.selected-event span,
.event-list-item.selected-event i { color: #166534; }

.character-card-grid.search-highlight,
.dating-profile-card.search-highlight,
.event-ticket-grid-item.search-highlight,
.event-list-item.search-highlight { outline: 3px solid #fef08a; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }

.character-card-grid.current,
.dating-profile-card.current,
.event-ticket-grid-item.current,
.event-list-item.current { outline: 4px solid var(--brand-green); transform: scale(1.03); box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }

/* ======================================= */
/* 6. EVENT & CHARACTER CARD STYLES        */
/* ======================================= */
.character-card-grid, .event-card-grid { background-color: white; border-radius: 0.5rem; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); overflow: hidden; transition: all 0.2s ease-in-out; cursor: pointer; }
.character-card-grid:hover, .event-card-grid:hover { transform: translateY(-4px); box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }

/* ======================================= */
/* 7. FORM & MODAL ENHANCEMENTS            */
/* ======================================= */
@keyframes slideUpFade { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.animate-slide-up-fade { animation: slideUpFade 0.3s ease-out forwards; }

/* ======================================= */
/* 8. MOBILE RESPONSIVENESS                */
/* ======================================= */

@media (max-width: 767px) {

    /* --- Main Navigation Menu (Hamburger Menu Animation) --- */
    #app-container > nav {
        position: fixed; /* Make it fixed on mobile */
        top: 0;
        left: 0;
        height: 100%;
        width: 16rem; /* Tailwind w-64 */
        transform: translateX(-100%); /* Start off-screen */
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
        transition: transform 0.3s ease-in-out; /* Ensure transition is present */
        z-index: 50; /* Ensure nav is above other content but below modals */
    }
    #app-container.show-main-nav > nav {
        transform: translateX(0); /* Slides the nav in */
    }
    .main-nav-overlay {
        /* Tailwind handles: fixed, inset-0, bg */
        opacity: 0;
        transition: opacity 0.3s ease-in-out;
        pointer-events: none;
        /* Initially hidden */
        display: none; /* Use display none initially */
        z-index: 40; /* Ensure overlay is below nav but above main content */
    }
    #app-container.show-main-nav .main-nav-overlay {
        opacity: 1;
        pointer-events: auto;
        display: block; /* Explicitly show when menu is active */
    }

    /* --- Panel Navigation (Sliding Logic for GreenRoom/DMs) --- */
    /* Secondary Panel (List View for GR/DMs) */
    #secondary-panel {
         /* Tailwind handles: absolute, inset-0 (effectively top/left/h-full), w-full, z-10, flex */
         transform: translateX(0); /* Default state: Visible */
         transition: transform 0.3s ease-in-out;
     }
     /* Main Content Panel (Chat/Detail View or full view) */
     #main-content {
          /* Tailwind handles: absolute, inset-0, w-full, h-full, z-0, flex */
         transform: translateX(100%); /* Default state: Hidden to the right */
        transition: transform 0.3s ease-in-out !important;
     }

     /* When show-main-content is active (e.g., chat selected OR single-panel view) */
     #app-container.show-main-content #main-content {
         transform: translateX(0); /* Slide main content IN */
         z-index: 20; /* Bring main content above secondary */
     }

    /* Force-hide secondary panel if 'hidden' class IS present (via JS for single-panel views) */
    /* We use !important here ONLY to override Tailwind's 'flex' if necessary */
    #app-container #secondary-panel.hidden {
        display: none !important;
    }

    /* Ensure main content takes precedence when shown */
    #app-container.show-main-content #secondary-panel {
        /* Optional: could slightly dim or disable interaction with secondary panel when main is showing */
        /* pointer-events: none; */
        /* filter: brightness(0.9); */
    }

} /* End of @media query */

/* ======================================= */
/* 9. GLOBAL OVERRIDES & FIXES             */
/* ======================================= */

/* Fix for potential white screen - ensure main content always has a background */
#main-content {
    background-color: #f8fafc; /* Tailwind bg-slate-50 */
}

/* Ensure view divs fill the scrollable container inside main */
#main-content > .flex-1.flex-col > div[id$="-view"] {
        min-height: 100%; 
}

#masquerading-copyright {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    margin-top: 24px;
    border-top: 1px solid #e2e8f0;
    padding-top: 16px;
}
    
/* ======================================= */
/* 10. BACKSTAGE PASS MODAL (CSS Lanyard)  */
/* ======================================= */

.lanyard {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 60px;
    z-index: 20;
}

.lanyard-strap {
    height: 30px; 
    width: 22px;
    background: #581c87; 
    margin: 0 auto;
    border-radius: 3px 3px 0 0;
    border: 1px solid #3b0764;
}

.lanyard-clip {
    position: relative;
    width: 28px;
    height: 30px;
    background: linear-gradient(to right, #d1d5db, #9ca3af, #d1d5db); 
    border: 1px solid #6b7280;
    border-radius: 0 0 14px 14px; 
    box-shadow: inset 0 2px 2px rgba(255,255,255,0.4);
}

.lanyard-clip::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 15px;
    border: 4px solid #9ca3af;
    border-top-color: transparent; 
    border-radius: 0 0 10px 10px;
    z-index: 25; 
}

.clip-pin { 
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: #6b7280;
    border-radius: 50%;
}

/* Tailwind-like utilities used in JS */
.font-sans { 
    font-family: 'Inter', sans-serif; 
}
.bg-gradient-to-br {
    background-image: linear-gradient(to bottom right, #4f46e5, #a855f7);
}
.tracking-widest {
    letter-spacing: .1em;
}
.tracking-tighter {
    letter-spacing: -0.05em;
}
.text-purple-300 {
    color: #c4b5fd;
}
.border-purple-400 { 
    border-color: #a78bfa;
}
.text-slate-300 {
    color: #d1d5db;
}
.border-slate-700 {
    border-color: #475569;
}
.text-slate-500 {
    color: #6b7280;
}
.bg-slate-900\/50 {
    background-color: rgba(15, 23, 42, 0.5);
}

/* ======================================= */
/* 11. INTERACTIVE TICKET MODAL STYLES     */
/* ======================================= */


/* ======================================= */
/* 12. SEGMENTED CASTING SHEET STYLES      */
/* ======================================= */


/* ======================================= */
/* 13. GLOBAL SCROLLING FIX                */
/* ======================================= */

/* This targets the main content column (parent of sidebar/main-view) */
#app-container > .flex-1.flex-col {
    min-height: 0;
}

/* This targets the container that holds the secondary panel AND main content */
#app-container .flex-1.flex.relative {
    min-height: 0;
}

/* This targets the main content area (parent of chat/events/etc) */
main#main-content {
    min-height: 0;
}

/* ======================================= */
/* 15. FEEDBACK & SETTINGS CLIPBOARD MODAL */
/* ======================================= */

.clipboard-modal {
    position: relative;
    width: 90%;
    max-width: 450px;
    margin: 0 auto;
    z-index: 50;
    /* Subtle entrance animation */
    animation: slideUpFade 0.3s ease-out forwards;
}

/* The Paper / Main Card Background */
.clipboard-paper {
    background-color: #ffffff;
    /* Optional: Subtle graph paper pattern for realism */
    background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
    background-size: 20px 20px;
    
    padding: 3rem 2rem 2rem 2rem; /* Extra top padding for the clip */
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid #cbd5e1;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* The Metal Clip at the Top */
.clipboard-clip {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 40px;
    
    /* Metallic Gradient */
    background: linear-gradient(to bottom, #94a3b8, #475569);
    
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 60;
    border: 2px solid #334155;
}

/* The "Hole" inside the clip */
.clipboard-clip::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 14px;
    background-color: #1e293b; /* Dark hole color */
    border-radius: 50%;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.8);
    border: 1px solid #64748b;
}

/* --- Form Element Styling inside the Clipboard --- */

.form-title {
    text-align: center;
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    color: #1e293b;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

.form-group-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.35rem;
    letter-spacing: 0.05em;
}

.form-group-input {
    width: 100%;
    padding: 12px;
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: #334155;
    transition: all 0.2s ease-in-out;
}

.form-group-input:focus {
    outline: none;
    border-color: #97c12f; /* Brand Green */
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(151, 193, 47, 0.15);
}

/* Standard submit button for forms */
.btn-submit {
    width: 100%;
    background-color: #97c12f;
    color: white;
    font-weight: 800;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-submit:hover {
    background-color: #82a828;
}

/* ======================================= */
/* 16. ARCHED QUICK CHANGE MENU STYLES     */
/* ======================================= */

#quick-change-grid-popup {
    background: transparent;
    box-shadow: none;
    left: 20px; 
    bottom: 80%; 
}

#quick-change-arch {
    position: relative;
    height: 250px; 
    width: 400px;  
}

#quick-change-arch .switch-quick-char-btn {
    position: absolute;
    width: 80px;  
    height: 80px; 
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

#quick-change-arch .switch-quick-char-btn img {
    width: 100%;
    height: 100%;
    border-radius: 9999px;
    object-fit: cover;
    position: relative;
    z-index: 2; 
    border: 3px solid #334155; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

#quick-change-arch .switch-quick-char-btn p {
    display: none; /* No text */
}

/* Stacking Order & Position (NON-OVERLAPPING) */
#quick-change-arch .arch-item-0 {
    bottom: 10px;  
    left: 0px;    
    z-index: 4; 
}
#quick-change-arch .arch-item-1 {
    bottom: 45px;
    left: 90px;    
    z-index: 3;
}
#quick-change-arch .arch-item-2 {
    bottom: 80px;
    left: 180px;   
    z-index: 2;
}
#quick-change-arch .arch-item-3 {
    bottom: 110px; 
    left: 270px;   
    z-index: 1;
}

#quick-change-arch .switch-quick-char-btn:hover {
     transform: scale(1.15); 
     z-index: 10 !important; 
}
#quick-change-arch .switch-quick-char-btn:hover img {
     border-color: var(--brand-green);
     box-shadow: 0 0 15px rgba(151, 193, 47, 0.7);
}

/* ======================================= */
/* 17. THOUGHT BUBBLE MENU STYLES          */
/* ======================================= */

.thought-bubble-popup {
    width: 100%;
    background: #fdfdfd;
    border-radius: 20px; 
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    padding: 8px;
    position: relative;
}
.thought-bubble-tail {
    position: absolute;
    bottom: -32px;
    right: 15px; 
    width: 40px; 
    height: 40px;
}
.thought-bubble-tail .circle {
    position: absolute;
    background: #fdfdfd;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.thought-bubble-tail .circle-1 {
    width: 10px; 
    height: 10px;
    bottom: 0;
    right: 0;
}
.thought-bubble-tail .circle-2 {
    width: 16px; 
    height: 16px;
    bottom: 8px; 
    right: 8px; 
}
.thought-bubble-tail .circle-3 {
    width: 22px; 
    height: 22px;
    bottom: 18px; 
    right: 18px; 
}
.thought-bubble-popup .menu-content a {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    text-decoration: none;
    border-radius: 12px; 
    transition: background-color 0.2s;
}
.thought-bubble-popup .menu-content a:hover {
    background-color: #f0f0f0;
}
.thought-bubble-popup .menu-content i {
    width: 30px;
    text-align: center;
    margin-right: 0.5rem;
    color: #777;
}
.thought-bubble-popup .menu-divider {
    border-top: 1px solid #eee;
    margin: 4px 8px;
}
.thought-bubble-popup .menu-content a.logout {
    color: var(--brand-red);
}
.thought-bubble-popup .menu-content a.logout:hover {
    background-color: #fcf2f1;
}

/* ======================================= */
/* 18. UTILITY MENU ICON COLORS            */
/* ======================================= */

.thought-bubble-popup .menu-content i {
    color: var(--brand-green);
    opacity: 0.9;
}
.thought-bubble-popup .menu-content a.logout i {
    color: var(--brand-red);
}
.thought-bubble-popup .menu-content a {
    color: #1e293b; 
}
.thought-bubble-popup .menu-content a:hover {
    background-color: #f0fdf4; 
    color: #166534; 
}
.thought-bubble-popup .menu-content a.logout:hover {
    background-color: #fef2f2; 
    color: #991b1b; 
}

/* ======================================= */
/* 19. DATING TICKET MODAL STYLES          */
/* ======================================= */

/* ======================================= */
/* 20. MULTIPLAYER WARGAMES MODAL          */
/* ======================================= */

/* When it's your turn, make the cells look clickable */
#mp-board.is-my-turn .mp-cell-playable {
    cursor: pointer;
    background-color: rgba(45, 255, 196, 0.05); /* Faint green */
    border-color: #2dffc4; /* Bright green border */
    box-shadow: 0 0 10px rgba(45, 255, 196, 0.3);
}

#mp-board.is-my-turn .mp-cell-playable:hover {
    background-color: rgba(45, 255, 196, 0.15);
}

/* When it's not your turn, make them look disabled */
#mp-board.is-opponent-turn .mp-cell-playable {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Verified Badge Style */
.verified-badge {
    color: #1d9bf0; /* Official Blue */
    font-size: 1em; /* Increased slightly to ensure visibility */
    margin-left: 6px;
    vertical-align: middle;
    display: inline-block;
}

/* --- Sidebar Footer Layout Fix --- */

/* 1. Allow the button to grow in height */
#avatar-quick-change-button {
    height: auto !important;
    min-height: 44px;
    align-items: center;
    padding-top: 8px;
    padding-bottom: 8px;
}

/* 2. Force the text to wrap instead of truncating */
#user-character-name {
    white-space: normal !important; /* Overrides 'truncate' */
    overflow: visible !important;
    text-overflow: clip !important;
    word-wrap: break-word;
    line-height: 1.2;
    font-size: 0.85rem;
}

/* 3. Ensure the cog stays visible and aligned */
#utility-menu-container {
    flex-shrink: 0; /* Never let the cog shrink or vanish */
    display: flex;
    align-items: center;
}

/* 4. Adjust the container to handle the taller button */
.border-t.border-slate-700 {
    align-items: center; /* Vertically center items */
}

/* =========================================
   FEEDBACK TICKET STYLES (User Input)
   ========================================= */

.feedback-ticket-card {
    background: white;
    width: 100%;
    max-width: 420px;
    border-radius: 12px;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5);
    overflow: hidden;
    position: relative;
    margin: auto;
    animation: slideUpFade 0.3s ease-out forwards;
}

/* The Dark Header Stub */
.feedback-stub {
    /* A rich, deep blue gradient */
    background: linear-gradient(135deg, #312e81, #4338ca); 
    color: white;
    padding: 1.5rem;
    position: relative;
    border-bottom: 3px dashed #e2e8f0;
}

/* The "Punch Holes" for the tear line */
.feedback-stub::after, .feedback-stub::before {
    content: '';
    position: absolute;
    bottom: -10px;
    width: 20px; height: 20px;
    background: rgba(0,0,0,0.75); /* Matches Modal Overlay color */
    border-radius: 50%;
    z-index: 10;
}
.feedback-stub::before { left: -10px; }
.feedback-stub::after { right: -10px; }

.feedback-title {
    font-size: 1.5rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.05em; margin: 0; color: white;
}
.feedback-subtitle {
    font-size: 0.75rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.5rem;
}

/* The Form Body */
.feedback-body {
    padding: 2rem;
    background-color: #ffffff;
    /* Subtle paper texture pattern optional */
    background-image: radial-gradient(#f1f5f9 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Form Elements styled to look like ticket fields */
.ticket-input-group { margin-bottom: 1.2rem; }

.ticket-label {
    display: block; font-size: 0.7rem; font-weight: 800; color: #64748b;
    text-transform: uppercase; margin-bottom: 0.25rem; letter-spacing: 0.05em;
}

.ticket-input, .ticket-select, .ticket-textarea {
    width: 100%; padding: 10px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: 'Inter', sans-serif; font-size: 0.95rem; color: #334155;
}
.ticket-input:focus, .ticket-select:focus, .ticket-textarea:focus {
    outline: none; border-color: #97c12f; background: white;
    box-shadow: 0 0 0 3px rgba(151, 193, 47, 0.2);
}

/* Buttons */
.ticket-actions {
    display: flex; gap: 10px; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid #e2e8f0;
}
.btn-ticket-cancel {
    flex: 1; padding: 12px; border: none; border-radius: 8px;
    background: #e2e8f0; color: #475569; font-weight: 700; cursor: pointer;
}
.btn-ticket-submit {
    flex: 2; padding: 12px; border: none; border-radius: 8px;
    background: #4338ca; /* Matches the new header */
    color: white; font-weight: 700; cursor: pointer;
}


/* Add or ensure these exist in style.css */

/* Flip Animation Context */
.perspective-1000 {
    perspective: 1000px;
}

.transform-style-3d {
    transform-style: preserve-3d;
}

.backface-hidden {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.rotate-y-180 {
    transform: rotateY(180deg);
}


/* ======================================= */
/* 21. MEDIA STACK & ASPECT RATIOS         */
/* ======================================= */

/* The Container that locks the shape */
.media-card-frame {
    position: relative;
    width: 100%;
    /* This creates a standard 3:4 Portrait shape (like a trading card) */
    aspect-ratio: 3 / 4; 
    border-radius: 0.75rem;
    background-color: #f1f5f9; 
    margin-bottom: 0.5rem;
    /* Ensure the rotation doesn't get cut off */
    transform-style: preserve-3d; 
}

/* The Main Image (Top of the stack) */
.media-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Fills the box without stretching */
    object-position: top center; /* Focuses on the face/head */
    border-radius: 0.75rem;
    position: relative;
    z-index: 10; /* Sits on top */
    background-color: white;
    transition: transform 0.3s ease;
}

/* The "Stack" Effect - Photo 2 (Behind) */
.media-stack-effect::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #cbd5e1; /* Slate-300 */
    border-radius: 0.75rem;
    z-index: 5; 
    transform: rotate(3deg);
    transition: transform 0.3s ease;
    border: 1px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* The "Stack" Effect - Photo 3 (Way Behind) */
.media-stack-effect::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #94a3b8; /* Slate-400 */
    border-radius: 0.75rem;
    z-index: 1;
    transform: rotate(-2deg);
    transition: transform 0.3s ease;
    border: 1px solid #ffffff;
}

/* Hover Animation: Fan the cards out */
.group:hover .media-stack-effect::before {
    transform: rotate(6deg) translate(6px, 2px);
}
.group:hover .media-stack-effect::after {
    transform: rotate(-5deg) translate(-6px, 2px);
}

/* ======================================= */
/* 22. AI STAGE MANAGER BOT                */
/* ======================================= */

.ai-message-user {
    background-color: #97c12f; /* Brand Green */
    color: white;
    border-radius: 1rem;
    border-bottom-right-radius: 0;
    padding: 0.75rem;
    max-width: 85%;
    margin-left: auto;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ai-message-bot {
    background-color: white;
    border: 1px solid #e2e8f0;
    color: #334155;
    border-radius: 1rem;
    border-top-left-radius: 0;
    padding: 0.75rem;
    max-width: 85%;
    margin-right: auto;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Typing Animation */
.typing-dot {
    display: inline-block; width: 6px; height: 6px; border-radius: 50%;
    background-color: #cbd5e1; margin: 0 2px;
    animation: typing 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

/* --- Fix AI Bot Position on Mobile --- */
@media (max-width: 768px) {
    #ai-concierge-container {
        bottom: 5.5rem; /* Push it up above the chat bar (usually ~4rem high) */
        right: 1rem;
    }
}

/* --- Fix Layering Issues --- */

/* Ensure Cookie Banner is ALWAYS on top of the Login Screen */
#cookie-consent-box, .ccb-wrapper {
    z-index: 20000 !important; /* Higher than everything */
}

/* Ensure Auth Container stays below modals */
#auth-container {
    z-index: 40 !important; 
}


/* ======================================= */
/* 23. Z-INDEX FIXES (Layering)            */
/* ======================================= */

/* Force the Login Screen to be lower than modals */
#auth-container {
    z-index: 40 !important; 
}

/* Force the Loading Screen to be above login but below modals */
#loading-container {
    z-index: 45 !important;
}

/* Force Modals to be above the login screen */
#forgot-password-modal,
#signup-modal {
    z-index: 50 !important;
}

/* Force Cookie Banner to be the absolute top layer */
#cookie-consent-box, 
.ccb-wrapper {
    z-index: 2147483647 !important; /* Maximum possible value */
}

/* --- NEWS CARD BASE STYLES --- */

/* This style is mandatory for absolute positioning inside the card */
.news-card {
    position: relative; 
    /* The card probably has other styles (border, shadow, width) 
       applied via Tailwind or other CSS, but this is the essential one. 
    */
    /* Adding some base styling just in case, feel free to remove if your 
       Tailwind setup covers these (e.g., bg-white, rounded-xl, shadow-lg) */
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

/* --- REACTION CONTAINER POSITIONING --- */

/* This moves the entire reaction area (selected reaction + button) */
.reaction-container {
    position: absolute;
    bottom: 12px;  /* Position from the bottom edge of the card */
    right: 12px;   /* Position from the right edge of the card */
    z-index: 10;   /* Ensure it's on top of other elements */
    
    /* Layout for the selected reaction emoji and the button */
    display: flex;
    align-items: center;
    gap: 8px;
}

/* This targets the button, which currently contains the ellipses/react text */
.reaction-button {
    /* Ensure the button itself isn't too large or intrusive */
    background: #f1f5f9;
    border: none;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
}

/* The reaction list needs to pop up relative to the button, but anchored to the container */
.reaction-list {
    position: absolute;
    bottom: 40px; /* Float above the button */
    right: 0;
    z-index: 20;
    /* (The rest of the styles for the list itself) */
}

/* Ensure the selected reaction is visible (Fix 2 from our previous chat) */
.selected-reaction {
    font-size: 20px; 
}

/* ======================================= */
/* 24. NEWS CARD STYLES (Reaction Fixes)   */
/* ======================================= */

/* 1. CRITICAL: Allow elements to pop out of the card (Fixes clipping) */
.news-card-wrapper, .news-card {
    overflow: visible !important; 
    position: relative;
    z-index: 1; /* Ensure card stacking order */
}

/* 2. Style the Dropdown Menu (3D Pop-up Style) */
.unified-menu-dropdown {
    /* Positioning */
    position: absolute;
    /* This ensures it pops UP from the button, preventing clipping */
    bottom: 100%; 
    margin-bottom: 10px;
    
    /* 3D Visuals */
    background-color: white !important; 
    border: 1px solid #f1f5f9;
    border-radius: 16px; /* Rounder corners */
    box-shadow: 
        0 10px 15px -3px rgba(0, 0, 0, 0.1), 
        0 4px 6px -2px rgba(0, 0, 0, 0.05),
        0 20px 25px -5px rgba(0, 0, 0, 0.1); /* Deep shadow */
    
    /* Animation State */
    transform-origin: bottom right;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Bouncy transition */
    
    /* Sizing & Layering */
    min-width: 200px;
    z-index: 9999 !important;
}

/* Animation when removing 'hidden' class */
.unified-menu-dropdown:not(.hidden) {
    animation: menuPop 0.2s forwards;
}

@keyframes menuPop {
    0% { opacity: 0; transform: scale(0.8) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Force Text Color */
.unified-menu-dropdown button,
.unified-menu-dropdown div,
.unified-menu-dropdown span {
    color: #334155 !important; /* Slate 700 */
    text-align: left;
}

/* Hover States for Items */
.unified-menu-dropdown button:hover {
    background-color: #f8fafc !important;
    color: #0f172a !important;
}

/* Make icons stand out */
.unified-menu-dropdown i {
    width: 24px;
    text-align: center;
    color: #94a3b8 !important; /* Slate 400 */
    margin-right: 8px;
}

/* Force Text Color */
.unified-menu-dropdown button,
.unified-menu-dropdown div,
.unified-menu-dropdown span {
    color: #334155 !important; /* Slate 700 */
    text-align: left;
}

/* Hover States for Items */
.unified-menu-dropdown button:hover {
    background-color: #f8fafc !important;
    color: #0f172a !important;
}

/* Make icons stand out */
.unified-menu-dropdown i {
    width: 24px;
    text-align: center;
    color: #94a3b8 !important; /* Slate 400 */
    margin-right: 8px;
}

/* --- CARD OVERLAP BUTTON STYLES --- */

/* The round button container */
.card-overlap-btn {
    position: absolute;
    top: -16px; /* -top-4 equivalent */
    right: 12px; /* right-3 equivalent */
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 20;
    transition: all 0.3s ease;
    cursor: pointer;
}

/* Hover effect */
.card-overlap-btn:hover {
    transform: scale(1.1);
}

/* Active State (Red Heart) */
.card-overlap-btn.is-active-heart {
    background-color: #C42217; /* Brand Red */
    color: white;
    border: none;
}

/* Inactive State (White Heart) */
.card-overlap-btn.is-inactive-heart {
    background-color: white;
    color: #cbd5e1; /* Slate-300 */
    border: 1px solid #f1f5f9;
}
.card-overlap-btn.is-inactive-heart:hover {
    color: #C42217;
    background-color: #fff1f2; /* Rose-50 */
}

/* Active State (Gold Star) */
.card-overlap-btn.is-active-star {
    background-color: white;
    border: 1px solid #f1f5f9;
}
.card-overlap-btn.is-active-star i {
    color: #fbbf24; /* Amber-400 */
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
}

/* Inactive State (Gold Star - Empty) */
.card-overlap-btn.is-inactive-star {
    background-color: white;
    border: 1px solid #f1f5f9;
    color: #cbd5e1;
}
.card-overlap-btn.is-inactive-star:hover {
    color: #fbbf24;
}

/* Highlights the logged-in user's cards */
.my-character-card {
    /* CHANGED: Switched to Masquerading Green */
    border: 3px solid #97c12f !important; 
    
    /* Optional: A matching lime glow */
    box-shadow: 0 0 15px rgba(140, 198, 63, 0.4); 
    
    transform: scale(1.02); 
    z-index: 10;
}

/* The 'YOU' Badge */
.owner-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    
    /* CHANGED: Switched to Masquerading Green */
    background-color: #97c12f; 
    
    color: white; /* White text creates good contrast on the lime */
    font-size: 10px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 20;
    letter-spacing: 0.5px;
}

/* The Plus Menu (Hidden by default) */
/* Styling for the new Plus Menu */
#chat-plus-menu {
    display: none; /* Forced hidden by default */
    flex-direction: column;
    /* other styling is handled by tailwind classes in HTML */
}

/* Only show when this class is added via JS */
#chat-plus-menu.show-menu {
    display: flex !important;
    animation: fadeInUp 0.2s ease-out forwards;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Menu Items */
.chat-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.chat-menu-item:hover {
    background-color: #f1f5f9;
    color: #97c12f; /* Brand Green */
}

/* Icons inside the menu */
.chat-menu-icon {
    width: 24px;
    text-align: center;
    font-size: 16px;
}

/* Animation */
@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in-up {
    animation: fadeInUp 0.2s ease-out forwards;
}