/**
 * Claude Dashboard - Professional Light Theme
 * Navy blue sidebar (#1e3a5f), white cards, light gray background
 */

/* ============================================================
   CSS Custom Properties
   ============================================================ */
:root {
    --primary: #1e3a5f;
    --primary-light: #2a4f7f;
    --primary-dark: #152d4a;
    --secondary: #6c757d;
    --bg-body: #f5f6fa;
    --bg-card: #ffffff;
    --bg-sidebar: #1e3a5f;
    --bg-input: #f8f9fa;
    --border: #dee2e6;
    --text: #212529;
    --text-muted: #6c757d;
    --text-sidebar: rgba(255, 255, 255, 0.8);
    --text-sidebar-active: #ffffff;
    --sidebar-width: 240px;
    --sidebar-hover: rgba(255, 255, 255, 0.1);
    --sidebar-active: rgba(255, 255, 255, 0.15);
}

/* ============================================================
   Base Layout
   ============================================================ */
body {
    background-color: var(--bg-body);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    background: var(--bg-sidebar);
    transition: transform 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar-brand {
    border-bottom-color: rgba(255, 255, 255, 0.15) !important;
}

.sidebar-brand h1,
.sidebar-brand a {
    color: var(--text-sidebar-active) !important;
}

.sidebar-brand small {
    color: rgba(255, 255, 255, 0.5) !important;
    letter-spacing: 0.1em;
    font-size: 0.7rem;
}

.sidebar .nav-link {
    color: var(--text-sidebar);
    border-radius: 6px;
    margin: 2px 8px;
    transition: background 0.2s, color 0.2s;
}

.sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--text-sidebar-active);
}

.sidebar .nav-link.active {
    background: var(--sidebar-active);
    color: var(--text-sidebar-active);
    font-weight: 600;
}

.sidebar .border-top,
.sidebar .border-bottom {
    border-color: rgba(255, 255, 255, 0.15) !important;
}

.sidebar h6 {
    color: rgba(255, 255, 255, 0.5) !important;
}

.sidebar small {
    color: rgba(255, 255, 255, 0.4) !important;
}

/* ============================================================
   Main Content
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
}

.top-header {
    background: var(--bg-card) !important;
    border-bottom: 1px solid var(--border) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.top-header h2 {
    color: var(--text);
}

.content-area {
    background: var(--bg-body);
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px;
    transition: box-shadow 0.2s, transform 0.15s;
}

.project-card {
    cursor: pointer;
}

.project-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    border-color: var(--primary) !important;
}

.project-card .card-title {
    color: var(--text) !important;
}

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

.project-card .card-footer {
    background: var(--bg-body) !important;
    border-top: 1px solid var(--border) !important;
}

.card-header {
    background: var(--bg-body) !important;
    border-bottom: 1px solid var(--border) !important;
    color: var(--text) !important;
}

.card-body {
    color: var(--text);
}

/* ============================================================
   Collapsible Panels
   ============================================================ */
.card-header[role="button"] {
    cursor: pointer;
    user-select: none;
}

.card-header[role="button"]:hover {
    background: #eef0f4 !important;
}

/* ============================================================
   Forms & Inputs
   ============================================================ */
.form-control,
.form-select {
    background-color: var(--bg-card) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(30, 58, 95, 0.15) !important;
}

textarea.form-control {
    background-color: var(--bg-input) !important;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ============================================================
   Code & Pre blocks
   ============================================================ */
pre {
    background: var(--bg-input) !important;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text) !important;
}

code {
    color: #c7254e;
    background: var(--bg-input);
    padding: 2px 4px;
    border-radius: 3px;
}

/* ============================================================
   Prompt & Activity Items
   ============================================================ */
.prompt-item {
    background: var(--bg-input) !important;
    border: 1px solid var(--border);
    border-radius: 6px;
}

/* ============================================================
   Processing Badge & Spinner
   ============================================================ */
.project-processing-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: #d97706;
    font-weight: 600;
}

.spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}

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

/* ============================================================
   Service Toggles (sidebar)
   ============================================================ */
.service-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
}

