/* ===== ROOT VARIABLES ===== */
:root {
    --primary: #c0392b;
    --primary-dark: #96281b;
    --primary-light: #e74c3c;
    --secondary: #1a6b5c;
    --bg: #ffffff;
    --bg-alt: #f8f9fa;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6c757d;
    --border: #e8e8ec;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-hover: 0 6px 24px rgba(0,0,0,0.10);
    --success: #1a6b5c;
    --warning: #d68910;
    --danger: #c0392b;
    --info: #2471a3;
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

[data-theme="dark"] {
    --bg: #111118;
    --bg-alt: #18181f;
    --card-bg: #1e1e28;
    --text: #e8e8f0;
    --text-muted: #8a8a9a;
    --border: #2a2a38;
    --shadow: 0 2px 12px rgba(0,0,0,0.4);
    --shadow-hover: 0 6px 24px rgba(0,0,0,0.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Hind Siliguri', 'Noto Sans Bengali', sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s, color 0.3s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 15px;
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ===== NAVBAR ===== */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.logo svg { width: 22px; height: 22px; flex-shrink: 0; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
}

.nav-links a {
    padding: 6px 12px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.nav-links a:hover { color: var(--text); background: var(--bg-alt); }
.nav-links a.active { color: var(--primary); background: rgba(192,57,43,0.07); font-weight: 600; }

.btn-emergency-nav {
    background: var(--primary) !important;
    color: #fff !important;
    font-weight: 600 !important;
    padding: 6px 14px !important;
}

.btn-emergency-nav:hover {
    background: var(--primary-dark) !important;
    color: #fff !important;
}

.notif-badge {
    position: absolute;
    top: -3px; right: -3px;
    background: var(--primary);
    color: #fff;
    font-size: 0.6rem;
    border-radius: 50%;
    width: 16px; height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text);
    cursor: pointer;
    padding: 6px;
}

/* Explicit size mapping to make sure the SVG icon is visible on mobile */
.mobile-toggle svg {
    width: 24px;
    height: 24px;
    display: block;
}

.theme-toggle {
    background: var(--bg-alt);
    border-radius: 50px;
    width: 44px; height: 24px;
    position: relative;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: var(--transition);
    flex-shrink: 0;
}

.theme-toggle .knob {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--primary);
    position: absolute;
    top: 2px; left: 2px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

[data-theme="dark"] .theme-toggle .knob { left: 22px; }

/* ===== ALERTS ===== */
.alert-container {
    position: fixed;
    top: 70px; right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
    width: calc(100% - 32px);
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-hover);
    border: 1px solid transparent;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.alert-success { background: #eafaf1; color: #1a6b5c; border-color: #a9dfbf; }
.alert-danger { background: #fdedec; color: #c0392b; border-color: #f1948a; }
.alert-warning { background: #fef9e7; color: #d68910; border-color: #f8c471; }
.alert-info { background: #eaf2fb; color: #2471a3; border-color: #a9cce3; }
.alert-close { background: none; border: none; font-size: 1.1rem; cursor: pointer; opacity: 0.6; color: inherit; flex-shrink: 0; }

/* ===== LAYOUT ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.section { padding: 48px 0; }
main { flex: 1; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
    text-align: center;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

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

.btn-secondary { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.btn-secondary:hover { background: #145246; border-color: #145246; }

.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #96281b; }

.btn-ghost { background: var(--bg-alt); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--border); }

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ===== HERO ===== */
.hero {
    background: var(--primary);
    color: #fff;
    padding: 60px 20px;
    text-align: center;
}

.hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.hero p {
    font-size: 1.05rem;
    opacity: 0.88;
    max-width: 560px;
    margin: 0 auto 28px;
    line-height: 1.7;
}

.hero-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero .btn-outline { border-color: rgba(255,255,255,0.6); color: #fff; }
.hero .btn-outline:hover { background: rgba(255,255,255,0.15); }
.hero .btn-secondary { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.3); }
.hero .btn-secondary:hover { background: rgba(255,255,255,0.25); }

/* ===== STATS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 32px 0;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    text-align: center;
}

.stat-card .number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-card .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ===== SECTION TITLES ===== */
.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
    letter-spacing: -0.01em;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

/* ===== CARDS ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-hover); }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

/* ===== BLOOD REQUEST CARDS ===== */
.request-card { border-left: 4px solid var(--primary); }
.request-card.fulfilled { border-left-color: var(--secondary); opacity: 0.75; }

.request-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.blood-badge {
    background: var(--primary);
    color: #fff;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.request-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.request-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.status-tag {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.status-active { background: #fdecea; color: var(--primary); }
.status-fulfilled { background: #eafaf1; color: var(--secondary); }

/* ===== DONOR CARDS ===== */
.donor-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
}

.donor-card img {
    width: 50px; height: 50px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--border);
}

.donor-info h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 2px; }

.status-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--secondary);
    margin-right: 4px;
}

.status-dot.unavailable { background: var(--text-muted); }

/* ===== MAP ===== */
.map-container {
    height: 380px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-top: 12px;
}

.map-container-sm {
    height: 250px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-top: 8px;
}

.donor-marker, .track-marker { background: transparent; border: none; }

/* Fix Leaflet maps breaking due to global img { max-width:100% } rule */
.leaflet-container {
    width: 100%;
    height: 100%;
    background: var(--bg-alt);
    font-family: 'Hind Siliguri', sans-serif;
}
.leaflet-container img {
    max-width: none !important;
}
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
    position: absolute;
    left: 0;
    top: 0;
}
.leaflet-tile {
    width: 256px;
    height: 256px;
}
.leaflet-popup-content {
    margin: 10px 12px;
    font-family: 'Hind Siliguri', sans-serif;
}

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-bar select, .filter-bar input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.filter-bar select:focus, .filter-bar input:focus { border-color: var(--primary); }

/* ===== FORM ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 6px; color: var(--text); }

input[type="text"], input[type="tel"], input[type="email"], input[type="password"],
input[type="number"], textarea, select, .form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

input:focus, textarea:focus, select:focus, .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(192,57,43,0.08); }
textarea { resize: vertical; min-height: 90px; }

.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* ===== LEADERBOARD ===== */
.leaderboard-table { width: 100%; border-collapse: collapse; }
.leaderboard-table th, .leaderboard-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.leaderboard-table th { font-weight: 600; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.leaderboard-table tr:hover td { background: var(--bg-alt); }
.leaderboard-table tr:first-child td { font-weight: 700; }

.rank-badge {
    display: inline-flex;
    width: 28px; height: 28px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
}

.rank-1 { background: #fef9e7; color: #d4a017; border: 2px solid #f1c40f; }
.rank-2 { background: #f2f3f4; color: #808b96; border: 2px solid #aab7b8; }
.rank-3 { background: #fdf2e9; color: #c0571b; border: 2px solid #e59866; }
.rank-default { background: var(--bg-alt); color: var(--text-muted); border: 1px solid var(--border); }

/* ===== LEADERBOARD ROWS ===== */
.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    background: var(--card-bg);
    transition: var(--transition);
}
.leaderboard-row:hover { box-shadow: var(--shadow-hover); }
.leaderboard-row.rank-1 { background: #fef9e7; border-color: #f1c40f; }
.leaderboard-row.rank-2 { background: #f2f3f4; border-color: #aab7b8; }
.leaderboard-row.rank-3 { background: #fdf2e9; border-color: #e59866; }

.leaderboard-row .rank {
    flex-shrink: 0;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.leaderboard-row.rank-1 .rank { background: #f1c40f; color: #fff; }
.leaderboard-row.rank-2 .rank { background: #aab7b8; color: #fff; }
.leaderboard-row.rank-3 .rank { background: #e59866; color: #fff; }

.leaderboard-row img {
    width: 42px; height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.leaderboard-row .info {
    flex: 1;
    min-width: 0;
    font-size: 0.92rem;
}
.leaderboard-row .info strong {
    display: block;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-row .points {
    flex-shrink: 0;
    font-weight: 700;
    color: var(--primary);
    font-size: 0.95rem;
    white-space: nowrap;
}

/* ===== BADGES GRID ===== */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
}
.badge-card {
    text-align: center;
    padding: 14px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-alt);
}
.badge-card .icon { font-size: 1.8rem; margin-bottom: 6px; }
.badge-card .name { font-weight: 600; font-size: 0.85rem; margin-bottom: 2px; }
.badge-card .pts { font-size: 0.75rem; color: var(--text-muted); }

/* ===== PROFILE ===== */
.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.profile-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
}

.profile-info h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.profile-info p { font-size: 0.9rem; color: var(--text-muted); }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.35; }
.empty-state p { font-size: 0.95rem; }

/* ===== HELPERS SECTION ===== */
.helpers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.helper-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 16px;
    text-align: center;
    transition: var(--transition);
}

.helper-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }

.helper-card img {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 14px;
    border: 3px solid var(--border);
}

.helper-card h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; }
.helper-card p { font-size: 0.82rem; color: var(--text-muted); }

/* ===== LOCATION TRACKER ===== */
.location-map-wrapper {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
}

.location-status-bar {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    font-weight: 500;
}

.location-status-bar svg { width: 18px; height: 18px; color: var(--primary); flex-shrink: 0; }

.distance-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(192,57,43,0.08);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.88rem;
    font-weight: 600;
    margin-left: auto;
}

/* ===== HOSPITAL CARDS ===== */
.hospital-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    padding: 20px;
    transition: var(--transition);
}

.hospital-card:hover { box-shadow: var(--shadow-hover); }

.hospital-card h4 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.hospital-card h4 svg { width: 18px; height: 18px; color: var(--primary); flex-shrink: 0; }
.hospital-card .meta { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.hospital-card .meta svg { width: 14px; height: 14px; flex-shrink: 0; }
.hospital-type-badge { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 4px; margin-bottom: 10px; }
.hospital-type-badge.type-hospital { background: #eaf2fb; color: var(--info); }
.hospital-type-badge.type-ambulance { background: #fdf2e9; color: #c0571b; }

/* ===== ADMIN ===== */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; gap: 20px; }

.admin-sidebar .card {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: sticky;
    top: 76px;
}

.admin-sidebar a {
    padding: 9px 12px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-sidebar a:hover { color: var(--text); background: var(--bg-alt); }
.admin-sidebar a.active { color: var(--primary); background: rgba(192,57,43,0.08); font-weight: 600; }
.admin-sidebar a svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ===== FLEXBOX HELPERS ===== */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.page-btn { padding: 7px 13px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.88rem; font-weight: 600; background: var(--card-bg); color: var(--text); cursor: pointer; transition: var(--transition); }
.page-btn:hover, .page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== BADGE ===== */
.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

/* ===== FOOTER ===== */
footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 40px 0 24px;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 28px;
}

.footer-grid h4 {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-grid p, .footer-grid a {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: block;
    transition: var(--transition);
}

.footer-grid a:hover { color: var(--primary); }
.footer-logo { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 20px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ===== NOTIFICATIONS ===== */
.notif-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 5px; }
.notif-dot.read { background: var(--border); }
.notif-body h5 { font-size: 0.9rem; font-weight: 600; margin-bottom: 2px; }
.notif-body p { font-size: 0.83rem; color: var(--text-muted); }

/* ===== MOBILE RESPONSIVE MEDIA QUERIES ===== */
@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar .card { position: static; flex-direction: row; flex-wrap: wrap; }
}

@media (max-width: 700px) {
    .mobile-toggle { 
        display: flex !important; 
        align-items: center; 
        justify-content: center; 
        min-width: 40px; 
        min-height: 40px; 
        z-index: 1001; 
    }
    
    .nav-links { 
        display: none; 
        position: fixed; 
        top: 60px; 
        left: 0; 
        right: 0; 
        background: var(--card-bg); 
        border-bottom: 1px solid var(--border); 
        flex-direction: column; 
        padding: 10px; 
        gap: 2px; 
        max-height: calc(100vh - 60px); 
        overflow-y: auto; 
        z-index: 999; 
    }
    
    .nav-links.open { display: flex; }
    .nav-links a { width: 100%; }
    .hero h1 { font-size: 1.6rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .card-grid { grid-template-columns: 1fr; }
    .card-grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .helpers-grid { grid-template-columns: repeat(2, 1fr); }
    .container { padding: 0 14px; }
    .section { padding: 32px 0; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr; }
    .helpers-grid { grid-template-columns: repeat(2, 1fr); }
    .hero h1 { font-size: 1.35rem; }
}

/* ===== ADDITIONAL FIXES (auth, admin, profile, table, badges) ===== */

/* Auth pages (login, register, forgot password) */
.auth-card {
    max-width: 480px;
    margin: 40px auto;
}
.auth-card h2 { margin-bottom: 6px; }
.subtitle {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 18px;
}
.auth-footer {
    text-align: center;
    margin-top: 14px;
    font-size: 0.88rem;
    color: var(--text-muted);
}
.auth-footer a { color: var(--primary); font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

/* Form layout helpers */
.form-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.form-row .form-group,
.form-row .checkbox-group {
    flex: 1 1 200px;
    min-width: 0;
}
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
}

/* Admin content column (grid item needs min-width 0 to avoid overflow) */
.admin-content { min-width: 0; }

/* Badge pill status variants */
.badge-success { background: #eafaf1; color: var(--secondary); border-color: rgba(26,107,92,0.25); }
.badge-danger { background: #fdecea; color: var(--danger); border-color: rgba(192,57,43,0.25); }

/* Text color helpers */
.text-primary { color: var(--primary); }
.text-success { color: var(--secondary); }
.text-danger { color: var(--danger); }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 4px; }

/* Extra button variant */
.btn-success { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.btn-success:hover { background: #134f44; border-color: #134f44; }

/* Profile header avatar (profile-header img has no class) */
.profile-header img {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
    flex-shrink: 0;
}

/* Profile stats grid */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 18px 0;
    text-align: center;
}
.profile-stat {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 8px;
}
.profile-stat .val {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}
.profile-stat .lab {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Earned badge highlight on profile page */
.badge-card.earned {
    background: #fef9e7;
    border-color: #f1c40f;
}
.badge-card.earned .icon { filter: none; opacity: 1; }
.badge-card:not(.earned) {
    opacity: 0.45;
}

/* Generic table styling + responsive wrapper */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.table-wrap th, .table-wrap td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table-wrap th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-alt);
}
.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tr:hover td { background: var(--bg-alt); }

/* ===== MOBILE FIXES FOR NEW SECTIONS ===== */
@media (max-width: 700px) {
    .profile-stats { grid-template-columns: repeat(2, 1fr); }
    .form-row { flex-direction: column; gap: 0; }
    .auth-card { margin: 20px auto; }
}