/* ========================================
   Dream Trading System - Modern UI
   ======================================== */

/* CSS Variables */
:root {
    /* Colors - Dark Theme */
    --bg-primary: #0b0e14;
    --bg-secondary: #151922;
    --bg-tertiary: #1c212e;
    --bg-hover: #252b3a;

    /* Accent Colors */
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-cyan: #06b6d4;
    --accent-purple: #8b5cf6;

    /* Signal Colors */
    --color-long: #22c55e;
    --color-long-dim: rgba(34, 197, 94, 0.15);
    --color-short: #ef4444;
    --color-short-dim: rgba(239, 68, 68, 0.15);

    /* Text Colors */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Border */
    --border-color: #2d3545;

    /* Spacing */
    --sidebar-width: 240px;
    --header-height: 64px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);
    --shadow-glow-green: 0 0 20px rgba(34, 197, 94, 0.3);
    --shadow-glow-red: 0 0 20px rgba(239, 68, 68, 0.3);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* Reset */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
}

/* ========================================
   Sidebar
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.logo svg {
    width: 28px;
    height: 28px;
    color: var(--accent-blue);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all var(--transition-fast);
    font-size: 0.9375rem;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-blue);
    color: white;
    box-shadow: var(--shadow-glow-blue);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    position: relative;
}

.status-dot.online {
    background: var(--color-long);
}

.status-dot.online::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: var(--color-long);
    opacity: 0.4;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 0.4;
    }
    50% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* ========================================
   Main Wrapper
   ======================================== */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ========================================
   Top Bar
   ======================================== */
.top-bar {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    flex: 1;
    padding: 1.5rem;
    overflow-x: auto;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-blue-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-icon.spinning svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   Form Elements
   ======================================== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input,
.form-select {
    padding: 0.625rem 0.875rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

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

/* ========================================
   Cards
   ======================================== */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: var(--bg-hover);
}

.card-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

/* ========================================
   Stats Grid
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all var(--transition-normal);
}

.stat-card:hover {
    border-color: var(--bg-hover);
    transform: translateY(-2px);
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: "JetBrains Mono", monospace;
}

.stat-value.positive {
    color: var(--color-long);
}

.stat-value.negative {
    color: var(--color-short);
}

/* ========================================
   Signal Cards
   ======================================== */
.signals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1rem;
}

.signal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.signal-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    transition: all var(--transition-normal);
}

.signal-card.LONG::before {
    background: var(--color-long);
}

.signal-card.SHORT::before {
    background: var(--color-short);
}

.signal-card:hover {
    transform: translateY(-2px);
    border-color: var(--bg-hover);
}

.signal-card.LONG:hover {
    box-shadow: var(--shadow-glow-green);
}

.signal-card.SHORT:hover {
    box-shadow: var(--shadow-glow-red);
}

.signal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-left: 0.75rem;
}

.signal-symbol {
    font-size: 1.125rem;
    font-weight: 700;
    font-family: "JetBrains Mono", monospace;
    color: var(--text-primary);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-long {
    background: var(--color-long-dim);
    color: var(--color-long);
}

.badge-short {
    background: var(--color-short-dim);
    color: var(--color-short);
}

.signal-body {
    padding-left: 0.75rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.signal-field {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.signal-field.full-width {
    grid-column: 1 / -1;
}

.signal-field-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.signal-field-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    font-family: "JetBrains Mono", monospace;
}

.signal-reasoning {
    margin-top: 1rem;
    padding: 0.875rem;
    padding-left: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.6;
    border-left: 2px solid var(--border-color);
}

.signal-card.LONG .signal-reasoning {
    border-left-color: var(--color-long);
}

.signal-card.SHORT .signal-reasoning {
    border-left-color: var(--color-short);
}

/* ========================================
   Search & Filter Section
   ======================================== */
.filter-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-form .form-group {
    flex: 1;
    min-width: 150px;
}

.filter-form .btn {
    height: 38px;
}

/* ========================================
   History List
   ======================================== */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transition: all var(--transition-fast);
}

.history-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--bg-hover);
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-title {
    font-weight: 600;
    font-size: 0.9375rem;
}

.history-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.history-stats {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.history-stat {
    text-align: center;
}

.history-stat-value {
    font-size: 1.125rem;
    font-weight: 700;
    font-family: "JetBrains Mono", monospace;
    color: var(--text-primary);
}

.history-stat-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ========================================
   Fibonacci Page
   ======================================== */
.fib-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.fib-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.fib-chart-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 1rem;
}

.fib-chart-container canvas {
    display: block;
    width: 100%;
}

.fib-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.fib-card-body {
    padding: 0;
}

.fib-table {
    width: 100%;
    border-collapse: collapse;
}

