/* ==========================================================================
   Aura AI Chat - Premium CSS Design System
   ========================================================================== */

/* --- CSS Variables & Design Tokens --- */
:root {
    --bg-primary: #07090e;
    --bg-secondary: #0c0f17;
    --bg-glass-dark: rgba(13, 17, 28, 0.7);
    --bg-glass-light: rgba(255, 255, 255, 0.03);
    
    --border-glass: rgba(255, 255, 255, 0.07);
    --border-glass-active: rgba(0, 242, 254, 0.3);
    
    /* Harmonious Curated Gradients & HSL Accents */
    --accent-cyan: #00f2fe;
    --accent-blue: #4facfe;
    --accent-purple: #8e2de2;
    --accent-pink: #f857a6;
    
    --grad-primary: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
    --grad-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --grad-purple: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%);
    --grad-glow: radial-gradient(circle, rgba(0, 242, 254, 0.15) 0%, rgba(142, 45, 226, 0.05) 50%, transparent 100%);
    
    /* Text Colors */
    --text-primary: #f7fafc;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    
    /* Borders & Rounding */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 9999px;
    
    /* Shadow effects */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(0, 242, 254, 0.25);
    
    /* Fonts */
    --font-ar: 'Cairo', sans-serif;
    --font-en: 'Outfit', sans-serif;
    
    /* Timing & Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Base & Reset Rules --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--border-glass) transparent;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-ar);
    overflow: hidden;
    height: 100vh;
    display: flex;
    -webkit-tap-highlight-color: transparent;
}

/* Selection highlight */
::selection {
    background: rgba(0, 242, 254, 0.2);
    color: #fff;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

/* --- App Layout --- */
.app-container {
    display: flex;
    width: 100%;
    height: 100vh;
    position: relative;
}

/* --- Sidebar Styles --- */
.sidebar {
    width: 320px;
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
    z-index: 100;
    transition: transform var(--transition-smooth);
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-glass);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.logo-glow {
    position: absolute;
    width: 30px;
    height: 30px;
    background: var(--accent-cyan);
    filter: blur(15px);
    opacity: 0.6;
    border-radius: 50%;
    animation: pulseGlow 4s infinite alternate;
}

.logo-icon {
    font-size: 24px;
    background: var(--grad-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    z-index: 1;
}

.logo-text {
    font-family: var(--font-en);
    font-weight: 700;
    font-size: 22px;
    letter-spacing: 0.5px;
    z-index: 1;
}

.accent-text {
    background: var(--grad-purple);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.icon-btn.mobile-close {
    display: none;
    color: var(--text-secondary);
}

/* New Chat Button */
.new-chat-btn {
    margin: 20px 24px 10px 24px;
    padding: 14px 20px;
    background: var(--bg-glass-light);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-ar);
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.new-chat-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--grad-accent);
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 0;
}

.new-chat-btn span, .new-chat-btn i {
    position: relative;
    z-index: 1;
}

.new-chat-btn:hover {
    border-color: var(--accent-cyan);
    box-shadow: var(--shadow-glow);
}

.new-chat-btn:hover::before {
    opacity: 0.08;
}

/* Chat History List */
.chats-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px 24px;
    display: flex;
    flex-direction: column;
}

.list-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    margin-top: 10px;
}

.chats-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: transparent;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    group-hover: show-actions;
}

.chat-item:hover, .chat-item.active {
    background: var(--bg-glass-light);
    border-color: var(--border-glass);
}

.chat-item.active {
    border-color: rgba(0, 242, 254, 0.2);
}

.chat-item-link {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.chat-item-link i {
    font-size: 15px;
    flex-shrink: 0;
}

.chat-item.active .chat-item-link {
    color: var(--text-primary);
}

.chat-title-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Chat Item Actions (Rename, Delete) */
.chat-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.chat-item:hover .chat-actions, .chat-item.active .chat-actions {
    opacity: 1;
}

.chat-action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 4px;
    cursor: pointer;
    font-size: 12px;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.chat-action-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.chat-action-btn.delete-chat:hover {
    color: var(--accent-pink);
    background: rgba(248, 87, 166, 0.1);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-btn {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-ar);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all var(--transition-fast);
}

.footer-btn:hover {
    background: var(--bg-glass-light);
    color: var(--text-primary);
    border-color: var(--border-glass-active);
}

.footer-btn.danger {
    border-color: rgba(248, 87, 166, 0.15);
}

.footer-btn.danger:hover {
    background: rgba(248, 87, 166, 0.05);
    color: #ff6b8b;
    border-color: rgba(248, 87, 166, 0.4);
}

.app-version {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    padding-top: 4px;
    font-family: var(--font-en);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-ar);
    font-size: 10px;
    font-weight: 600;
}

