/* ============================================================
   WatuLead - Main Stylesheet
   Supports Dark Mode / Light Mode
   ============================================================ */

/* ---- CSS Variables (Light Mode Default) ---- */
:root {
    --bs-body-bg: #f4f6f9;
    --bs-body-color: #212529;
    --sidebar-bg: #1D4354;
    --sidebar-color: #cbd5e1;
    --sidebar-active-bg: #009CDE;
    --sidebar-active-color: #ffffff;
    --sidebar-hover-bg: #2A6076;
    --sidebar-width: 260px;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --table-stripe: #f8fafc;
    --text-muted: #64748b;
    --input-bg: #ffffff;
    --input-border: #d1d5db;
    --topbar-bg: #ffffff;
    --topbar-shadow: 0 1px 3px rgba(0,0,0,.08);
    --stat-icon-bg: rgba(0,156,222,.1);
}

/* ---- Dark Mode Variables ---- */
[data-bs-theme="dark"] {
    --bs-body-bg: #0f172a;
    --bs-body-color: #e2e8f0;
    --sidebar-bg: #1a1f2e;
    --sidebar-color: #94a3b8;
    --sidebar-hover-bg: #252d3d;
    --card-bg: #1e293b;
    --card-border: #334155;
    --table-stripe: #1a2332;
    --text-muted: #94a3b8;
    --input-bg: #1e293b;
    --input-border: #475569;
    --topbar-bg: #1e293b;
    --topbar-shadow: 0 1px 3px rgba(0,0,0,.3);
    --stat-icon-bg: rgba(0,156,222,.2);
}

/* ---- Base ---- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

a { text-decoration: none; }

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

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand h5 {
    color: #fff;
    margin: 0;
    font-weight: 700;
    font-size: 1.1rem;
}

.sidebar-brand img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

.sidebar-nav {
    padding: 0.75rem 0;
    list-style: none;
    margin: 0;
}

.sidebar-nav .nav-header {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,.35);
}

.sidebar-nav .nav-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.5rem;
    color: var(--sidebar-color);
    font-size: 0.875rem;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-item a:hover {
    background: var(--sidebar-hover-bg);
    color: #fff;
}

.sidebar-nav .nav-item a.active {
    background: rgba(0,156,222,.15);
    color: var(--sidebar-active-color);
    border-left-color: var(--sidebar-active-bg);
    font-weight: 500;
}

.sidebar-nav .nav-item a .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    opacity: 0.8;
}

.sidebar-nav .nav-item a.active .nav-icon { opacity: 1; }

.sidebar-nav .badge {
    margin-left: auto;
    font-size: 0.7rem;
}

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ---- Top Bar ---- */
.topbar {
    background: var(--topbar-bg);
    box-shadow: var(--topbar-shadow);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1030;
    transition: background-color 0.3s ease;
}

.topbar .btn-sidebar-toggle {
    display: none;
    border: none;
    background: transparent;
    font-size: 1.25rem;
    color: var(--bs-body-color);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ---- Theme Toggle ---- */
.theme-toggle {
    background: none;
    border: 1px solid var(--input-border);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--bs-body-color);
}

.theme-toggle:hover {
    background: var(--card-bg);
    border-color: var(--sidebar-active-bg);
}

.theme-toggle .bi-sun-fill { display: none; }
.theme-toggle .bi-moon-fill { display: inline; }

[data-bs-theme="dark"] .theme-toggle .bi-sun-fill { display: inline; }
[data-bs-theme="dark"] .theme-toggle .bi-moon-fill { display: none; }

/* ---- Notification Bell ---- */
.notification-bell {
    position: relative;
}

.notification-bell .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 0.65rem;
}

/* ---- Content Area ---- */
.content-wrapper {
    padding: 1.5rem;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.breadcrumb {
    font-size: 0.85rem;
    margin: 0;
}

/* ---- Stats Cards ---- */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    transform: translateY(-1px);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.stat-card .stat-change {
    font-size: 0.75rem;
    font-weight: 500;
}

/* ---- Cards ---- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 0.75rem;
    transition: background-color 0.3s ease;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--card-border);
    padding: 1rem 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ---- Tables ---- */
.table {
    color: var(--bs-body-color);
}

.table thead th {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom-width: 1px;
    white-space: nowrap;
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: var(--table-stripe);
}

.table td {
    vertical-align: middle;
    font-size: 0.875rem;
}

/* ---- Forms ---- */
.form-control, .form-select {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--bs-body-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.form-control:focus, .form-select:focus {
    background-color: var(--input-bg);
    color: var(--bs-body-color);
    border-color: #009CDE;
    box-shadow: 0 0 0 0.2rem rgba(0,156,222,.15);
}

/* ---- Activity Feed ---- */
.activity-feed .activity-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--card-border);
}

