/* =========================================
   ANNCSU Theme - Dracula Flat Design
   ========================================= */

/* --- Design Tokens (Dracula Theme) --- */
:root {
    /* Colors: Dracula Palette */
    --bg: #282a36;        /* Dracula Background */
    --current: #44475a;   /* Dracula Current Line */
    --fg: #f8f8f2;        /* Dracula Foreground */
    --comment: #6272a4;   /* Dracula Comment */
    
    /* Accents */
    --cyan: #8be9fd;
    --green: #50fa7b;
    --orange: #ffb86c;
    --pink: #ff79c6;      /* Dracula Pink (Primary) */
    --purple: #bd93f9;    /* Dracula Purple */
    --red: #ff5555;
    --yellow: #f1fa8c;
    
    /* Typography & Spacing */
    --font-main: 'Play', sans-serif;
    --radius-lg: 0px;
    --radius-md: 0px;
    --header-height: 80px;
}

/* --- Reset & Base --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-main);
    background-color: var(--bg);
    color: var(--fg);
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* --- Layout Structure --- */
.app-container {
    width: 100%;
    height: 100%;
    background-color: var(--bg);
    display: flex;
    overflow: hidden;
    position: relative;
}

@media (min-width: 768px) {
    .app-container {
        max-width: 1150px;
        height: 90vh;
        border-radius: var(--radius-lg);
        background-color: var(--bg);
    }
}

