@tailwind base;
@tailwind components;
@tailwind utilities;

/* ─── Glass Effect ─── */
.glass {
    background: rgba(250, 250, 248, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(37, 99, 235, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.dark .glass {
    background: rgba(15, 15, 15, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ─── Scrollbar ─── */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.custom-scrollbar::-webkit-scrollbar { width: 5px; height: 5px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(37, 99, 235, 0.15); border-radius: 10px; }
.dark .custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(59, 130, 246, 0.2); }

/* ─── Animations ─── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in { animation: fadeIn 0.3s ease-out forwards; }

@keyframes pulse-slow {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}
.animate-pulse-slow { animation: pulse-slow 8s ease-in-out infinite; }

/* ─── Chat Bubbles ─── */
.user-bubble {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 50%, #1e40af 100%);
}
.assistant-bubble {
    background: white;
    border: 1px solid rgba(37, 99, 235, 0.1);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}
.dark .assistant-bubble {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ─── Notebook Cells ─── */
.nb-cell {
    border: 1px solid rgba(37, 99, 235, 0.1);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.nb-cell:hover { border-color: rgba(37, 99, 235, 0.25); }
.dark .nb-cell {
    border-color: rgba(255, 255, 255, 0.07);
}
.dark .nb-cell:hover { border-color: rgba(59, 130, 246, 0.3); }

.nb-cell-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    border-bottom: 1px solid rgba(37, 99, 235, 0.08);
    background: rgba(37, 99, 235, 0.03);
}
.dark .nb-cell-header {
    background: rgba(255, 255, 255, 0.02);
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

.nb-code-editor {
    width: 100%;
    padding: 12px 16px;
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.6;
    background: rgba(37, 99, 235, 0.02);
    color: inherit;
    border: none;
    outline: none;
    resize: vertical;
    min-height: 80px;
    tab-size: 4;
}
.dark .nb-code-editor {
    background: rgba(0, 0, 0, 0.2);
}

.nb-output {
    padding: 12px 16px;
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid rgba(37, 99, 235, 0.06);
    color: #374151;
    max-height: 400px;
    overflow-y: auto;
}
.dark .nb-output {
    background: rgba(0, 0, 0, 0.25);
    border-top-color: rgba(255, 255, 255, 0.04);
    color: #d1d5db;
}

.nb-output.has-error { color: #ef4444; }

.nb-run-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}
.nb-run-btn:hover { background: rgba(37, 99, 235, 0.2); }
.nb-run-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.nb-run-btn .material-icons-round { font-size: 14px; }

.step-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

/* ─── Markdown Rendering ─── */
.md-content h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.md-content h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.5rem; margin-top: 0.25rem; }
.md-content h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.md-content p { margin-bottom: 0.5rem; line-height: 1.6; }
.md-content strong { font-weight: 600; }
.md-content hr { border-color: rgba(37, 99, 235, 0.1); margin: 0.75rem 0; }
.dark .md-content hr { border-color: rgba(255, 255, 255, 0.06); }
.md-content ul, .md-content ol { padding-left: 1.25rem; margin-bottom: 0.5rem; }
.md-content li { margin-bottom: 0.15rem; }
.md-content code {
    background: rgba(37, 99, 235, 0.08);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
}
.md-content table { width: 100%; border-collapse: collapse; margin: 0.5rem 0; font-size: 0.85rem; }
.md-content th, .md-content td { border: 1px solid rgba(37, 99, 235, 0.1); padding: 6px 10px; text-align: left; }
.dark .md-content th, .dark .md-content td { border-color: rgba(255, 255, 255, 0.08); }
.md-content th { background: rgba(37, 99, 235, 0.05); font-weight: 600; }

/* ─── Source Chips ─── */
.source-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(37, 99, 235, 0.06);
    border: 1px solid rgba(37, 99, 235, 0.1);
    color: #666666;
}
.dark .source-chip {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.15);
    color: #a3a3a3;
}

/* ─── Autoplay Button ─── */
.autoplay-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
.autoplay-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4); }
.autoplay-btn:active { transform: scale(0.97); }
.autoplay-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.autoplay-btn.running { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }

/* ─── Autoplay Progress ─── */
.autoplay-progress-bar {
    height: 4px;
    border-radius: 2px;
    background: rgba(37, 99, 235, 0.1);
    overflow: hidden;
}
.dark .autoplay-progress-bar { background: rgba(59, 130, 246, 0.1); }
.autoplay-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    transition: width 0.5s ease;
    border-radius: 2px;
}

.phase-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.3s;
}
.phase-dot.pending {
    background: rgba(37, 99, 235, 0.05);
    color: #a3a3a3;
}
.dark .phase-dot.pending { background: rgba(255, 255, 255, 0.04); color: #666; }
.phase-dot.active {
    background: rgba(37, 99, 235, 0.15);
    color: #2563eb;
    animation: pulse 1.5s ease-in-out infinite;
}
.dark .phase-dot.active { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.phase-dot.done {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.2); }
    50% { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
}

/* ─── Chart Cards ─── */
.chart-card {
    border: 1px solid rgba(37, 99, 235, 0.1);
    border-radius: 12px;
    background: white;
    overflow: hidden;
}
.dark .chart-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.07);
}
.chart-card img { width: 100%; border-radius: 8px; }

/* ─── Results Headings ─── */
.results-heading {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(37, 99, 235, 0.1);
    display: flex;
    align-items: center;
}
.dark .results-heading { border-bottom-color: rgba(255, 255, 255, 0.06); }

/* ─── Evaluation Table ─── */
.eval-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.eval-table th, .eval-table td {
    padding: 8px 12px;
    text-align: center;
    border: 1px solid rgba(37, 99, 235, 0.08);
}
.dark .eval-table th, .dark .eval-table td { border-color: rgba(255, 255, 255, 0.06); }
.eval-table th {
    background: rgba(37, 99, 235, 0.04);
    font-weight: 600;
    font-size: 11px;
    color: #666;
}
.dark .eval-table th { background: rgba(255, 255, 255, 0.03); color: #a3a3a3; }
.eval-table td { font-family: 'JetBrains Mono', monospace; font-size: 11px; }

/* ─── Download Buttons ─── */
.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(37, 99, 235, 0.06);
    color: #2563eb;
    border: 1px solid rgba(37, 99, 235, 0.12);
    cursor: pointer;
    transition: all 0.15s;
}
.download-btn:hover { background: rgba(37, 99, 235, 0.12); transform: translateY(-1px); }
.dark .download-btn {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}
.dark .download-btn:hover { background: rgba(59, 130, 246, 0.15); }
.download-btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
.download-btn-primary:hover {
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}
.dark .download-btn-primary { color: white; }

/* ─── Selection ─── */
::selection { background: rgba(37, 99, 235, 0.25); color: inherit; }
textarea:focus { outline: none; }
