/* ================================================================
   BlueworthVerify — Base Design System v2
   Shared by ALL layouts. Import order: base → layout-specific
   ================================================================ */

/* — Google Fonts — */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ── Reset ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
}

img,
svg {
    display: block;
    max-width: 100%;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ── Light Mode Tokens ── */
:root {
    /* ── Branding ── */
    --bwv-brand: #1560BD; /* Denim Blue */
    --bwv-brand-dark: #0E4B9B;
    --bwv-brand-light: #3B7FD5;
    --bwv-brand-50: rgba(21, 96, 189, 0.05);
    --bwv-brand-100: rgba(21, 96, 189, 0.1);
    --bwv-brand-200: rgba(21, 96, 189, 0.2);

    --bwv-accent: #FF6600; /* Orange */
    --bwv-accent-dark: #E65C00;
    --bwv-accent-light: #FF8533;
    --bwv-accent-50: rgba(255, 102, 0, 0.05);

    /* Semantic */
    --success: #10B981;
    --success-bg: #ECFDF5;
    --success-border: #A7F3D0;
    --warning: #F59E0B;
    --warning-bg: #FFFBEB;
    --warning-border: #FDE68A;
    --danger: #EF4444;
    --danger-bg: #FEF2F2;
    --danger-border: #FECACA;
    --info: #3B82F6;
    --info-bg: #EFF6FF;
    --info-border: #BFDBFE;

    /* Surface */
    --bg: #F8FAFC;
    --bg-2: #F1F5F9;
    --surface: #FFFFFF;
    --surface-2: #F8FAFC;
    --surface-3: #F1F5F9;

    /* Border */
    --border: #E2E8F0;
    --border-2: #CBD5E1;

    /* Text */
    --text: #0F172A;
    --text-2: #1E293B;
    --text-muted: #64748B;
    --text-light: #94A3B8;
    --text-xlight: #CBD5E1;

    /* Radius */
    --r-sm: 6px;
    --r: 10px;
    --r-md: 14px;
    --r-lg: 18px;
    --r-xl: 24px;
    --r-2xl: 32px;
    --r-full: 9999px;

    /* Shadow */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);

    /* Animation */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --dur-fast: 150ms;
    --dur: 200ms;
    --dur-slow: 300ms;

    /* Sidebar widths */
    --sidebar-w: 260px;
    --admin-sidebar-w: 248px;
}

/* ── Dark Mode Tokens ── */
[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0F172A;
    --bg-2: #1E293B;
    --surface: #1E293B;
    --surface-2: #293548;
    --surface-3: #334155;
    --border: #334155;
    --border-2: #475569;
    --text: #F1F5F9;
    --text-2: #E2E8F0;
    --text-muted: #94A3B8;
    --text-light: #64748B;
    --text-xlight: #475569;
    --bwv-brand-50: rgba(21, 96, 189, 0.15);
    --bwv-brand-100: rgba(21, 96, 189, 0.25);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

/* Ensure selects and inputs always show correct text color in dark mode */
[data-theme="dark"] .form-control,
[data-theme="dark"] select,
[data-theme="dark"] input,
[data-theme="dark"] textarea {
    color: var(--text);
    background: var(--surface);
    border-color: var(--border);
}

[data-theme="dark"] select option {
    background: var(--surface-2);
    color: var(--text);
}


/* ── Typography ── */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
    letter-spacing: -0.02em;
}

/* ── ─── Shared Component Classes ─── ── */

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: box-shadow var(--dur) var(--ease);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.card-body {
    padding: 20px;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* ── Tables ── */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 12px 16px;
    font-size: 13.5px;
    color: var(--text-2);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tbody tr {
    transition: background var(--dur-fast);
}

.table tbody tr:hover td {
    background: var(--surface-2);
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: var(--r-full);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.badge-success {
    background: var(--success-bg);
    color: #065F46;
    border: 1px solid var(--success-border);
}

.badge-warning {
    background: var(--warning-bg);
    color: #92400E;
    border: 1px solid var(--warning-border);
}

.badge-danger {
    background: var(--danger-bg);
    color: #991B1B;
    border: 1px solid var(--danger-border);
}

.badge-info {
    background: var(--info-bg);
    color: var(--bwv-brand);
    border: 1px solid var(--info-border);
}

.badge-secondary {
    background: var(--surface-3);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.badge-brand {
    background: var(--bwv-brand-50);
    color: var(--bwv-brand);
    border: 1px solid var(--bwv-brand-100);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--r);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--dur) var(--ease);
    white-space: nowrap;
    line-height: 1;
    text-decoration: none !important;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-brand {
    background: var(--bwv-brand);
    color: white;
    box-shadow: 0 1px 3px rgba(21, 96, 189, 0.3), 0 0 0 0 rgba(21, 96, 189, 0);
}

.btn-brand:hover {
    background: var(--bwv-brand-dark);
    box-shadow: 0 4px 12px rgba(21, 96, 189, 0.35);
    transform: translateY(-1px);
    color: white;
}

.btn-brand:active {
    transform: translateY(0);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
    color: white;
    transform: translateY(-1px);
}

.btn-accent {
    background: var(--bwv-accent);
    color: white;
    box-shadow: 0 1px 3px rgba(255, 102, 0, 0.3);
}

.btn-accent:hover {
    background: var(--bwv-accent-dark);
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.35);
    transform: translateY(-1px);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-muted);
}

