:root {
    --deep-teal: #0B4F4A;
    --mineral-green: #4FAF8F;
    --soft-sage: #DCEFE7;
    --warm-gold: #C9A227;
    --off-white: #F8FAF7;
    --charcoal: #263331;
}

body {
    background-color: var(--off-white);
    color: var(--charcoal);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.bg-teal { background-color: var(--deep-teal) !important; }
.bg-green { background-color: var(--mineral-green) !important; }
.bg-sage { background-color: var(--soft-sage) !important; }
.bg-gold { background-color: var(--warm-gold) !important; }
.bg-offwhite { background-color: var(--off-white) !important; }
.bg-charcoal { background-color: var(--charcoal) !important; }

.text-teal { color: var(--deep-teal) !important; }
.text-green { color: var(--mineral-green) !important; }
.text-gold { color: var(--warm-gold) !important; }
.text-charcoal { color: var(--charcoal) !important; }

.btn-teal {
    background-color: var(--deep-teal);
    color: #fff;
    border: none;
    padding: 10px 28px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-teal:hover {
    background-color: #093d39;
    color: #fff;
}

.btn-green {
    background-color: var(--mineral-green);
    color: #fff;
    border: none;
    padding: 10px 28px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-green:hover {
    background-color: #3e9c7f;
    color: #fff;
}

.btn-gold {
    background-color: var(--warm-gold);
    color: #fff;
    border: none;
    padding: 10px 28px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-gold:hover {
    background-color: #b18d20;
    color: #fff;
}

.btn-outline-teal {
    background-color: transparent;
    color: var(--deep-teal);
    border: 2px solid var(--deep-teal);
    padding: 8px 26px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-outline-teal:hover {
    background-color: var(--deep-teal);
    color: #fff;
}

.card-brand {
    border: none;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(11, 79, 74, 0.08);
    transition: box-shadow 0.2s;
}
.card-brand:hover {
    box-shadow: 0 4px 20px rgba(11, 79, 74, 0.15);
}

.navbar-brand-custom {
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--deep-teal);
    text-decoration: none;
}

.sidebar {
    background-color: var(--deep-teal);
    min-height: 100vh;
    color: #fff;
}
.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 4px;
    transition: all 0.2s;
}
.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.sidebar .nav-link.active {
    background-color: var(--mineral-green);
    color: #fff;
}

.stat-card {
    border: none;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(11, 79, 74, 0.08);
}
.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.hero-section {
    background: linear-gradient(135deg, var(--deep-teal) 0%, var(--mineral-green) 100%);
    color: #fff;
    padding: 80px 0;
}

.form-control:focus {
    border-color: var(--mineral-green);
    box-shadow: 0 0 0 0.2rem rgba(79, 175, 143, 0.25);
}

.alert-brand {
    border-radius: 10px;
    border: none;
}

.referral-box {
    background-color: var(--soft-sage);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--mineral-green);
}

.tree-node {
    display: inline-block;
    background: #fff;
    border: 2px solid var(--mineral-green);
    border-radius: 10px;
    padding: 12px 18px;
    text-align: center;
    min-width: 140px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.tree-node-inactive {
    border-color: #ccc;
    opacity: 0.6;
}

.footer-brand {
    background-color: var(--charcoal);
    color: rgba(255,255,255,0.7);
    padding: 40px 0 20px;
}
.footer-brand a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
}
.footer-brand a:hover {
    color: var(--mineral-green);
}

.table-brand thead th {
    background-color: var(--soft-sage);
    color: var(--deep-teal);
    border-bottom: 2px solid var(--mineral-green);
}

.badge-rounded {
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.8rem;
}

.copy-btn {
    cursor: pointer;
    transition: opacity 0.2s;
}
.copy-btn:hover {
    opacity: 0.8;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--deep-teal) 0%, var(--mineral-green) 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
    padding: 40px;
    max-width: 440px;
    width: 100%;
}

/* ===== Mobile sidebar toggle button (admin/member) ===== */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1060;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background-color: var(--deep-teal);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    font-size: 1.4rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
}

/* ===== Mobile responsive styles ===== */
@media (max-width: 767.98px) {
    /* Hero section: smaller heading and padding */
    .hero-section {
        padding: 40px 0;
    }
    .hero-section h1 {
        font-size: 1.75rem;
    }
    .hero-section .lead {
        font-size: 1rem;
    }

    /* Login card: reduce padding on small screens */
    .login-card {
        padding: 24px 20px;
        margin: 16px;
    }
    .login-wrapper {
        padding: 0 !important;
    }

    /* Stat cards: 2 per row on mobile instead of 1 */
    .row.g-3 > [class*="col-md-2"],
    .row.g-3 > [class*="col-md-3"] {
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* Stat icon slightly smaller on mobile */
    .stat-card .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    .stat-card .stat-icon i {
        font-size: 1.1rem;
    }

    /* Sidebar: slide-in drawer on mobile */
    .sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        bottom: 0;
        width: 260px;
        max-width: 80vw;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }
    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    /* Main content: full width on mobile */
    main.col-lg-10,
    main.col-md-9 {
        margin-left: 0 !important;
        max-width: 100%;
        flex: 0 0 100%;
    }

    /* Show the floating toggle button on mobile */
    .sidebar-toggle {
        display: flex;
    }

    /* Tree views: horizontal scroll */
    .tree-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 12px;
    }

    /* Tables: tighter padding on mobile */
    .table-sm th,
    .table-sm td {
        padding: 0.3rem 0.4rem;
        font-size: 0.85rem;
    }

    /* Cards: reduce padding on mobile */
    .card-brand.p-4 {
        padding: 1rem !important;
    }

    /* Footer: smaller padding */
    .footer-brand {
        padding: 24px 0 16px;
    }

    /* Navbar brand: slightly smaller */
    .navbar-brand-custom {
        font-size: 1.2rem;
    }

    /* Buttons: full width on mobile in hero */
    .hero-section .btn {
        display: block;
        width: 100%;
        margin-bottom: 8px;
    }
    .hero-section .d-flex.flex-wrap {
        flex-direction: column;
    }

    /* Page headings: smaller on mobile */
    h2.fw-bold {
        font-size: 1.3rem;
    }

    /* Dashboard header: stack title and badge */
    .d-flex.justify-content-between.align-items-center.mb-4 {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px;
    }
}

/* ── Cookie Consent Banner ──────────────────────────── */
.cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fff;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    padding: 16px 0;
    animation: slideUp 0.3s ease-out;
}
.cookie-consent-inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 16px;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
@media (max-width: 768px) {
    .cookie-consent-inner .d-flex {
        flex-direction: column !important;
        gap: 12px !important;
    }
    .cookie-consent-inner .d-flex > div:nth-child(2) {
        width: 100%;
    }
    .cookie-consent-inner .d-flex > div:last-child {
        width: 100%;
    }
    .cookie-consent-inner .btn {
        flex: 1;
    }
}

/* ===== Extra small phones (<= 375px) ===== */
@media (max-width: 375px) {
    .login-card {
        padding: 20px 16px;
        margin: 8px;
    }
    .hero-section h1 {
        font-size: 1.5rem;
    }
    .stat-card {
        padding: 0.6rem !important;
    }
    .stat-card h5, .stat-card h4 {
        font-size: 1rem;
    }
}

/* ===== Tablet tweaks (768px - 991px) ===== */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Sidebar slightly narrower on tablet */
    .sidebar {
        width: 200px;
    }
}