.activity-feed .activity-item:last-child {
    border-bottom: none;
}

.activity-feed .activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.activity-feed .activity-text {
    font-size: 0.85rem;
}

.activity-feed .activity-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ---- Charts ---- */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* ---- Login Page ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1D4354 0%, #10303C 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--card-bg);
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    padding: 2.5rem;
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-card .login-logo h3 {
    color: #009CDE;
    font-weight: 700;
}

/* ---- Badges ---- */
.badge { font-weight: 500; font-size: 0.75rem; }

/* ---- Print Styles ---- */
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-wrapper { padding: 0 !important; }
    body { background: #fff !important; }
}

/* ---- Mobile Responsive ---- */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .topbar .btn-sidebar-toggle {
        display: block;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,.5);
        z-index: 1035;
        display: none;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 575.98px) {
    .content-wrapper { padding: 1rem; }
    .stat-card { padding: 1rem; }
    .page-header h1 { font-size: 1.25rem; }
}

/* ---- Member ID Card ---- */
.id-card {
    width: 340px;
    border: 2px solid #3b82f6;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
}

.id-card-header {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: #fff;
    padding: 1rem;
    text-align: center;
}

.id-card-body {
    padding: 1rem;
    display: flex;
    gap: 1rem;
}

.id-card-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #3b82f6;
    object-fit: cover;
}

.id-card-footer {
    background: #f1f5f9;
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 0.75rem;
    color: #64748b;
}

/* ---- Professional ID Card ---- */
.id-card-deck {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}
/* Standard ID/business-card size: 85.6mm x 54mm (CR80), fixed rectangle */
.id-card-pro {
    position: relative;
    width: 85.6mm;
    height: 54mm;
    max-width: 100%;
    border-radius: 3mm;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    border: 1px solid #e2e8f0;
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
}
/* Faint organization logo watermark */
.id-card-pro-watermark {
    position: absolute;
    inset: 0;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    opacity: .06;
    z-index: 0;
    pointer-events: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}
