/* ============================================================
   VTS LeadOS — Main Stylesheet
   Bootstrap 5 base + custom overrides
   ============================================================ */

:root {
    --los-primary:   #6C5CE7;
    --los-primary-d: #5a4ed1;
    --los-accent:    #00B894;
    --los-danger:    #E17055;
    --los-warning:   #FDCB6E;
    --los-sidebar-w: 240px;
    --los-sidebar-bg:#1a1a2e;
    --los-sidebar-hover: rgba(108,92,231,0.15);
    --los-header-h:  60px;
    --los-bg:        #f4f5f9;
    --los-card:      #ffffff;
    --los-text:      #2d3436;
    --los-muted:     #636e72;
    --los-border:    #e2e8f0;
    --los-radius:    10px;
    --los-shadow:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --los-shadow-md: 0 4px 12px rgba(0,0,0,0.1);
}

/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--los-bg);
    color: var(--los-text);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

/* ── Auth pages ───────────────────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 24px;
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo .brand-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--los-primary);
    letter-spacing: -0.5px;
}

.auth-logo .brand-sub {
    font-size: 12px;
    color: var(--los-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ── App Layout (authenticated) ──────────────────────── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar {
    width: var(--los-sidebar-w);
    background: var(--los-sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-logo .brand {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.3px;
}

.sidebar-logo .brand span {
    color: var(--los-primary);
}

.sidebar-logo .version-badge {
    font-size: 10px;
    background: var(--los-primary);
    color: #fff;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 12px 20px 6px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 0;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link i {
    width: 18px;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
    background: var(--los-sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: var(--los-sidebar-hover);
    color: #fff;
    border-left-color: var(--los-primary);
}

.sidebar-nav .nav-link .badge-count {
    margin-left: auto;
    background: var(--los-primary);
    color: #fff;
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 10px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.sidebar-footer .company-name {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer .logout-link {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    transition: color 0.15s;
}

.sidebar-footer .logout-link:hover { color: var(--los-danger); }

/* ── Main Content ─────────────────────────────────────── */
.main-content {
    margin-left: var(--los-sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Top Header ───────────────────────────────────────── */
.top-header {
    height: var(--los-header-h);
    background: var(--los-card);
    border-bottom: 1px solid var(--los-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 500;
}

.page-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--los-text);
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--los-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* ── Page Body ────────────────────────────────────────── */
.page-body {
    padding: 24px;
    flex: 1;
}

/* ── Cards ────────────────────────────────────────────── */
.los-card {
    background: var(--los-card);
    border-radius: var(--los-radius);
    border: 1px solid var(--los-border);
    box-shadow: var(--los-shadow);
}

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

.los-card-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: var(--los-text);
}

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

/* ── Stat Cards ───────────────────────────────────────── */
.stat-card {
    background: var(--los-card);
    border-radius: var(--los-radius);
    border: 1px solid var(--los-border);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--los-shadow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.purple { background: rgba(108,92,231,0.12); color: var(--los-primary); }
.stat-icon.green  { background: rgba(0,184,148,0.12);  color: var(--los-accent); }
.stat-icon.orange { background: rgba(225,112,85,0.12); color: var(--los-danger); }
.stat-icon.blue   { background: rgba(9,132,227,0.12);  color: #0984e3; }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    color: var(--los-text);
}

.stat-label {
    font-size: 12px;
    color: var(--los-muted);
    margin-top: 2px;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn-los {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
}

.btn-los:active { transform: scale(0.98); }

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

.btn-los-outline {
    background: transparent;
    border: 1px solid var(--los-border);
    color: var(--los-text);
}
.btn-los-outline:hover { background: var(--los-bg); }

.btn-los-danger {
    background: var(--los-danger);
    color: #fff;
}
.btn-los-danger:hover { background: #c0392b; color: #fff; }

.btn-los-sm { padding: 5px 10px; font-size: 12px; }

/* ── Tables ───────────────────────────────────────────── */
.los-table {
    width: 100%;
    border-collapse: collapse;
}

.los-table th {
    background: var(--los-bg);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--los-muted);
    padding: 10px 16px;
    border-bottom: 1px solid var(--los-border);
    text-align: left;
    white-space: nowrap;
}

.los-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--los-border);
    vertical-align: middle;
    font-size: 13.5px;
}

.los-table tr:last-child td { border-bottom: none; }
.los-table tr:hover td { background: rgba(108,92,231,0.03); }

/* ── Status Badges ────────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.6;
}

.badge-new       { background: rgba(9,132,227,0.1);  color: #0984e3; }
.badge-read      { background: rgba(108,92,231,0.1); color: var(--los-primary); }
.badge-contacted { background: rgba(253,203,110,0.2);color: #e17055; }
.badge-qualified { background: rgba(0,184,148,0.1);  color: var(--los-accent); }
.badge-lost      { background: rgba(99,110,114,0.1); color: var(--los-muted); }

/* ── Forms ────────────────────────────────────────────── */
.los-form-group { margin-bottom: 18px; }

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

.los-input {
    width: 100%;
    padding: 9px 14px;
    border: 1.5px solid var(--los-border);
    border-radius: 8px;
    font-size: 13.5px;
    color: var(--los-text);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.los-input:focus {
    border-color: var(--los-primary);
    box-shadow: 0 0 0 3px rgba(108,92,231,0.12);
}

.los-input.is-invalid { border-color: var(--los-danger); }

/* ── Alert / Flash ────────────────────────────────────── */
.los-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13.5px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.los-alert-success { background: rgba(0,184,148,0.1); color: #00845e; border: 1px solid rgba(0,184,148,0.25); }
.los-alert-danger  { background: rgba(225,112,85,0.1); color: #c0392b; border: 1px solid rgba(225,112,85,0.25); }
.los-alert-info    { background: rgba(108,92,231,0.1); color: var(--los-primary); border: 1px solid rgba(108,92,231,0.25); }

/* ── Empty state ──────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--los-muted);
}

.empty-state i { font-size: 48px; opacity: 0.3; display: block; margin-bottom: 16px; }
.empty-state h5 { color: var(--los-text); margin-bottom: 8px; }
.empty-state p  { font-size: 13.5px; }

/* ── API key display ──────────────────────────────────── */
.api-key-display {
    background: var(--los-bg);
    border: 1px solid var(--los-border);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.api-key-value { flex: 1; word-break: break-all; }

/* ── Pagination ───────────────────────────────────────── */
.los-pagination {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    padding: 16px 0;
}

.los-pagination a,
.los-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 13px;
    text-decoration: none;
    color: var(--los-text);
    border: 1px solid var(--los-border);
    transition: background 0.15s;
}

.los-pagination a:hover  { background: var(--los-bg); }
.los-pagination .active  { background: var(--los-primary); color: #fff; border-color: var(--los-primary); }
.los-pagination .disabled{ opacity: 0.4; pointer-events: none; }

/* ── Topbar hamburger (mobile) ────────────────────────── */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--los-text);
    cursor: pointer;
    padding: 4px;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: flex;
    }
    .page-body {
        padding: 16px;
    }
    .stat-card {
        padding: 14px;
    }
}

/* ── Utility ──────────────────────────────────────────── */
.text-muted    { color: var(--los-muted) !important; }
.text-primary  { color: var(--los-primary) !important; }
.fw-600        { font-weight: 600; }
.gap-2         { gap: 8px; }
.border-radius-8 { border-radius: 8px; }
.cursor-pointer  { cursor: pointer; }
