/* MMT Data — Design System */

/* ===================== TOKENS ===================== */
:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --success-hover: #059669;
    --warning: #f59e0b;
    --warning-hover: #d97706;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --info: #06b6d4;
    --purple: #8b5cf6;

    --bg: #f8fafc;
    --bg-alt: #f1f5f9;
    --surface: #ffffff;
    --surface-hover: #f8fafc;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.04);

    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-pill: 100px;

    --transition: 0.2s ease;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    --navbar-h: 56px;
}

[data-bs-theme="dark"] {
    --bg: #0f172a;
    --bg-alt: #1e293b;
    --surface: #1e293b;
    --surface-hover: #334155;
    --border: #334155;
    --border-light: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --shadow-xs: 0 1px 2px rgba(0,0,0,.2);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,.3);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.4);
}

/* ===================== BASE ===================== */
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}
.page-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}
.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.page-title i { color: var(--primary); }

/* ===================== NAVBAR ===================== */
.top-navbar {
    height: var(--navbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: var(--shadow-xs);
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}
.nav-brand i { color: var(--primary); font-size: 1.3rem; }
.nav-brand:hover { color: var(--text); }

.nav-tabs-main {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 100%;
}
.nav-tabs-main .nav-tab { height: 100%; display: flex; align-items: center; }
.nav-tabs-main .nav-tab a {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 1rem;
    height: 100%;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
}
.nav-tabs-main .nav-tab a:hover { color: var(--text); background: var(--bg-alt); }
.nav-tabs-main .nav-tab.active a { color: var(--primary); border-bottom-color: var(--primary); }

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 1.1rem;
}
.btn-icon:hover { background: var(--bg-alt); color: var(--text); }
.nav-user { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }

/* ===================== CARDS ===================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-light);
    padding: 0.875rem 1.25rem;
    font-weight: 600;
    font-size: 0.875rem;
}
.card-body { padding: 1.25rem; }
.card-footer {
    background: transparent;
    border-top: 1px solid var(--border-light);
    padding: 0.75rem 1.25rem;
}

/* Metric cards */
.metric-card { text-align: center; padding: 1.25rem 1rem; }
.metric-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.metric-value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
.metric-sub { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Collector cards */
.collector-card { position: relative; overflow: hidden; }
.collector-card .card-body { padding: 1rem 1.25rem; }
.collector-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.5rem; display: flex; align-items: center; justify-content: space-between; }
.collector-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.5rem; }
.collector-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-pill);
}
.collector-status.running { background: rgba(16,185,129,.1); color: var(--success); }
.collector-status.completed { background: rgba(59,130,246,.1); color: var(--primary); }
.collector-status.idle { background: rgba(148,163,184,.1); color: var(--text-muted); }
.collector-status.failed { background: rgba(239,68,68,.1); color: var(--danger); }