.fib-table th,
.fib-table td {
    padding: 0.75rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.fib-table th {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-tertiary);
}

.fib-table td {
    font-size: 0.875rem;
    font-family: "JetBrains Mono", monospace;
}

.fib-table tr:hover td {
    background: var(--bg-tertiary);
}

.price-current {
    color: var(--accent-cyan);
    font-weight: 600;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state-desc {
    font-size: 0.875rem;
}

/* ========================================
   Loading & Skeleton
   ======================================== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 25%,
        var(--bg-hover) 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 14, 20, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========================================
   Toast Notifications
   ======================================== */
#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast.success {
    border-left: 3px solid var(--color-long);
}

.toast.error {
    border-left: 3px solid var(--color-short);
}

.toast.info {
    border-left: 3px solid var(--accent-blue);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-exit {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ========================================
   Cycle Details Panel
   ======================================== */
.cycle-details {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.cycle-details.hidden {
    display: none;
}

.cycle-details-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.cycle-details-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .signals-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-form {
        flex-direction: column;
    }

    .filter-form .form-group {
        width: 100%;
    }

    .history-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-stats {
        width: 100%;
        justify-content: space-between;
    }
}

/* ========================================
   Utilities
   ======================================== */
.hidden {
    display: none !important;
}

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

.text-success {
    color: var(--color-long);
}

.text-danger {
    color: var(--color-short);
}

.font-mono {
    font-family: "JetBrains Mono", monospace;
}

/* ========================================
   Login Page
   ======================================== */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-primary);
}

.login-container {
    width: 100%;
    max-width: 380px;
    padding: 2.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.login-logo {
    text-align: center;
    color: var(--accent-blue);
    margin-bottom: 0.5rem;
}

.login-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.login-form .form-group {
    margin-bottom: 1rem;
}

.login-btn {
    width: 100%;
    margin-top: 0.5rem;
}

.password-input-wrapper {
    position: relative;
}

.password-input-wrapper .form-input {
    padding-right: 2.5rem;
}

.password-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

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

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 900;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 420px;
    max-width: 90vw;
    z-index: 910;
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1rem;
}

.modal-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--color-short);
    color: var(--color-short);
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    text-align: center;
}

/* ========================================
   Chat FAB & Drawer
   ======================================== */
.chat-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-blue);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    transition: all 150ms ease;
    z-index: 900;
}

.chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.chat-fab svg {
    width: 24px;
    height: 24px;
}

.chat-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11, 14, 20, 0.5);
    z-index: 950;
    opacity: 0;
    visibility: hidden;
    transition: all 250ms ease;
}

.chat-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.chat-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 250ms ease;
}

.chat-drawer.open {
    transform: translateX(0);
}

.chat-drawer__header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-drawer__title {
    font-weight: 600;
    font-size: 1rem;
}

.chat-drawer__actions {
    display: flex;
    gap: 0.25rem;
}

.chat-drawer__messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-msg {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-msg--user {
    align-self: flex-end;
    background: var(--accent-blue);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-msg--assistant {
    align-self: flex-start;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}

.chat-msg--loading {
    align-self: flex-start;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-style: italic;
}

.chat-welcome {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 2rem 1rem;
}

.chat-drawer__input {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.chat-drawer__input .form-input {
    flex: 1;
}

.chat-drawer__feedback {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-shrink: 0;
}

.chat-drawer__feedback-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.sidebar-logout {
    margin-left: auto;
}

@media (max-width: 768px) {
    .chat-drawer {
        width: 100vw;
    }
}

/* ---- Scanner Page ---- */

.scanners-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.scanners-toolbar {
    display: flex;
    justify-content: flex-end;
}

.scanner-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

/* ---- Chat Image Upload ---- */
.chat-image-preview {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    flex-wrap: wrap;
    background: var(--bg-tertiary);
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.chat-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.chat-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-preview-remove:hover {
    background: #ef4444;
}

/* ---- Chat Message Images ---- */
.chat-msg-images {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.chat-msg-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-msg-image:hover {
    transform: scale(1.05);
}

/* ---- Chat Markdown Formatting ---- */
.chat-msg--assistant code {
    background: var(--bg-tertiary);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.875em;
    color: var(--accent-cyan);
}

.chat-msg--assistant pre {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 0.5rem 0;
    border: 1px solid var(--border-color);
}

.chat-msg--assistant pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.chat-msg--assistant strong {
    font-weight: 600;
    color: var(--text-primary);
}

.chat-msg--assistant em {
    font-style: italic;
    color: var(--text-secondary);
}

.chat-msg--assistant a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s;
}

.chat-msg--assistant a:hover {
    color: var(--accent-blue-hover);
    text-decoration: underline;
}