.status-indicator::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-indicator.online::before {
    background: #00e676;
    box-shadow: 0 0 8px #00e676;
}

.status-indicator.offline::before {
    background: var(--text-muted);
}

/* --- Main Chat Area Styles --- */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    background-color: var(--bg-primary);
    overflow: hidden;
}

/* Ambient Radial Background Glows */
.chat-area::before {
    content: '';
    position: absolute;
    top: -10%;
    left: -10%;
    width: 50%;
    height: 50%;
    background: var(--grad-glow);
    pointer-events: none;
    z-index: 0;
}

/* Topbar */
.topbar {
    height: 70px;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(7, 9, 14, 0.4);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    color: var(--text-primary);
    background: var(--bg-glass-light);
}

.menu-toggle-btn {
    display: none;
}

.active-chat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.active-chat-title {
    font-size: 16px;
    font-weight: 700;
}

.active-model-badge {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-en);
    display: flex;
    align-items: center;
    gap: 6px;
}

.active-model-badge i {
    color: var(--accent-cyan);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-icon-btn {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    transition: all var(--transition-fast);
}

.action-icon-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-cyan);
    background: rgba(0, 242, 254, 0.05);
}

/* --- Messages Container & Scroll Window --- */
.messages-container {
    flex: 1;
    overflow-y: auto;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    padding: 30px 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

/* --- Welcome / Empty State Screen --- */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px;
    text-align: center;
    gap: 40px;
}

.welcome-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.animated-bg-circles {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    pointer-events: none;
    z-index: 0;
}

.circle {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px dashed rgba(0, 242, 254, 0.1);
}

.circle.c-1 {
    animation: rotateSlow 20s linear infinite;
}

.circle.c-2 {
    transform: scale(0.7);
    border-style: dotted;
    border-color: rgba(142, 45, 226, 0.15);
    animation: rotateSlow 15s linear infinite reverse;
}

.welcome-logo {
    width: 70px;
    height: 70px;
    background: var(--grad-accent);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #fff;
    margin-bottom: 24px;
    box-shadow: 0 8px 30px rgba(0, 242, 254, 0.3);
    position: relative;
    z-index: 1;
}

.welcome-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 12px;
    z-index: 1;
}

.gradient-text {
    background: linear-gradient(90deg, #00f2fe, #4facfe, #8e2de2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.8;
    max-width: 540px;
    z-index: 1;
}

/* Quick Prompts Grid */
.quick-prompts-section {
    width: 100%;
    z-index: 1;
}

.section-heading {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.section-heading i {
    color: var(--accent-cyan);
}

.prompts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    width: 100%;
}

.prompt-card {
    background: var(--bg-glass-dark);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: right;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.prompt-card:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3), var(--shadow-glow);
}