.service-toggle span {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

.toggle-switch {
    width: 36px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    transition: background 0.3s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.toggle-switch.active {
    background: #198754;
}

.toggle-switch.active::after {
    transform: translateX(16px);
}

.service-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.service-status-dot.running {
    background: #198754;
    box-shadow: 0 0 4px rgba(25, 135, 84, 0.6);
}

.service-status-dot.stopped {
    background: #6c757d;
}

/* ============================================================
   Links
   ============================================================ */
a {
    color: var(--primary);
}

a:hover {
    color: var(--primary-light);
}

/* ============================================================
   Misc Overrides
   ============================================================ */
.text-light {
    color: var(--text) !important;
}

.text-white {
    color: var(--text) !important;
}

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

.bg-black {
    background: var(--bg-input) !important;
}

.border-secondary {
    border-color: var(--border) !important;
}

/* Keep badge text white on colored backgrounds */
.badge.text-bg-success,
.badge.text-bg-danger,
.badge.text-bg-warning,
.badge.text-bg-info,
.badge.text-bg-primary,
.badge.text-bg-secondary {
    color: inherit;
}

/* Suggestion border accent */
.border-start.border-primary {
    border-color: var(--primary) !important;
}

/* ============================================================
   Scrollbar
   ============================================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: #c1c5cc;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0a5ae;
}

/* ============================================================
   Responsive
   ============================================================ */
/* ============================================================
   Mobile Full-Screen Menu
   ============================================================ */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    background: var(--bg-body);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-menu .nav-link {
    color: var(--text);
    padding: 12px 16px;
    font-size: 1.05rem;
    border-bottom: 1px solid var(--border);
}

.mobile-menu .nav-link:hover,
.mobile-menu .nav-link.active {
    background: var(--bg-sidebar);
    color: #fff;
}

.mobile-menu .nav-link i {
    width: 24px;
    text-align: center;
}

.mobile-menu .service-toggle {
    border-color: var(--border);
    color: var(--text);
}

.mobile-menu .service-toggle span {
    color: var(--text);
}

.mobile-menu .toggle-switch {
    background: #ccc;
}

.mobile-menu .toggle-switch.active {
    background: #198754;
}

.mobile-menu h6 {
    color: var(--text-muted) !important;
}

@media (min-width: 769px) {
    .mobile-menu {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
    }
}

/* Token Usage */
.token-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.summary-card { text-align: center; }
.summary-label { font-size: 0.85rem; color: #6b7280; text-transform: uppercase; letter-spacing: 1px; }
.summary-cost { font-size: 2rem; font-weight: 700; color: #1e3a5f; margin: 0.25rem 0; }
.summary-detail { font-size: 0.8rem; color: #9ca3af; }
.row-alert { background: #fef2f2 !important; }

/* Route Health */
.route-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.route-card { border-left: 4px solid #6b7280; }
.route-card.status-pass { border-left-color: #22c55e; }
.route-card.status-fail { border-left-color: #ef4444; }
.route-card .card-header { display: flex; justify-content: space-between; align-items: center; }
.route-count { font-size: 1.5rem; font-weight: 700; margin: 0.5rem 0; }
.route-meta { font-size: 0.8rem; color: #6b7280; margin-bottom: 0.75rem; }
.run-result { padding: 0.5rem 0; border-top: 1px solid #e5e7eb; font-size: 0.85rem; }
.run-result.run-pass strong { color: #22c55e; }
.run-result.run-fail strong { color: #ef4444; }
.run-result.run-none strong { color: #6b7280; }
.run-time { font-size: 0.75rem; color: #9ca3af; }
.fail-count { color: #ef4444; font-weight: 600; }
.detail-link { font-size: 0.8rem; }
.badge-mvc { background: #3b82f6; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 0.7rem; }
.badge-laravel { background: #ef4444; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 0.7rem; }
.badge-local { background: #6b7280; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 0.7rem; }
.badge-production { background: #f59e0b; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 0.7rem; }
.text-pass { color: #22c55e; }
.text-fail { color: #ef4444; font-weight: 600; }
.row-fail { background: #fef2f2; }
.row-pass { }
.detail-table th { text-align: right; padding-right: 1rem; white-space: nowrap; }

/* ============================================================
   Journal Module
   ============================================================ */
.journal-entry {
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.journal-entry:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.journal-timeline .card {
    border-radius: 6px;
}

/* Promise board kanban cards */
.journal-promise-card {
    transition: box-shadow 0.15s ease;
}
.journal-promise-card:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Weekly heatmap cells */
.journal-heatmap-cell {
    transition: transform 0.1s ease;
    cursor: pointer;
}
.journal-heatmap-cell:hover {
    transform: scale(1.05);
}

/* Mobile responsive adjustments */
@media (max-width: 575.98px) {
    .journal-timeline .card-body {
        padding: 0.5rem !important;
    }
    .journal-timeline .badge {
        font-size: 0.6rem !important;
    }
}

/* Agent Relay Portal */
.relay-pending {
    background: rgba(255, 193, 7, 0.04);
    border-radius: 0 6px 6px 0;
}
@keyframes relay-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}
.relay-pulse {
    animation: relay-pulse 1.8s ease-in-out infinite;
}

/* Relay question entries */
.relay-question {
    border-radius: 0 6px 6px 0;
}