/* ===================== BADGES ===================== */
.badge-status {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 600;
}
.badge-active { background: rgba(16,185,129,.1); color: #059669; }
.badge-partially_used { background: rgba(245,158,11,.1); color: #b45309; }
.badge-fully_used { background: rgba(148,163,184,.1); color: #64748b; }
.badge-expired { background: rgba(239,68,68,.1); color: #dc2626; }
.badge-invalid { background: rgba(239,68,68,.15); color: #dc2626; }
.badge-unchecked { background: rgba(148,163,184,.08); color: #94a3b8; }
.badge-mmt { background: #fce4ec; color: #c62828; }
.badge-goibibo { background: #fff3e0; color: #e65100; }

/* ===================== DB PILLS ===================== */
.db-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.db-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    background: var(--bg-alt);
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.db-pill strong { color: var(--text); }

/* ===================== TOKEN BAR ===================== */
.token-bar {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}
.token-bar.ok { background: rgba(16,185,129,.06); color: #059669; border: 1px solid rgba(16,185,129,.15); }
.token-bar.warn { background: rgba(245,158,11,.06); color: #b45309; border: 1px solid rgba(245,158,11,.15); }
.token-bar.danger { background: rgba(239,68,68,.06); color: #dc2626; border: 1px solid rgba(239,68,68,.15); }
.token-bar.info { background: rgba(59,130,246,.06); color: #2563eb; border: 1px solid rgba(59,130,246,.15); }

/* ===================== BUTTONS ===================== */
.btn { border-radius: var(--radius-sm); font-weight: 500; font-size: 0.85rem; transition: all var(--transition); }
.btn-xs { padding: 0.15rem 0.5rem; font-size: 0.7rem; }
.btn-ghost { background: transparent; border: none; color: var(--text-secondary); padding: 0.25rem 0.5rem; }
.btn-ghost:hover { color: var(--text); background: var(--bg-alt); }

/* ===================== TABLES ===================== */
.table { font-size: 0.85rem; color: var(--text); }
.table th {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 0.75rem;
    white-space: nowrap;
}
.table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.table-hover tbody tr:hover { background: var(--bg-alt); }
.table-sticky thead { position: sticky; top: 0; background: var(--surface); z-index: 1; }

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input { border-radius: var(--radius-sm); border: 1px solid var(--border); padding: 0.35rem 0.75rem; font-size: 0.85rem; }
.dataTables_wrapper .dataTables_length select { border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: 0.85rem; }
.dataTables_wrapper .dataTables_paginate .paginate_button { border-radius: var(--radius-sm) !important; }

/* ===================== FORMS ===================== */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.form-label { font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); }

/* ===================== DROP ZONE ===================== */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--primary); background: rgba(59,130,246,.04); color: var(--primary); }

/* ===================== LOG VIEWER ===================== */
.log-viewer {
    background: #0f172a;
    color: #a5f3fc;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.6;
    padding: 1rem;
    border-radius: var(--radius-md);
    overflow: auto;
    max-height: 400px;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ===================== ACTIVITY FEED ===================== */
.feed-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.82rem;
}
.feed-time { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.72rem; white-space: nowrap; min-width: 65px; }
.feed-badge { font-size: 0.65rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: var(--radius-pill); white-space: nowrap; }
.feed-msg { flex: 1; color: var(--text-secondary); }

/* ===================== API DOCS ===================== */
.endpoint-method {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-xs);
    text-transform: uppercase;
    display: inline-block;
}
.endpoint-method.get { background: rgba(16,185,129,.1); color: #059669; }
.endpoint-method.post { background: rgba(59,130,246,.1); color: #2563eb; }
.endpoint-url { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text); }
.code-block {
    background: #0f172a;
    color: #e2e8f0;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
}

/* ===================== EXPORT CARDS ===================== */
.export-card .card-body { padding: 1.5rem; }
.export-card .export-count { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin-bottom: 0.5rem; }
.export-card .export-label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 1rem; }

/* ===================== TOASTS ===================== */
.toast-container { z-index: 1090; }

/* ===================== ANIMATIONS ===================== */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.pulse { animation: pulse 2s ease-in-out infinite; }
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ===================== PROGRESS ===================== */
.progress-thin { height: 4px; border-radius: 2px; background: var(--bg-alt); }
.progress-thin .progress-bar { border-radius: 2px; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 767.98px) {
    .page-content { padding: 1rem; }
    .nav-tabs-main { display: none; }
    .nav-tabs-main.show {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: var(--navbar-h);
        left: 0; right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
        z-index: 1029;
    }
    .nav-tabs-main.show .nav-tab { height: auto; }
    .nav-tabs-main.show .nav-tab a { padding: 0.75rem 1.5rem; width: 100%; border-bottom: none; }
    .nav-hamburger { display: flex !important; }
    .metric-value { font-size: 1.25rem; }
}
@media (min-width: 768px) {
    .nav-hamburger { display: none !important; }
}

/* ===================== LOGIN ===================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
}
.login-brand { text-align: center; margin-bottom: 2rem; }
.login-brand i { font-size: 2rem; color: var(--primary); }
.login-brand h3 { font-weight: 700; margin-top: 0.5rem; }
