/* /the-perfection-paradox/chatbot-styles.css - V2 REWORK */
/* --- NEW: Prevent Layout Shift on Scrollbar Toggle --- */
html {
    scrollbar-gutter: stable;
}
/* --- 1. FLOATING TOGGLER BUTTON --- */
.nexus-ai-toggler {
    position: fixed;
    bottom: 30px;
    right: 35px;
    width: 60px;
    height: 60px;
    background: rgba(15, 17, 26, 0.7);
    border: 1px solid rgba(74, 144, 226, 0.4);
    color: rgba(74, 144, 226, 0.8);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9990;
    backdrop-filter: blur(5px);
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.4s ease;
}
.nexus-ai-toggler:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(74, 144, 226, 0.5);
    color: #fff;
}
.nexus-ai-toggler svg {
    width: 28px;
    height: 28px;
    transition: transform 0.4s ease;
}
.nexus-ai-toggler:hover svg {
    transform: rotate(180deg);
}

/* --- 2. FULL-SCREEN TERMINAL OVERLAY --- */
.nexus-ai-terminal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(9, 10, 15, 0.5);
    backdrop-filter: blur(8px);
    
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

/* --- 3. THE MAIN TERMINAL CONTAINER --- */
.nexus-ai-terminal .terminal-container {
    width: 90%;
    max-width: 800px;
    height: 80vh;
    max-height: 700px;
    background-color: rgba(15, 17, 26, 0.85);
    border: 1px solid rgba(74, 144, 226, 0.3);
    box-shadow: 0 0 40px rgba(74, 144, 226, 0.15);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.4s ease;
    /* Subtle grid background */
    background-image: 
        linear-gradient(rgba(74, 144, 226, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(74, 144, 226, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* --- 4. VISIBILITY & ACTIVE STATES --- */
body.terminal-active .nexus-ai-toggler {
    opacity: 0;
    transform: scale(0.5);
    pointer-events: none;
}
body.terminal-active .nexus-ai-terminal {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
body.terminal-active .nexus-ai-terminal .terminal-container {
    transform: scale(1);
}
body.terminal-active {
    overflow: hidden;
}

/* --- 5. TERMINAL HEADER --- */
.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(74, 144, 226, 0.2);
    flex-shrink: 0;
}
.system-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'monospace', 'Courier New', Courier;
    font-size: 0.9rem;
    color: #66ffbe;
    text-shadow: 0 0 5px #66ffbe;
    animation: text-flicker 15s linear infinite;
}
.status-light {
    width: 10px;
    height: 10px;
    background-color: #66ffbe;
    border-radius: 50%;
    box-shadow: 0 0 8px #66ffbe;
    animation: light-pulse 2s infinite;
}
.disconnect-btn {
    background: transparent;
    border: 1px solid rgba(220, 53, 69, 0.7);
    color: rgba(220, 53, 69, 1);
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.8rem;
    transition: background-color 0.2s, color 0.2s;
}
.disconnect-btn:hover {
    background-color: rgba(220, 53, 69, 1);
    color: #fff;
}

/* --- 6. CHATBOX & MESSAGES --- */
.terminal-chatbox {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    list-style-type: none;
    margin: 0;
}
/* Custom Scrollbar */
.terminal-chatbox::-webkit-scrollbar { width: 6px; }
.terminal-chatbox::-webkit-scrollbar-track { background: transparent; }
.terminal-chatbox::-webkit-scrollbar-thumb { background: rgba(74, 144, 226, 0.3); border-radius: 3px; }

.terminal-chatbox .chat {
    margin-bottom: 15px;
    animation: fade-in-up 0.5s ease-out forwards;
}
.terminal-chatbox .chat p {
    margin: 0;
    padding: 12px 15px;
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 90%;
    color: #ddd;
    background: rgba(0,0,0,0.1);
}
.terminal-chatbox .chat.incoming p {
    border-left: 3px solid #66ffbe;
    background: linear-gradient(90deg, rgba(102, 255, 190, 0.1), transparent);
}
.terminal-chatbox .chat.outgoing {
    display: flex;
    justify-content: flex-end;
}
.terminal-chatbox .chat.outgoing p {
    border-right: 3px solid #4a90e2;
    text-align: right;
    background: linear-gradient(-90deg, rgba(74, 144, 226, 0.1), transparent);
}

/* --- 7. INPUT AREA --- */
.terminal-input-area {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid rgba(74, 144, 226, 0.2);
    flex-shrink: 0;
}
.terminal-input-area textarea {
    flex-grow: 1;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(74, 144, 226, 0.3);
    color: #fff;
    font-size: 1rem;
    padding: 8px 5px;
    resize: none;
    height: 55px; /* Default height */
    max-height: 120px;
    outline: none;
    transition: border-color 0.3s;
}
.terminal-input-area textarea:focus {
    border-bottom-color: #66ffbe;
}
.transmit-btn {
    width: 55px;
    height: 55px;
    flex-shrink: 0;
    border: 1px solid rgba(74, 144, 226, 0.7);
    background: rgba(74, 144, 226, 0.2);
    color: #4a90e2;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.transmit-btn:hover {
    background: #4a90e2;
    color: #fff;
    border-color: #4a90e2;
}

/* --- 8. ANIMATIONS --- */
@keyframes text-flicker {
    0%, 19%, 21%, 59%, 61%, 100% { text-shadow: 0 0 5px #66ffbe; color: #66ffbe; }
    20%, 60% { text-shadow: none; color: #8affd3; }
}
@keyframes light-pulse {
    0% { box-shadow: 0 0 8px #66ffbe; }
    50% { box-shadow: 0 0 15px 5px #66ffbe; }
    100% { box-shadow: 0 0 8px #66ffbe; }
}
@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* New Typing Animation */

@keyframes blink {
    from, to { opacity: 1; }
    50% { opacity: 0; }
}
/* --- NEW: Typing Caret Animation --- */
.typing-caret::after {
    content: '▋';
    display: inline-block;
    animation: blink 1s step-end infinite;
    color: #66ffbe;
    margin-left: 8px;
}
/* --- NEW: 9. LOGGED-OUT STATE STYLING --- */

/* By default, the static message is hidden */
.static-auth-message {
    display: none;
}

/* When in logged-out mode, HIDE the chat input area */
.nexus-ai-terminal.logged-out-mode .terminal-input-area {
    display: none;
}

/* When in logged-out mode, HIDE all normal chat messages */
.nexus-ai-terminal.logged-out-mode .chat {
    display: none;
}

/* When in logged-out mode, SHOW the static message */
.nexus-ai-terminal.logged-out-mode .static-auth-message {
    display: block;
    color: #ccc;
    padding: 20px;
    border: 1px dashed rgba(220, 53, 69, 0.4);
    background: rgba(220, 53, 69, 0.05);
    border-radius: 4px;
}

.static-auth-message h3 {
    margin-top: 0;
    color: #f56c6c;
    text-shadow: 0 0 5px rgba(220, 53, 69, 0.7);
    font-family: 'monospace', 'Courier New', Courier;
}

.static-auth-message a {
    color: #4a90e2;
    text-decoration: none;
    font-weight: bold;
}
.static-auth-message a:hover {
    text-decoration: underline;
}

.static-auth-message ul {
    list-style-type: '» ';
    padding-left: 20px;
}

/* --- 1. FLOATING TOGGLER BUTTON (Add transition) --- */
.nexus-ai-toggler {
    /* ... keep all existing styles ... */
    transition: all 0.4s ease; /* This is the key for the animation */
}
/* --- Nexus Notification System --- */
/* --- Nexus Notification System (V2 - Stacking) --- */

/* 1. The Container: Positions the area and sets the stacking direction */
/* --- Nexus Notification System (V2 - Stacking) --- */

/* 1. The Container: Positions the area and sets the stacking direction */
#nexus-notification-container {
    position: fixed;
    bottom: 30px;
    left: 35px;
    z-index: 9999;
    width: 320px;
    display: flex;
    /* This is the key: new items appear at the top */
    flex-direction: column-reverse;
    align-items: flex-start;
}

/* 2. The Notification Itself: Base styling & transitions */
.nexus-notification {
    background: rgba(15, 17, 26, 0.85);
    backdrop-filter: blur(8px);
    color: #f1f1f1;
    padding: 15px 20px;
    border-radius: 6px;
    border: 1px solid rgba(74, 144, 226, 0.3);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    font-size: 0.95rem;
    margin-top: 15px;
    width: 100%;
    /* This is the key for the slide-down animation */
    transition: transform 0.4s ease-in-out;
}

/* 3. Notification Types */
.nexus-notification.success {
    border-left: 4px solid #67c23a;
}
.nexus-notification.error {
    border-left: 4px solid #f56c6c;
}

/* 4. Animations */
@keyframes slideInFromLeft {
    from { transform: translateX(-120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutToLeft {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-120%); opacity: 0; }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.nexus-notification.is-entering {
    animation: slideInFromLeft 0.5s ease-out forwards;
}
.nexus-notification.is-leaving {
    animation: slideOutToLeft 0.5s ease-in forwards;
}
.nexus-notification.is-shaking {
    animation: shake 0.4s ease-in-out;
}
/* --- Custom Confirmation Modal System --- */

/* 1. The Overlay: Covers the screen with a blur effect */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 10, 15, 0.5);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Animation properties */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.custom-modal-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* 2. The Modal Content Box: Holds the text and buttons */
.custom-modal-content {
    background: #0f111a;
    border: 1px solid rgba(74, 144, 226, 0.2);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 450px;
    
    /* Animation properties */
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.custom-modal-overlay.is-visible .custom-modal-content {
    transform: scale(1);
}

/* 3. Header, Body, and Footer Styling */
.custom-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid rgba(74, 144, 226, 0.2);
}

.custom-modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: #fff;
}

.custom-modal-body {
    padding: 25px;
    font-size: 1rem;
    line-height: 1.6;
    color: #a9b3c1;
}

.custom-modal-body p {
    margin: 0;
}

.custom-modal-footer {
    padding: 20px 25px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    border-top: 1px solid rgba(74, 144, 226, 0.2);
    border-radius: 0 0 8px 8px;
}

/* 4. Button Styles */
.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s, transform 0.2s;
}
.modal-btn:hover {
    transform: translateY(-2px);
}

.modal-btn-secondary {
    background-color: #4a5568;
    color: #e2e8f0;
}
.modal-btn-secondary:hover {
    background-color: #64748b;
}

.modal-btn-primary {
    background-color: #d9534f; /* Red for destructive actions */
    color: #fff;
}
.modal-btn-primary:hover {
    background-color: #e16a66;
}
/* Add this to a global CSS file like chatbot-styles.css */
body.custom-modal-open {
    overflow: hidden;
    padding-right: var(--scrollbar-width);
}