.prompt-card-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.prompt-card h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.prompt-card p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Custom text classes for cards */
.text-cyan { color: var(--accent-cyan); }
.text-gold { color: #ffb347; }
.text-purple { color: #c084fc; }

/* --- Chat Bubbles (Message Styles) --- */
.message {
    display: flex;
    gap: 16px;
    width: 100%;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* User Message bubble - Clean Gradient align left (meaning right in RTL, but let's align user to right and assistant to left) */
.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.message.user .message-avatar {
    background: var(--grad-purple);
    color: #fff;
}

.message.assistant .message-avatar {
    background: var(--grad-primary);
    color: #fff;
    position: relative;
}

.message.assistant .message-avatar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    box-shadow: 0 0 10px rgba(0, 198, 255, 0.5);
    opacity: 0.6;
}

.message-content-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 78%;
    gap: 6px;
}

.message.user .message-content-wrapper {
    align-items: flex-end;
}

.message.assistant .message-content-wrapper {
    align-items: flex-start;
}

.message-bubble {
    padding: 14px 20px;
    font-size: 14.5px;
    line-height: 1.7;
    position: relative;
    word-break: break-word;
}

.message.user .message-bubble {
    background: var(--grad-purple);
    color: #fff;
    border-radius: var(--radius-lg) 0 var(--radius-lg) var(--radius-lg);
    box-shadow: 0 4px 15px rgba(142, 45, 226, 0.15);
}

.message.assistant .message-bubble {
    background: var(--bg-glass-dark);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

.message-meta {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-en);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 6px;
}

/* Bubble Copy Button */
.message-bubble-actions {
    position: absolute;
    bottom: -15px;
    left: 10px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 5;
}

.message.user .message-bubble-actions {
    left: auto;
    right: 10px;
}

.message:hover .message-bubble-actions {
    opacity: 1;
}

.bubble-action-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    padding: 4px 8px;
    font-size: 10px;
    font-family: var(--font-ar);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.bubble-action-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-cyan);
    background: var(--bg-primary);
}

/* --- Code Highlight & Markdown Styling --- */
.message-bubble p {
    margin-bottom: 12px;
}
.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble strong {
    font-weight: 700;
    color: #fff;
}

.message-bubble ul, .message-bubble ol {
    margin: 8px 20px 14px 20px;
    padding-right: 10px;
}

.message-bubble li {
    margin-bottom: 6px;
}

.message-bubble code {
    font-family: var(--font-en);
    background: rgba(0, 0, 0, 0.35);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 12.5px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #e5c07b;
    word-break: break-all;
}

/* Multi-line code block */
.code-block-wrapper {
    margin: 14px 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-sm);
    direction: ltr;
    text-align: left;
}

.code-block-header {
    background: #0b0c10;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-en);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.code-lang-label {
    text-transform: uppercase;
    font-weight: 700;
    color: var(--accent-cyan);
}

.copy-code-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-family: var(--font-en);
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.copy-code-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.code-block-wrapper pre {
    background: #0f111a;
    padding: 16px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13.5px;
    line-height: 1.6;
    color: #abb2bf;
}

/* --- Typing Indicator Animation --- */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--accent-cyan);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* --- Footer & Input Field Section --- */
.input-section {
    padding: 10px 40px 24px 40px;
    background: transparent;
    z-index: 5;
}

.input-wrapper {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.input-container {
    background: var(--bg-glass-dark);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(15px);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    position: relative;
}

.input-container:focus-within {
    border-color: rgba(0, 242, 254, 0.35);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 242, 254, 0.05);
}

.chat-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-ar);
    font-size: 14.5px;
    line-height: 1.6;
    resize: none;
    max-height: 200px;
    min-height: 24px;
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.input-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 10px;
}

.input-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    color: var(--text-primary);
    background: var(--bg-glass-light);
}

.send-btn {
    background: var(--grad-primary);
    border: none;
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(0, 198, 255, 0.25);
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 198, 255, 0.4);
}

.send-btn:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.footer-note {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 10px;
}

/* --- Floating Settings Drawer & Overlay --- */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-smooth);
}

.drawer-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.settings-drawer {
    position: fixed;
    top: 0;
    left: 0; /* Align to left to slide out elegantly over sidebar or chat in RTL context */
    width: 440px;
    height: 100vh;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-glass);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform var(--transition-smooth);
    box-shadow: 20px 0 40px rgba(0, 0, 0, 0.6);
}

/* Slide in state */
.settings-drawer.active {
    transform: translateX(0);
}

.drawer-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-header h3 {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.drawer-header h3 i {
    color: var(--accent-cyan);
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

/* Settings Form Elements */
.settings-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-label-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.range-val {
    font-family: var(--font-en);
    font-weight: 600;
    font-size: 12px;
    background: rgba(0, 242, 254, 0.1);
    color: var(--accent-cyan);
    padding: 2px 8px;
    border-radius: 4px;
}

.info-tag {
    font-size: 10px;
    background: rgba(0, 230, 118, 0.1);
    color: #00e676;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 12px 16px;
    font-family: var(--font-ar);
    font-size: 13.5px;
    outline: none;
    transition: all var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.1);
}

/* Password Input styling */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-left: 46px; /* Space for the toggle icon */
}

