/* Emergency Force-Show */
#app-layer:not(.hidden), 
#overlay-layer:not(.hidden) {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}
/* Ensure the body isn't collapsing */
html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    background: #000;
}
/* --- 1. THE FOUNDATION --- */
:root {
    --bg: #000000;
    --glass: #0A0A0A; /* Lighter than background but still deep black */
    --accent: #ffffff;
    --grey: #888888;
    --border-glow: rgba(255, 255, 255, 0.20); /* 20% White for the Shadow */
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; 
    -webkit-tap-highlight-color: transparent;
}

body { 
    background: var(--bg); 
    color: var(--accent); 
    height: 100vh; 
    overflow: hidden; 
}

.hidden { display: none !important; }

/* --- 2. THE ENTRY SYSTEM (OVERLAY) --- */
.overlay {
    position: fixed; inset: 0; background: var(--bg); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.8s ease, filter 0.8s ease;
}

.view-content {
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    width: 100%; 
    max-height: 100vh; /* Prevents it from going off-screen */
    padding: 40px 20px; 
    text-align: center;
    overflow-y: auto; /* ALLOWS SCROLLING */
    -webkit-overflow-scrolling: touch; /* Smooth scroll for iPhones */
}
/* Custom scrollbar for the Protocol (Minimalist) */
.view-content::-webkit-scrollbar { width: 4px; }
.view-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
.logo-aei {
    font-family: 'Cinzel', serif; /* Or any high-end Serif font */
    letter-spacing: 15px;        /* High spacing is the secret to luxury */
    color: #FFFFFF;
    text-shadow: 0 0 20px rgba(229, 228, 226, 0.3); /* Subtle Platinum glow */
    font-weight: 300;
    text-transform: uppercase;
}


.fade-out { opacity: 0; transform: scale(0.95); }

/* --- 3. SAMPLE BUTTONS & PROTOCOL --- */
.sample-grid { width: 90%; display: flex; flex-direction: column; gap: 15px; margin-bottom: 0 auto 40px; 
             maxi-width:450px}

.sample-btn, .agree-btn, .side-btn {
    background: transparent; border: 1px solid rgba(255,255,255,0.1); color: var(--accent);
    padding: 18px; border-radius: 12px; cursor: pointer;
    font-size: 0.85rem; letter-spacing: 1px;
}

.sample-btn:hover { border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.03); }

.agree-btn { background: var(--accent); color: var(--bg); font-weight: 800; margin-top: 20px; }
.agree-btn:hover { background: #d1d1d1; }

 .privacy-card {
    background: #050505;
    border: 0.5px solid rgba(255, 255, 255, 0.1);
    padding: 40px 25px;
    border-radius: 40px; 
    width: 100%;
    max-width: 500px;
    margin: auto; /* Centers it perfectly when scrolling */
    box-shadow: 0 0 80px rgba(255, 255, 255, 0.05);
}

/* Ensure points have enough space */
.protocol-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 35px; /* Space before the button */
    text-align: left; /* Better for reading long text */
}
.protocol-point {
    background: rgba(255, 255, 255, 0.02);
    border: 0.3px solid rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    border-radius: 15px; /* Slightly rounded blunt corners */
    font-size: 0.85rem;
    line-height: 1.6;
    color: #bbb;
    transition: 0.3s;
}

.protocol-point:hover {
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
    box-shadow: 0 5px 20px rgba(255, 255, 255, 0.05); /* Small drop shadow */
}
.protocol-point span {
    color: #ffffff;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.3);
}

/* --- THE HIGH-CONTRAST BUTTON --- */
.protocol-btn {
    width: 100%;
    padding: 20px;
    border-radius: 15px;
    font-weight: 900;
    letter-spacing: 3px;
    cursor: pointer;
    text-transform: uppercase;
    border: none;
    font-size: 0.9rem;
}

.main-btn {
    background: #ffffff !important; /* Pure White Background */
    color: #000000 !important; /* Pure Black Text */
}

.main-btn:hover {
    background: #e0e0e0 !important;
    transform: translateY(-2px);
}

.back-btn {
    background: transparent;
    border: 1px solid #333;
    color: #fff;
    margin-top: 10px;
}