/* --- Components: Sidebar --- */
aside {
    width: 280px;
    background-color: rgba(0, 0, 0, 0.2); 
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: absolute;
    top: 0; left: 0; bottom: 0;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

@media (min-width: 768px) {
    aside {
        position: relative;
        transform: translateX(0);
    }
}

aside.open { transform: translateX(0); }

.sidebar-header {
    height: var(--header-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-title {
    color: var(--fg);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

/* --- Components: Main Chat Area --- */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    position: relative;
}

.chat-header {
    height: var(--header-height);
    background-color: transparent;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
}

.header-group { display: flex; align-items: center; gap: 16px; }

/* --- Components: Message List --- */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    scroll-behavior: smooth;
}

.message-row {
    display: flex;
    width: 100%;
    animation: fadeIn 0.3s ease-out;
}
.message-left { justify-content: flex-start; }
.message-right { justify-content: flex-end; }

.message-content {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    max-width: 85%;
}
@media (min-width: 768px) { .message-content { max-width: 70%; } }

.avatar {
    width: 32px; height: 32px;
    border-radius: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: bold; flex-shrink: 0;
    color: var(--bg);
    overflow: hidden;
}

.bot-avatar {
    background-color: var(--purple);
}

.user-avatar {
    background-color: var(--pink);
}

.bubble {
    padding: 16px;
    border-radius: 0;
    position: relative;
    line-height: 1.6;
}

/* Bot Theme */
.message-left .avatar { background-color: var(--purple); }
.message-left .bubble {
    background-color: rgba(68, 71, 90, 0.4);
    color: var(--fg);
}

/* User Theme */
.message-right .message-content { flex-direction: row-reverse; }
.message-right .avatar { background-color: var(--pink); }
.message-right .bubble {
    background-color: rgba(255, 121, 198, 0.15);
    color: var(--fg);
}

/* System Messages */
.message-system .bubble {
    background-color: rgba(255, 184, 108, 0.1);
    color: var(--orange);
    font-style: italic;
    padding: 12px 16px;
}

.timestamp { font-size: 10px; margin-top: 8px; display: block; opacity: 0.7; }
.message-right .timestamp { color: rgba(248, 248, 242, 0.5); text-align: right; }
.message-left .timestamp { color: var(--comment); }

/* --- Components: Input Area --- */
.input-area { padding: 24px; background-color: var(--bg); }

.glass-panel {
    background: var(--current);
    border: none;
    border-radius: var(--radius-lg);
    padding: 8px;
    display: flex; 
    align-items: center; 
    gap: 8px;
    transition: background-color 0.2s;
}
.glass-panel:focus-within { background-color: #50536b; }

#message-input {
    flex: 1; 
    background: transparent; 
    border: none;
    color: var(--fg); 
    padding: 12px; 
    font-family: inherit; 
    outline: none;
    font-size: 1rem;
}
#message-input::placeholder { color: var(--comment); }

/* --- Buttons & UI Elements --- */
.btn-icon {
    padding: 12px; 
    border: none; 
    background: transparent;
    color: var(--comment); 
    cursor: pointer; 
    border-radius: 0;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}
.btn-icon:hover { color: var(--cyan); }

.btn-send {
    padding: 12px; 
    border: none; 
    background-color: var(--pink);
    color: var(--bg); 
    border-radius: 0; 
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}
.btn-send:hover { background-color: var(--purple); color: white; }
.btn-send:disabled { background-color: var(--comment); cursor: not-allowed; }

.section-title {
    color: var(--comment); 
    font-size: 0.75rem; 
    font-weight: 700;
    text-transform: uppercase; 
    letter-spacing: 0.1em;
    margin-bottom: 12px; 
    display: block;
}

.collection-btn {
    width: 100%; 
    text-align: left; 
    padding: 12px;
    background: transparent; 
    border: none; 
    border-radius: 0;
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 12px;
    transition: background 0.2s; 
    color: #d1d5db;
    font-family: var(--font-main);
}
.collection-btn:hover { background-color: var(--current); color: white; }

.dot { width: 12px; height: 12px; border-radius: 50%; }

.token-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.token-card {
    padding: 12px; 
    background-color: var(--current);
    border-radius: 0; 
    cursor: pointer; 
    transition: background-color 0.2s;
    border: none;
    text-align: left;
    font-family: var(--font-main);
    color: var(--fg);
}
.token-card:hover { background-color: #50536b; }

.token-icon { color: var(--fg); } 
.token-card:hover .token-icon { color: var(--green); }

.status-box {
    background-color: rgba(0, 0, 0, 0.2); 
    padding: 16px;
    border-radius: 0; 
    margin-top: auto;
}

.security-notice {
    color: var(--orange);
    font-size: 0.7rem;
    display: flex;
    align-items: center;
}

/* Status Indicator States */
.dot.connected, .status-box .dot[style*="green"] {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* --- Animation Utilities --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

.md-hidden { display: block; }
@media (min-width: 768px) { .md-hidden { display: none; } }

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
    width: fit-content;
}

.typing-dot {
    width: 8px; height: 8px; 
    background-color: var(--comment);
    border-radius: 50%; 
    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); }
}

/* Code Styling */
code {
    font-family: monospace; 
    background-color: #1e1f29;
    padding: 4px 8px; 
    border-radius: 0; 
    color: var(--green);
    display: inline-block; 
    margin-top: 8px;
}

pre {
    background-color: #1e1f29;
    padding: 12px;
    margin-top: 8px;
    overflow-x: auto;
}

pre code {
    display: block;
    white-space: pre-wrap;
    margin: 0;
    padding: 0;
}

.highlight { font-weight: bold; }
.highlight-pink { color: var(--pink); }
.highlight-purple { color: var(--purple); }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--current); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--comment); }

/* --- Step Indicator --- */
.input-footer {
    text-align: center;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.version-text {
    font-size: 0.65rem;
    color: var(--comment);
    opacity: 0.5;
}

.step-indicator {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 4px;
    min-height: 16px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
}

.step-square {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    animation: stepFadeIn 0.3s ease-out;
    position: relative;
    cursor: help;
}

.step-square::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--current);
    color: var(--fg);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    margin-bottom: 4px;
    z-index: 100;
}

.step-square:hover::after {
    opacity: 1;
}

/* Step Colors */
.step-red {
    background-color: var(--red);
}

.step-yellow {
    background-color: var(--yellow);
}

.step-green-light {
    background-color: #7dcea0;
}

.step-green {
    background-color: var(--green);
}

@keyframes stepFadeIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .chat-header {
        padding: 0 16px;
    }
    
    .messages {
        padding: 16px;
    }
    
    .input-area {
        padding: 16px;
    }
}
