/* ==========================================
   AI 台股自動模擬交易平台 - Premium Dark Theme
   ========================================== */
:root {
    /* 色彩系統 */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a1f2e;
    --bg-card-hover: #1f2537;
    --bg-input: #0d1117;
    --border-color: rgba(255, 255, 255, 0.06);
    --border-active: rgba(99, 102, 241, 0.4);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-primary: #6366f1;
    --accent-primary-glow: rgba(99, 102, 241, 0.25);
    --accent-success: #10b981;
    --accent-success-soft: rgba(16, 185, 129, 0.12);
    --accent-danger: #ef4444;
    --accent-danger-soft: rgba(239, 68, 68, 0.12);
    --accent-warning: #f59e0b;
    --accent-info: #3b82f6;
    --accent-buy: #10b981;
    --accent-sell: #ef4444;
    --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
    --gradient-success: linear-gradient(135deg, #10b981, #06d6a0);
    --gradient-danger: linear-gradient(135deg, #ef4444, #f97316);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 淺色模式主題變數 */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-input: #ffffff;
    --border-color: #e2e8f0;
    --border-active: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ==========================================
   Header
   ========================================== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--bg-hover, rgba(255, 255, 255, 0.1));
    color: var(--text-primary);
}

[data-theme="light"] .theme-toggle:hover {
    background: #e2e8f0;
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 24px;
    filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.5));
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.logo-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.market-ticker {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.ticker-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
}