.back-btn:hover {
    border-color: #fff;
}
/* --- 4. SLIM SIDEBAR ARCHITECTURE --- */
.sidebar {
    position: fixed; 
    top: 0; 
    bottom: 0;
    left: 0 !important; 
    right: auto !important; 
    margin: 0 !important;
    /* REDUCED WIDTH: Change this to 240px or 260px */
    width: 250px; 
    
    background: #050505; 
    border-right: 1.2px solid rgba(255, 255, 255, 0.12);
    
    /* REFINED CORNER: Matches the slimmer look */
    border-radius: 0 35px 35px 0; 
    
    z-index: 2000; 
    display: flex; 
    flex-direction: column;
    
    /* SLIM SLIDE: Moves 100% of its own width */
    transform: translateX(-100%); 
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
}

.sidebar.active { 
    transform: translateX(0); 
    /* Subtle shadow to separate it from the chat without being heavy */
    box-shadow: 15px 0 40px rgba(0, 0, 0, 0.7); 
}
.sidebar-top {
    flex: 1; 
    overflow-y: auto; 
    padding: 40px 20px 20px; /* Increased top padding for the menu icon */
}

/* Glass effect for the bottom fixed section */
.sidebar-bottom {
    background: #050505;
    padding: 20px 25px 30px;
    border-top: 1px solid #111;
    display: flex;
    flex-direction: column;
    gap: 8px;
    
}