.btn-outline:hover {
    border-color: var(--bwv-brand);
    color: var(--bwv-brand);
    background: var(--bwv-brand-50);
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-muted);
}

.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text);
}

.btn-sm {
    padding: 6px 13px;
    font-size: 12px;
    border-radius: var(--r-sm);
}

.btn-lg {
    padding: 13px 28px;
    font-size: 15px;
    border-radius: var(--r-md);
}

.btn-xl {
    padding: 16px 36px;
    font-size: 16px;
    border-radius: var(--r-lg);
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
}

.btn-icon.btn-sm {
    width: 30px;
    height: 30px;
    padding: 5px;
}

/* ── Forms ── */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 7px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: all var(--dur) var(--ease);
    line-height: 1.5;
}

.form-control::placeholder {
    color: var(--text-light);
}

.form-control:hover {
    border-color: var(--border-2);
}

.form-control:focus {
    border-color: var(--bwv-brand);
    box-shadow: 0 0 0 3px rgba(21, 96, 189, 0.12);
    background: var(--surface);
}

.form-control.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

select.form-control {
    appearance: none;
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 90px;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .input-addon {
    display: flex;
    align-items: center;
    padding: 0 14px;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.input-group .input-addon:first-child {
    border-right: none;
    border-radius: var(--r) 0 0 var(--r);
}

.input-group .input-addon:last-child {
    border-left: none;
    border-radius: 0 var(--r) var(--r) 0;
}

.input-group .form-control:not(:first-child) {
    border-radius: 0 var(--r) var(--r) 0;
}

.input-group .form-control:not(:last-child) {
    border-radius: var(--r) 0 0 var(--r);
}

.form-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 5px;
    line-height: 1.5;
}

.invalid-feedback {
    font-size: 12px;
    color: var(--danger);
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Alert / Flash ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--r);
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    color: #065F46;
    border-color: var(--success-border);
}

.alert-danger {
    background: var(--danger-bg);
    color: #991B1B;
    border-color: var(--danger-border);
}

.alert-warning {
    background: var(--warning-bg);
    color: #7C2D12;
    border-color: var(--warning-border);
}

.alert-info {
    background: var(--info-bg);
    color: #1E3A8A;
    border-color: var(--info-border);
}

/* ── Stat cards ── */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px;
    transition: all var(--dur) var(--ease);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--r);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.stat-card-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 5px;
}

.stat-card-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
    line-height: 1;
}

.stat-card-delta {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
    margin-top: 8px;
}

.stat-card-delta.up {
    color: var(--success);
}

.stat-card-delta.down {
    color: var(--danger);
}

/* ── Pagination ── */
.pagination {
    display: flex;
    gap: 3px;
    list-style: none;
    align-items: center;
}

.pagination .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface);
    transition: all var(--dur-fast);
    text-decoration: none;
}

.pagination .page-item.active .page-link {
    background: var(--bwv-brand);
    border-color: var(--bwv-brand);
    color: white;
}

.pagination .page-item.disabled .page-link {
    opacity: 0.4;
    cursor: default;
}

.pagination .page-link:hover:not(.disabled) {
    border-color: var(--bwv-brand);
    color: var(--bwv-brand);
    background: var(--bwv-brand-50);
}

/* ── Grid helpers ── */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* ── Transitions for dark mode ── */
body,
.card,
.sidebar,
.topbar,
input,
select,
textarea,
.btn,
.stat-card {
    transition: background var(--dur-slow) var(--ease), border-color var(--dur-slow) var(--ease), color var(--dur-slow) var(--ease);
}

/* ── Utilities ── */
.text-brand {
    color: var(--bwv-brand);
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.fw-500 {
    font-weight: 500;
}

.fw-600 {
    font-weight: 600;
}

.fw-700 {
    font-weight: 700;
}

.fw-800 {
    font-weight: 800;
}

.mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9em;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 900px) {

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr !important;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 500px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}