.ticker-value {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.ticker-change {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
}

.ticker-change.up {
    color: var(--accent-success);
    background: var(--accent-success-soft);
}

.ticker-change.down {
    color: var(--accent-danger);
    background: var(--accent-danger-soft);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    /* 預設顏色 (來自 CasualTrader bg-gray-500) */
    background: #6b7280;
}

/* CasualTrader 的狀態樣式 */
.status-running {
    background: #10b981;
    /* Tailwind emerald-500 */
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.status-stopped {
    background: #ef4444;
    /* Tailwind red-500 */
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.bg-gray-500 {
    background: #6b7280;
    box-shadow: none;
}

.blinking {
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ==========================================
   Main
   ========================================== */
.main {
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px 24px;
}

/* ==========================================
   Metrics Cards
   ========================================== */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: var(--transition);
}

.metric-card:hover {
    border-color: var(--border-active);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.metric-card:hover::before {
    opacity: 1;
}

.metric-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.metric-value {
    font-family: var(--font-mono);
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.metric-sub {
    font-size: 13px;
    font-weight: 500;
    margin-top: 4px;
    font-family: var(--font-mono);
}

.metric-sub.positive {
    color: var(--accent-success);
}

.metric-sub.negative {
    color: var(--accent-danger);
}

/* ==========================================
   Control Panel
   ========================================== */
.control-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}

.control-left,
.control-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    font-size: 16px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.btn-glow {
    animation: glow-pulse 3s infinite;
}

@keyframes glow-pulse {

    0%,
    100% {
        box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    }

    50% {
        box-shadow: 0 2px 20px rgba(99, 102, 241, 0.5);
    }
}

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

.btn-secondary:hover:not(:disabled) {
    border-color: var(--border-active);
    background: var(--bg-card-hover);
}

.btn-outline {
    background: transparent;
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
}

.btn-outline:hover:not(:disabled) {
    background: var(--accent-primary-glow);
}

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

.btn-danger {
    background: var(--accent-danger-soft);
    color: var(--accent-danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

/* ==========================================
   Content Grid
   ========================================== */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    overflow: hidden;
}

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

.card-header h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 16px 20px;
}

.card-chart .card-body {
    padding: 16px 20px 8px;
    height: 360px;
}

.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    background: var(--bg-input);
    color: var(--text-secondary);
    border-radius: 10px;
    font-family: var(--font-mono);
}

.badge-ai {
    background: var(--accent-primary-glow);
    color: var(--accent-primary);
}

/* ==========================================
   Tables
   ========================================== */
.table-wrapper {
    overflow-x: auto;
}

.table-scroll {
    max-height: 300px;
    overflow-y: auto;
}

.table-scroll::-webkit-scrollbar {
    width: 4px;
}

.table-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.table-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead th {
    text-align: left;
    padding: 10px 12px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}

.data-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-family: var(--font-mono);
    font-size: 12.5px;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.empty-state {
    text-align: center !important;
    color: var(--text-muted) !important;
    padding: 30px 12px !important;
    font-family: var(--font-sans) !important;
    font-style: italic;
}

.tag-buy {
    color: var(--accent-buy);
    background: var(--accent-success-soft);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11px;
}

.tag-sell {
    color: var(--accent-sell);
    background: var(--accent-danger-soft);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11px;
}

.positive {
    color: var(--accent-success) !important;
}

.negative {
    color: var(--accent-danger) !important;
}

/* ==========================================
   AI Log
   ========================================== */
.card-ai {
    position: sticky;
    top: 80px;
}

.ai-log {
    max-height: calc(100vh - 320px);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-log::-webkit-scrollbar {
    width: 4px;
}

.ai-log::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.ai-empty {
    text-align: center;
    padding: 40px 20px;
}

.ai-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.ai-empty-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.ai-empty-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.ai-entry {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.ai-entry-time {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.ai-entry-model {
    font-size: 10px;
    color: var(--accent-primary);
    background: var(--accent-primary-glow);
    padding: 1px 6px;
    border-radius: 4px;
}

.ai-entry-summary {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

.ai-entry-decisions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-decision-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
}

.ai-decision-item .action {
    font-weight: 700;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 3px;
}

.ai-decision-item .action.buy {
    color: var(--accent-buy);
    background: var(--accent-success-soft);
}

.ai-decision-item .action.sell {
    color: var(--accent-sell);
    background: var(--accent-danger-soft);
}

.ai-decision-item .detail {
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.ai-decision-item .reason {
    color: var(--text-muted);
    font-size: 11px;
    flex: 1;
    text-align: right;
}

/* 可展開的 AI 日誌 */
.ai-entry-expandable {
    cursor: pointer;
    transition: border-color 0.2s;
}

.ai-entry-expandable:hover {
    border-color: var(--border-active);
}

.ai-expand-icon {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.3s ease;
    display: inline-block;
}

.ai-entry-expanded .ai-expand-icon {
    transform: rotate(180deg);
}

/* 詳細報告區（預設隱藏） */
.ai-detail {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
    margin-top: 0;
}

.ai-entry-expanded .ai-detail {
    max-height: 2000px;
    opacity: 1;
    margin-top: 10px;
}

/* 各分析師報告區塊 */
.ai-report-section {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border-left: 3px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.ai-report-section:last-child {
    margin-bottom: 0;
}

.ai-report-technical {
    border-left-color: #6366f1;
}

.ai-report-sentiment {
    border-left-color: #a855f7;
}

.ai-report-risk {
    border-left-color: #f59e0b;
}

.ai-report-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ai-report-content {
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.6;
    word-break: break-word;
}

/* ==========================================
   Loading Overlay
   ========================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    text-align: center;
}

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

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

.loading-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.loading-sub {
    font-size: 13px;
    color: var(--text-muted);
}

/* ==========================================
   Toast Notifications
   ========================================== */
.toast-container {
    position: fixed;
    top: 72px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9998;
}

.toast {
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 3.7s forwards;
    max-width: 360px;
    border: 1px solid var(--border-color);
}

.toast-success {
    background: var(--bg-card);
    color: var(--accent-success);
    border-left: 3px solid var(--accent-success);
}

.toast-error {
    background: var(--bg-card);
    color: var(--accent-danger);
    border-left: 3px solid var(--accent-danger);
}

.toast-info {
    background: var(--bg-card);
    color: var(--accent-info);
    border-left: 3px solid var(--accent-info);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(60px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
        transform: translateX(60px);
    }
}

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 1200px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    .card-ai {
        position: static;
    }

    .ai-log {
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .metrics-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .header {
        padding: 0 12px;
    }

    .header-center {
        display: none;
    }

    .main {
        padding: 12px;
    }

    .control-panel {
        flex-direction: column;
        gap: 10px;
    }

    .control-left,
    .control-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .btn {
        flex: 1;
        justify-content: center;
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .metrics-row {
        grid-template-columns: 1fr;
    }

    .metric-value {
        font-size: 22px;
    }
}

/* ==========================================
   Settings Modal
   ========================================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 500px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.25s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 24px;
}

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

.settings-group {
    margin-bottom: 16px;
}

.settings-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.settings-hint {
    font-weight: 400;
    color: var(--accent-primary);
    font-size: 12px;
    margin-left: 8px;
}

.settings-hint a {
    color: var(--accent-primary);
    text-decoration: none;
}

.settings-hint a:hover {
    text-decoration: underline;
}

.settings-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: var(--font-mono);
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: var(--transition);
}

.settings-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.settings-input option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.settings-note {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.5;
}

.settings-row {
    display: flex;
    gap: 16px;
}

.settings-textarea {
    resize: vertical;
    min-height: 80px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
}

/* ==========================================
   Floating AI Status Bar (non-blocking)
   ========================================== */
.ai-status-bar {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    width: 380px;
    max-width: calc(100vw - 48px);
    background: var(--bg-card);
    border: 1px solid var(--border-active);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(99, 102, 241, 0.15);
    overflow: hidden;
    animation: statusSlideIn 0.3s ease;
}

.ai-status-bar.active {
    display: block;
}

@keyframes statusSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.ai-status-header:hover {
    background: var(--bg-card-hover);
}

.ai-status-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-status-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.ai-status-toggle {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.ai-status-bar.collapsed .ai-status-toggle {
    transform: rotate(180deg);
}

.ai-status-logs {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px 12px;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.ai-status-bar.collapsed .ai-status-logs {
    max-height: 0;
    padding: 0 12px;
    overflow: hidden;
}

.ai-status-logs::-webkit-scrollbar {
    width: 3px;
}

.ai-status-logs::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.ai-status-log-item {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    padding: 2px 0;
    line-height: 1.4;
}

.ai-status-progress {
    height: 2px;
    background: var(--border-color);
    overflow: hidden;
}

.ai-status-progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0% {
        width: 15%;
        margin-left: 0;
    }

    50% {
        width: 40%;
        margin-left: 30%;
    }

    100% {
        width: 15%;
        margin-left: 85%;
    }
}

/* ==========================================
   Toast Notifications
   ========================================== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 3.5s forwards;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    max-width: 400px;
}

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

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

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

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* ==========================================
   Footer
   ========================================== */
.site-footer {
    max-width: 1440px;
    margin: 40px auto 0;
    padding: 24px 24px 32px;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-brand {
    font-weight: 700;
    font-size: 14px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.footer-copy {
    font-size: 13px;
    color: var(--text-secondary);
}

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

.footer-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.footer-link:hover {
    color: var(--accent-primary);
}

.footer-link svg {
    opacity: 0.7;
    transition: var(--transition);
}

.footer-link:hover svg {
    opacity: 1;
}

.footer-disclaimer {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
}