.toggle-password {
    position: absolute;
    left: 14px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

.toggle-password:hover {
    color: var(--text-primary);
}

.input-help-text {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
}

.input-help-text a {
    color: var(--accent-blue);
    text-decoration: none;
}

.input-help-text a:hover {
    text-decoration: underline;
}

/* Mock Mode Switch Toggle */
.toggle-mode-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.mode-toggle-field {
    position: relative;
    flex-shrink: 0;
}

.switch-input {
    display: none;
}

.switch-label {
    display: block;
    width: 48px;
    height: 24px;
    background-color: var(--text-muted);
    border-radius: var(--radius-pill);
    cursor: pointer;
    position: relative;
    transition: background-color var(--transition-fast);
}

.switch-handle {
    display: block;
    width: 18px;
    height: 18px;
    background-color: #fff;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    right: 3px;
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.switch-input:checked + .switch-label {
    background: var(--grad-primary);
}

.switch-input:checked + .switch-label .switch-handle {
    transform: translateX(-24px); /* Shifts to the left in LTR, let's make it universal by offset */
}

.mode-text-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mode-title {
    font-size: 13px;
    font-weight: 700;
}

.mode-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Range input style */
.form-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--border-glass);
    border-radius: var(--radius-pill);
    outline: none;
    margin: 10px 0;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-cyan);
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-cyan);
    transition: transform var(--transition-fast);
}

.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
}

.divider {
    height: 1px;
    background: var(--border-glass);
    margin: 10px 0;
}

/* Export Area inside Drawer */
.drawer-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.drawer-actions h4 {
    font-size: 13px;
    font-weight: 700;
}

.export-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.outline-btn {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    padding: 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-ar);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-fast);
}

.outline-btn:hover {
    background: var(--bg-glass-light);
    color: var(--text-primary);
    border-color: var(--border-glass-active);
}

/* Drawer Footer Buttons */
.drawer-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-glass);
}

.primary-btn {
    width: 100%;
    background: var(--grad-primary);
    border: none;
    color: #fff;
    padding: 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-ar);
    font-weight: 600;
    font-size: 14px;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(0, 198, 255, 0.25);
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 198, 255, 0.4);
}

/* --- Info/Guide Modal Backdrop & Card --- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--transition-smooth);
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 580px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    transform: scale(0.9);
    transition: transform var(--transition-smooth);
}

.modal-backdrop.active .modal-card {
    transform: scale(1);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    font-size: 13.5px;
    line-height: 1.8;
    color: var(--text-secondary);
}

.modal-body p {
    margin-bottom: 14px;
}

.modal-body h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 20px;
    margin-bottom: 8px;
}

.modal-body ul {
    margin-right: 18px;
    margin-bottom: 14px;
}

.modal-body li {
    margin-bottom: 6px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    justify-content: flex-end;
}

/* --- Dynamic Animations --- */
@keyframes pulseGlow {
    0% { transform: scale(1); opacity: 0.4; }
    100% { transform: scale(1.3); opacity: 0.7; }
}

@keyframes rotateSlow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideUp {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes typingBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* --- Responsive Adaptations (Mobile & Tablet) --- */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        right: 0; /* Slide in from the right for RTL layout */
        top: 0;
        height: 100vh;
        transform: translateX(100%);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .icon-btn.mobile-close {
        display: flex;
    }
    
    .menu-toggle-btn {
        display: flex;
    }
    
    /* Make Settings Drawer Responsive too */
    .settings-drawer {
        width: 100%;
        max-width: 440px;
    }
}

@media (max-width: 768px) {
    .chat-messages {
        padding: 20px 16px;
        gap: 20px;
    }
    
    .input-section {
        padding: 10px 16px 16px 16px;
    }
    
    .prompts-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .welcome-title {
        font-size: 24px;
    }
    
    .welcome-subtitle {
        font-size: 13.5px;
    }
    
    .message-content-wrapper {
        max-width: 88%;
    }
    
    .message-bubble {
        padding: 12px 16px;
        font-size: 13.5px;
    }
}
