/* ═══════════════════════════════════════════════
   SmartCred — Design System CSS
   Colors: Navy #1C3A5F | Green #2C5E4F | Blue #4C87C7
           White #FFFFFF | Soft Gray #EEF1F4 | Slate #59636F
   Font: Lato
   ═══════════════════════════════════════════════ */

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

:root {
    --navy: #1C3A5F;
    --green: #2C5E4F;
    --blue: #4C87C7;
    --white: #FFFFFF;
    --gray: #EEF1F4;
    --slate: #59636F;
    --red: #C0392B;
    --orange: #E67E22;
    --radius: 14px;
    --radius-sm: 12px;
    --shadow: 0 1px 3px rgba(28,58,95,.08), 0 1px 2px rgba(28,58,95,.06);
    --shadow-md: 0 4px 12px rgba(28,58,95,.1);
    --sidebar-width: 260px;
    --font: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html { font-size: 16px; }
body {
    font-family: var(--font);
    color: var(--slate);
    background: var(--gray);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Typography --- */
h1, h2, h3, h4 { color: var(--navy); font-weight: 800; line-height: 1.25; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }

label {
    display: block;
    font-weight: 800;
    color: var(--navy);
    margin-bottom: 4px;
    font-size: 0.875rem;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-weight: 800;
    font-size: 0.9375rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--green);
    color: var(--white);
    border-color: var(--green);
}
.btn-primary:hover { filter: brightness(.95); }

.btn-secondary {
    background: transparent;
    color: var(--navy);
    border-color: rgba(28,58,95,.18);
}
.btn-secondary:hover { background: rgba(28,58,95,.04); }

.btn-danger {
    background: var(--red);
    color: var(--white);
    border-color: var(--red);
}
.btn-danger:hover { filter: brightness(.95); }

.btn-full { width: 100%; }

/* --- Form Inputs --- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(28,58,95,.18);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9375rem;
    color: var(--slate);
    background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: rgba(76,135,199,.9);
    box-shadow: 0 0 0 3px rgba(76,135,199,.35);
}

.form-group { margin-bottom: 16px; }
.form-hint { display: block; font-size: 0.8125rem; color: var(--slate); margin-top: 4px; }
.form-row { display: flex; gap: 12px; }
.form-row-2col > * { flex: 1; }
.form-row-between { justify-content: space-between; align-items: center; margin-bottom: 16px; }

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
    font-size: 0.875rem;
    color: var(--slate);
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] { width: auto; }

.link-small { font-size: 0.875rem; }

/* --- Cards --- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray);
}
.card-body { padding: 20px; }
.card-title { font-size: 1rem; margin: 0; }

/* --- Alerts --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9375rem;
    border-left: 4px solid;
}
.alert-success {
    background: rgba(44,94,79,.06);
    border-left-color: var(--green);
    color: var(--green);
}
.alert-warning {
    background: rgba(230,126,34,.06);
    border-left-color: var(--orange);
    color: #8B5E1A;
}
.alert-error {
    background: rgba(192,57,43,.06);
    border-left-color: var(--red);
    color: var(--red);
}

/* --- Tables --- */
.table-container {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}
thead th {
    background: var(--gray);
    color: var(--navy);
    font-weight: 800;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 12px 16px;
    text-align: left;
}
tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray);
    font-size: 0.9375rem;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(238,241,244,.5); }

/* ═══════════════════════════════════════════════
   AUTH PAGES (Login, Register, Forgot, Reset)
   ═══════════════════════════════════════════════ */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--gray);
}
.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}
.auth-branding {
    text-align: center;
    margin-bottom: 24px;
}
.auth-logo-primary .logo-text {
    font-size: 1.375rem;
    font-weight: 900;
    color: var(--navy);
    display: block;
}
.auth-logo-secondary {
    margin-top: 6px;
}
.auth-logo-secondary .powered-by {
    font-size: 0.8125rem;
    color: var(--slate);
}
.auth-logo-secondary .smartcred-brand {
    font-size: 0.875rem;
    font-weight: 800;
    color: var(--green);
}
.auth-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 32px;
}
.auth-title {
    text-align: center;
    margin-bottom: 8px;
}
.auth-subtitle {
    text-align: center;
    color: var(--slate);
    font-size: 0.9375rem;
    margin-bottom: 20px;
}
.auth-form { margin-top: 20px; }
.auth-form .btn { margin-top: 8px; }
.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9375rem;
    color: var(--slate);
}

/* ═══════════════════════════════════════════════
   APP LAYOUT (Sidebar + Content)
   ═══════════════════════════════════════════════ */
.app-body {
    display: flex;
    min-height: 100vh;
    background: var(--gray);
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--white);
    border-right: 1px solid rgba(28,58,95,.08);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.25s ease;
}
.sidebar-top {
    padding: 20px;
    border-bottom: 1px solid var(--gray);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-top .logo-text {
    font-size: 1rem;
    font-weight: 900;
    color: var(--navy);
    line-height: 1.3;
}
.sidebar-close {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--slate);
    cursor: pointer;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}