.id-card-pro-header,
.id-card-pro-body,
.id-card-pro-footer,
.id-card-back-body { position: relative; z-index: 1; }
.id-card-pro-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    color: #fff;
    padding: .3rem .55rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.id-card-pro-logo img {
    width: 26px; height: 26px;
    border-radius: 5px;
    background: #fff;
    padding: 1px;
    object-fit: contain;
}
.id-card-pro-org h5 { margin: 0; font-size: .66rem; font-weight: 700; line-height: 1.1; }
.id-card-pro-org small { opacity: .85; font-size: .45rem; text-transform: uppercase; letter-spacing: .08em; }
.id-card-pro-body { padding: .4rem .55rem; display: flex; gap: .6rem; align-items: flex-start; flex: 1; min-height: 0; }
.id-card-front .id-card-pro-qr { flex: 0 0 auto; text-align: center; }
.id-card-pro-right { flex: 1; min-width: 0; }
.id-card-front .id-card-pro-qr #qrcode svg { width: 54px; height: 54px; display: block; }
.id-card-front .id-card-pro-qr small { display: block; font-size: .38rem; line-height: 1; margin-top: 1px; color: #64748b; }
.id-card-pro-photo img,
.id-card-pro-photo-placeholder {
    width: 52px; height: 64px;
    border-radius: 5px;
    border: 1.5px solid #2563eb;
    object-fit: cover;
}
.id-card-pro-photo-placeholder {
    background: #e2e8f0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; color: #94a3b8;
}
.id-card-pro-name { font-size: .74rem; font-weight: 700; color: #1e293b; margin-bottom: .15rem; }
.id-card-pro-table { font-size: .55rem; width: 100%; line-height: 1.25; }
.id-card-pro-table td:first-child { color: #64748b; width: 56px; padding: 0; }
.id-card-pro-table td:last-child { font-weight: 600; color: #1e293b; }
.id-card-pro-table .badge { font-size: .48rem; padding: .12em .4em; }
.id-card-pro-footer {
    background: rgba(248,250,252,.85);
    padding: .25rem .55rem;
    display: flex; justify-content: space-between; align-items: flex-end;
    gap: .5rem;
}
.id-card-pro-signature { text-align: center; flex: 1; min-width: 0; }
.id-card-pro-signature img { height: 18px; max-width: 90%; object-fit: contain; }
.id-card-pro-sig-space { height: 18px; }
.id-card-pro-sig-line { width: 90%; max-width: 95px; border-top: 1px solid #333; margin: 1px auto 0; }
.id-card-pro-signature small { display: block; font-size: .46rem; line-height: 1.15; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.id-card-pro-qr { text-align: center; }

/* ---- ID Card: Back ---- */
.id-card-back-body {
    flex: 1;
    min-height: 0;
    padding: .45rem .6rem;
    display: flex;
    flex-direction: column;
    gap: .3rem;
}
.id-card-back-info {
    list-style: none; margin: 0; padding: 0;
    font-size: .54rem; color: #334155; line-height: 1.25;
}
.id-card-back-info li { display: flex; align-items: flex-start; gap: .35rem; padding: .1rem 0; }
.id-card-back-info li i { color: #2563eb; margin-top: 1px; flex: 0 0 auto; }
.id-card-back-sign { text-align: center; margin-top: auto; }
.id-card-back-sign img { height: 18px; max-width: 120px; object-fit: contain; }
.id-card-back-sign .id-card-pro-sig-line { width: 60%; max-width: 130px; margin: 1px auto 0; }
.id-card-back-sign small { display: block; font-size: .46rem; line-height: 1.15; color: #475569; }
.id-card-back-terms {
    font-size: .44rem; line-height: 1.3;
    color: #94a3b8; text-align: center;
    border-top: 1px dashed #cbd5e1;
    padding-top: .25rem;
}

@media print {
    .id-card-pro { box-shadow: none; border: 1px solid #1e3a5f; page-break-inside: avoid; }
    .id-card-deck { gap: 6mm; }
}

/* ---- Payment Method Cards ---- */
.payment-method-card { cursor: pointer; transition: all .2s; border: 2px solid transparent; }
.payment-method-card:hover { border-color: #009CDE; transform: translateY(-2px); }
.payment-method-card.selected { border-color: #009CDE; box-shadow: 0 4px 12px rgba(0,156,222,.25); }

/* ---- Filter Panel ---- */
.filter-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

/* ---- Invoice Print ---- */
.invoice-header { border-bottom: 2px solid #009CDE; padding-bottom: 1rem; }
.invoice-total { border-top: 2px solid #333; font-weight: 700; }

/* ============================================================
   WatuLead sign-in branding
   Used by public/login.php and portal/login.php. It lives here, not in a
   <style> block on the pages, because neither page has one — they load this
   stylesheet instead, and a rule added to the markup would never have applied.
   ============================================================ */
.brandmark {
    display: block;
    max-height: 96px;
    width: auto;
    margin: 0 auto .75rem;
}
.brandflag {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .35rem;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #6B7480;
}
.brandflag svg {
    width: 26px;
    height: 18px;
    border-radius: 3px;
    flex: none;
    box-shadow: 0 0 0 1px rgba(19, 30, 51, .18);
}

/* Global Leadership Network mark in the sidebar. Sits below the association's
   own logo, never merged with it. 46px clears GLN's 45px minimum and the
   margin is the clear-space buffer their guidelines require. */
.sidebar-gln {
    display: block; margin: .85rem auto 0; padding-top: .85rem;
    border-top: 1px solid rgba(255,255,255,.14); width: 100%; text-align: center;
}
.sidebar-gln img { height: 46px; width: auto; max-width: 100%; display: inline-block; }

/* GLN mark, placed by gln_logo_tag(). The chip carries the clear-space buffer
   their guidelines require and gives the white wordmark a ground to sit on. */
.gln-mark { display: inline-flex; align-items: center; }
.gln-mark--chip { background: #1D4354; border-radius: 12px; padding: .55rem .85rem; }