/* Custom Scrollbar for the History (Minimalist) */
.sidebar-top::-webkit-scrollbar { width: 3px; }
.sidebar-top::-webkit-scrollbar-thumb { background: #222; border-radius: 10px; }

.nav-item { 
    display: flex; 
    align-items: center; 
    gap: 15px; 
    cursor: pointer; 
    margin-bottom: 25px; 
    padding: 12px 15px; 
    /* INCREASED OPACITY HERE: Change 0.05 to 0.2 or 0.3 */
    border: 1px solid rgba(255, 255, 255, 0.2); 
    border-radius: 15px; 
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover { 
    background: rgba(255, 255, 255, 0.08); 
    border-color: rgba(255, 255, 255, 0.5); /* Gets even brighter on hover */
}

/* The Plus Icon inside the button */
.icon-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 300;
}

.history-label { font-size: 0.75rem; color: #ffffff; letter-spacing: 2px; margin: 30px 0 15px; padding-bottom:10px
               font; weight:800; position: relative}
/* The "Very Thin Half-Line" Divider */
.history-label::after {
    content: "";
    position: absolute;
    bottom: -5px; /* Adjust this to move the line up or down */
    left: 0;
    
    /* --- SIZE CONTROLS --- */
    width: 60px;          /* CHANGE THIS to make the line longer or shorter */
    height: 2px;          /* CHANGE THIS to make the line thicker or thinner */
    
    /* --- VISIBILITY CONTROLS --- */
    background: linear-gradient(90deg, #ffffff, transparent); /* Makes it fade out smoothly */
    opacity: 0.6;         /* CHANGE THIS (0.1 to 1.0) to make it more or less visible */
    
    /* Optional: Subtle Glow */
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3); 
    border-radius: 2px;
}
.history-item { 
    display: flex; 
    justify-content: space-between; 
    padding: 12px 15px; 
    align-items: center; 
    margin-bottom: 4px; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    cursor: pointer;
    border-radius: 12px; /* Adds the rounded look for the active highlight */
}
.history-title { color: #888; font-size: 0.85rem; cursor: pointer; transition: 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Adds "..." if the title is too long */
         }
.history-title:hover { color: var(--accent); }
.history-cross { cursor: pointer; color: #555; transition: 0.3s; padding: 5px; }
.history-cross:hover { color: #555; transform: scale(1.2); }
/* --- THE ACTIVE SESSION STYLE (REFINED & DARK SILVER) --- */
.history-item.active-session {
    /* Transparent light background - indicates status without being loud */
    background: rgba(255, 255, 255, 0.08) !important; 
    border-radius: 12px;
    border: 0.5px solid rgba(255, 255, 255, 0.12);
    padding: 12px 15px; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-item.active-session .history-title {
    /* Soft metallic silver instead of pure white */
    color: #d1d1d1 !important; 
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Hover effect for non-active items only */
.history-item:not(.active-session):hover {
    background: rgba(255, 255, 255, 0.03);
}
/* --- 5. THE CHAT VOID & MESSAGES (FIGMA SPEC) --- */
.app-container { height: 100vh; display: flex; flex-direction: column; position: relative; }

.app-header { position: absolute; top: 0; left: 0; padding: 30px; z-index: 550; }
.circle-border {
    width: 50px; height: 50px; border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50%; display: flex; flex-direction: column; 
    align-items: center; justify-content: center; gap: 4px; cursor: pointer;
}
.circle-border span { width: 20px; height: 1px; background: white; transition: 0.3s; }

.chat-area { 
    flex: 1; overflow-y: auto; padding: 120px 5% 180px; 
    display: flex; flex-direction: column; scroll-behavior: smooth;
}

/* The Outer Container (Must be Flex) */
.msg { 
    display: flex !important;
    flex-direction: column; 
    width: 100%;
    margin: 12px 0;
    padding: 0;
    background: transparent !important;
}
/* THE USER BUBBLE: Refined for "Flow" & Sophistication */
.user-msg { 
    /* Push to the right and allow natural flow */
    align-self: flex-end !important; 
    width: auto !important; 
    max-width: 70% !important; /* Slightly narrower to feel less "crowded" */
    display: inline-block !important; 
    
    /* GLASSMORPHISM: Deep Black Glass */
    background: rgba(15, 15, 15, 0.8) !important; 
    backdrop-filter: blur(10px); /* Adds the high-end "Frosted" look */
    
    /* SPACING: Balanced Internal "Breathing Room" */
    padding: 16px 24px !important;
    margin-right: 20px; 
    margin-bottom: 30px !important; /* Creates clear separation from Veto */
    
    /* BORDER: Ultra-Thin "Ghost" Edge */
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    
    /* SHAPE: Aggressive Figma-style curves */
    border-radius: 24px 24px 4px 24px !important; 
    
    /* TYPOGRAPHY: Balanced size for readability */
    font-size: 20px !important; /* Reduced from 20px to feel less "shouting" */
    line-height: 1.8;
    color: #eeeeee;
    text-align: left;
    
    /* SHADOW: Soft Ambient Glow */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    
    /* REVEAL ANIMATION */
    animation: userSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* THE VETO BUBBLE: Stay Left & Transparent */
.veto-msg { 
    align-self: flex-start !important;
    width: 100% !important;
    background: transparent !important;
    border: none !important;
    padding: 10px 20px !important;
}



/* --- 6. HIGH-END HEARTBEAT CURSOR (LEFT ALIGNED) --- */
.thinking-bubble { 
    display: flex !important; 
    justify-content: flex-start !important; /* Moves it to the left */
    align-items: center;
    width: 100%;
    padding-left: 20px; /* Space from the edge */
    margin: 15px 0;
}

.heartbeat-cursor {
    width: 12px;
    height: 12px;
    background: #ffffff !important;
    border-radius: 50% !important;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 0 30px rgba(255, 255, 255, 0.3);
    animation: pulseHeart 1.5s infinite ease-in-out !important;
}

@keyframes pulseHeart {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.6); opacity: 1; box-shadow: 0 0 25px rgba(255, 255, 255, 0.9); }
    100% { transform: scale(1); opacity: 0.7; }
}

/* --- 7. EXECUTIVE INTERFACES (INPUT & SIDEBAR) --- */

/* 7a. Chat Input (Your current code) */
.input-container { 
    position: fixed; bottom: 40px; width: 100%; 
    display: flex; justify-content: center; padding: 0 20px; 
}
.input-wrapper { 
    width: 100%; 
    max-width: 800px; 
    background: #080808; 
    border: 1px solid rgba(255,255,255,0.2); 
    border-radius: 9px 35px 9px 35px;
    display: flex; 
    
    /* This keeps the Send button and Textarea vertically centered in the bar */
    align-items: center; 
    
    padding: 12px 25px;
    transition: border-color 0.3s;
}

.input-wrapper:focus-within { 
    border-color: rgba(255,255,255,0.5); 
}

textarea { 
    flex: 1; 
    background: transparent; 
    border: none; 
    color: white; 
    resize: none; 
    max-height: 150px; 
    outline: none; 
    font-size: 1rem; 
    padding: 10px 0; /* Balanced padding for vertical centering */

    /* THE HORIZONTAL CENTERING */
    text-align: left; 
}

/* This ensures the "Define the Edge..." placeholder is also centered */
textarea::placeholder {
    text-align:left;
}

#send-btn { 
    background: transparent; 
    border: none; 
    cursor: pointer; 
    padding: 10px; /* Increased clickable area */
    margin-left: 15px; 
    
    /* --- VISIBILITY CONTROLS --- */
    opacity: 0.85; /* Increased from 0.5 for better visibility */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

#send-btn:hover { 
    opacity: 1; 
    transform: scale(1.1); /* Subtle grow effect on hover */
}

#send-btn svg { 
    /* --- SIZE CONTROLS --- */
    width: 28px;  /* Increased from 24px */
    height: 28px; /* Increased from 24px */
    
    fill: #ffffff; /* Pure white icon */
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.2)); /* Subtle glow */
}
/* 7b. Frozen Sidebar Buttons (The new code to add) */
.side-btn { 
    width: 100%; 
    background: transparent; 
    border: 0.3px solid rgba(255,255,255,0.15); 
    color: var(--accent); 
    padding: 12px; 
    margin-bottom: 8px; 
    border-radius: 8px; 
    font-size: 0.75rem; 
    cursor: pointer; 
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.side-btn:hover { 
    background: rgba(255,255,255,0.05); 
    border-color: rgba(255,255,255,0.4); 
}

.purge-btn { 
    border-color: rgba(255, 77, 77, 0.2); 
    color: rgba(255, 77, 77, 0.8); 
}
.purge-btn:hover { 
    background: rgba(255, 77, 77, 0.05); 
    border-color: #ff4d4d; 
}

.status-text { 
    font-size: 0.6rem; 
    font-weight: 900; 
    color: #444; 
    letter-spacing: 2px; 
    text-align: center; 
    margin-top: 15px; 
    text-transform: uppercase;
}
/* --- UNIVERSAL HIGH-END BUTTON INTERACTION --- */
.sample-btn, .protocol-btn, .side-btn, .agree-btn, .main-btn {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* THE CLICK STATE (When the finger/mouse is pressing down) */
.sample-btn:active, .side-btn:active, .protocol-btn:active {
    background-color: #ffffff !important; /* Turns White */
    color: #000000 !important;            /* Text turns Black */
    transform: scale(0.96);               /* Slight "sink" feeling */
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
}

/* SPECIAL CASE: For buttons that are ALREADY white (like I AGREE) */
.main-btn:active, .agree-btn:active {
    background-color: #999999 !important; /* Dims slightly when clicked */
    transform: scale(0.96);
}

/* --- 8. EXECUTIVE RESPONSIVE OPTIMIZATION (CLEANED) --- */
@media (max-width: 768px) {
    /* 8a. LAYERS & OVERLAY */
    .view-content { padding: 40px 20px; }
    
    .logo-aei { 
        letter-spacing: 0.6rem; 
        text-indent: 0.6rem; 
        font-size: 2.2rem; 
        margin-bottom: 40px;
    }

    .privacy-card {
        width: 92%;
        padding: 30px 20px;
        border-radius: 25px;
        max-height: 85vh;
        overflow-y: auto;
    }

    .protocol-point {
        font-size: 0.78rem;
        padding: 12px 15px;
        line-height: 1.5;
    }

    /* 8b. THE SLIM SIDEBAR (MOBILE SPEC) */
    .sidebar { 
        width: 65vw; 
        max-width: 250px; 
        left: 0 !important; 
        right: auto !important; /* FORCES PIN TO LEFT */
        border-radius: 0 20px 20px 0;
        transform: translateX(-100%); 
        padding-top: 0px; /* Reset so top padding is handled by sidebar-top */
    }
    
    .sidebar.active { 
        transform: translateX(0) !important;
        box-shadow: 15px 0 50px rgba(0, 0, 0, 0.9);
    }

    /* MOVE NEW SESSION TO THE TOP */
    .sidebar-top {
        padding: 40px 15px 15px; /* Pulls "New Session" right to the top */
    }

    /* 8c. TOP NAVIGATION (THREE LINES) */
    .app-header { padding: 20px; }

    .circle-border {
        width: 44px; 
        height: 44px;
        border-color: rgba(255,255,255,0.2);
        background: #000000; 
        box-shadow: 0 0 20px rgba(0, 0, 0, 1); 
    } /* FIXED: Added missing bracket here */

    .circle-border span { width: 16px; }

    /* 8d. CHAT MESSAGES */
    .chat-area { padding: 100px 15px 160px; }
    .circle-border:hover {
    border-color: rgba(255,255,255,0.8);
    background: #0a0a0a; /* Slightly lighter black on hover */
    }
    

    .msg { 
        max-width: 92%; 
        font-size: 0.88rem; 
        padding: 14px 18px; 
        margin: 10px 0;
    }

    /* 8e. INPUT SYSTEM */
    .input-container { bottom: 15px; padding: 0 15px; }
    
    .input-wrapper { 
    padding: 10px 15px; 
    border-radius: 
        clamp(6px, 1vw, 9px) 
        clamp(20px, 4vw, 35px) 
        clamp(6px, 1vw, 9px) 
        clamp(20px, 4vw, 35px);
    background: #0A0A0A; 
    }

    textarea { font-size: 16px; } /* 16px prevents iOS/Android zoom */

    #send-btn svg { width: 22px; height: 22px; }

    /* 8f. MOBILE BUTTONS & HISTORY LIST */
    .side-btn { 
        padding: 10px; 
        font-size: 0.65rem; 
        margin-bottom: 8px;
        background: rgba(255,255,255,0.03);
        border-radius: 10px;
        color: #888;
        transition: 0.3s;
    }

    .sidebar-bottom {
        padding: 15px 20px 20px;
    }

    .status-text {
        font-size: 0.55rem;
        margin-top: 10px;
    }
    
    .history-item { padding: 8px 0; }
}

/* 8g. ULTRA-SMALL DEVICES */
@media (max-width: 380px) {
    .sidebar { width: 75vw; }
    .logo-aei { font-size: 1.8rem; letter-spacing: 0.4rem; }
}

/* FINAL SAFETY FOR APP VISIBILITY */
#app-layer:not(.hidden) { display: flex !important; opacity: 1 !important; }

/* --- VETO CORE EXECUTIVE FORMATTING (OVERRIDE) --- */

/* 1. MASTER CONTAINER (Full-Width & Responsive) */
.msg {
    width: 100%;
    max-width: 100%;
    margin: 20px 0;
    padding: 20px 0;
    line-height: 1.6;
    box-sizing: border-box;
    animation: smoothReveal 0.6s ease-out forwards;
}
/* 3. VETO MESSAGES (The Elite Transparent Report Look) */
.veto-msg { 
    align-self: flex-start;
    background: transparent !important; /* Forces transparency */
    border: none !important; /* Removes the box border */
    box-shadow: none !important; /* Removes the glow box */
    width: 100%;
    padding: 0 !important; /* Removes inner box padding */
}
 /* 4. TYPOGRAPHY (The Strategy Hierarchy) */
.veto-msg h1, .veto-msg h2, .veto-msg h3 {
    color: #ffffff !important;
    font-size: clamp(1.4rem, 5vw, 1.8rem) !important;
    font-weight: 800;
    margin: 35px 0 15px 0;
    text-transform: none !important;
    letter-spacing: 3px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 8px;
}

.veto-msg li {
    font-size: 20px !important;
    color: #fff !important; /* Slightly off-white for better reading */
    margin-bottom: 20px;
    line-height: 2 !important;
}
.veto-msg p, .veto-msg div {
    text-transform: none !important; /* This kills the All-Caps bug */
    font-weight: 600 !important;    /* This kills the "Everything is Bold" bug */
    color: #fff !important;      /* Professional Grey */
    font-size: 20px !important;
    line-height: 2.0 !important
}


.veto-msg strong {
    color: #fff !important; /* The White rule for bold keywords */
    font-weight: 700;
    text-transform: none !important;
}

/* Level 2 Headings (The Strategic Sub-sections) */
.veto-msg h4, .veto-msg h5 {
    color: #d1d1d1 !important; /* Sophisticated Grey */
    font-size: 22px !important;
    font-weight: 600;
    margin-top: 25px;
    margin-bottom: 15px;
    letter-spacing: 1px;
}


/* 4. SPECIAL ELEMENTS */

/* Lists & Bullets */
.veto-msg ul {
    list-style: none;
    padding-left: 0;
    margin: 20px 0;
}

.veto-msg li {
    padding-left: 25px;
    position: relative;
}

.veto-msg li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #90EE90; /* Tactical Green */
}

/* Links & Sources */
.veto-msg a {
    color: #90EE90 !important;
    text-decoration: underline;
    font-weight: 800;
    transition: 0.3s;
}

.veto-msg a:hover {
    color: #ffffff !important;
}

/* Critical Alerts */
.risk-critical {
    color: #ff4d4d !important;
    font-weight: 900;
    text-shadow: 0 0 10px rgba(255, 77, 77, 0.3);
}

/* 5. UTILITY & ANIMATION */
@keyframes smoothReveal {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 6. MOBILE OPTIMIZATION */
@media (max-width: 768px) {
    .msg { padding: 15px 10px; }
    .veto-msg h1, .veto-msg h2, .veto-msg h3 { font-size: 22px !important; }
    .veto-msg h4 { font-size: 19px !important; }
    .veto-msg p, .veto-msg li { font-size: 17px !important; }
}