.nav-section-label {
    padding: 16px 20px 4px;
    font-size: 0.6875rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--slate);
    opacity: 0.7;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--slate);
    font-size: 0.9375rem;
    font-weight: 400;
    transition: all 0.12s;
    text-decoration: none;
}
.nav-item:hover {
    background: var(--gray);
    color: var(--navy);
    text-decoration: none;
}
.nav-item.active {
    background: rgba(44,94,79,.06);
    color: var(--green);
    font-weight: 700;
    border-right: 3px solid var(--green);
}
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item-logout { margin-top: 8px; }

.sidebar-bottom {
    padding: 16px 20px;
    border-top: 1px solid var(--gray);
    text-align: center;
}
.sidebar-bottom .powered-by {
    font-size: 0.75rem;
    color: var(--slate);
}
.sidebar-bottom .smartcred-brand {
    font-size: 0.8125rem;
    font-weight: 800;
    color: var(--green);
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}
.top-bar {
    display: flex;
    align-items: center;
    padding: 16px 28px;
    background: var(--white);
    border-bottom: 1px solid var(--gray);
    position: sticky;
    top: 0;
    z-index: 50;
}
.page-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0;
    flex: 1;
}
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--navy);
    margin-right: 12px;
}
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-name { font-size: 0.875rem; font-weight: 700; color: var(--navy); }
.user-role-badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(44,94,79,.08);
    color: var(--green);
}

.content-area {
    padding: 24px 28px;
    max-width: 1200px;
}

/* --- Dashboard --- */
.dashboard-grid { display: flex; flex-direction: column; gap: 20px; }
.dashboard-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.metric-card .card-body {
    display: flex;
    align-items: center;
    gap: 16px;
}
.metric-icon { color: var(--green); }
.metric-number { display: block; font-size: 1.75rem; font-weight: 900; color: var(--navy); }
.metric-label { display: block; font-size: 0.8125rem; color: var(--slate); }
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* --- Sidebar Overlay (mobile) --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.3);
    z-index: 90;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */
@media (max-width: 920px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-close { display: block; }
    .sidebar-overlay.open { display: block; }
    .hamburger { display: block; }
    .main-content { margin-left: 0; }
    .dashboard-cards { grid-template-columns: repeat(2, 1fr); }
}

/* --- Tabs --- */
.tabs {
    display: flex;
    gap: 0;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.tabs-scrollable {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.tab {
    padding: 10px 16px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--slate);
    white-space: nowrap;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: all 0.12s;
}
.tab:hover { color: var(--navy); background: var(--gray); text-decoration: none; }
.tab.active { color: var(--green); border-bottom-color: var(--green); background: rgba(44,94,79,.04); }

/* --- Status Badges --- */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
}
.status-active, .status-edit { background: rgba(44,94,79,.08); color: var(--green); }
.status-inactive { background: rgba(89,99,111,.08); color: var(--slate); }
.status-suspended { background: rgba(192,57,43,.08); color: var(--red); }
.status-pending, .status-draft { background: rgba(230,126,34,.08); color: #8B5E1A; }
.status-view { background: rgba(76,135,199,.08); color: var(--blue); }
.status-submitted { background: rgba(76,135,199,.08); color: var(--blue); }
.status-in_review { background: rgba(230,126,34,.08); color: #8B5E1A; }
.status-verification { background: rgba(155,89,182,.08); color: #6C3483; }
.status-committee_review { background: rgba(52,73,94,.08); color: #2C3E50; }
.status-approved { background: rgba(44,94,79,.08); color: var(--green); }
.status-denied { background: rgba(192,57,43,.08); color: var(--red); }
.status-withdrawn { background: rgba(89,99,111,.08); color: var(--slate); }
.status-not_paid { background: rgba(192,57,43,.08); color: var(--red); }

/* --- Timeline --- */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--gray); }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker { position: absolute; left: -24px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--green); border: 2px solid var(--white); box-shadow: 0 0 0 2px var(--gray); }
.timeline-content { padding-left: 4px; }

/* --- Filter Bars --- */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }

/* --- Child Row Cards (provider tabs) --- */
.child-row-card {
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--gray);
    border-radius: var(--radius-sm);
    background: var(--white);
}
.child-row-card:last-child { margin-bottom: 0; }
.child-row-add {
    border-style: dashed;
    border-color: rgba(44,94,79,.25);
    background: rgba(44,94,79,.02);
}

@media (max-width: 560px) {
    .dashboard-cards { grid-template-columns: 1fr; }
    .form-row-2col { flex-direction: column; gap: 0; }
    .content-area { padding: 16px; }
    .top-bar { padding: 12px 16px; }
    .auth-card { padding: 24px 20px; }
    .quick-actions { flex-direction: column; }
    .quick-actions .btn { width: 100%; }
}
