/**
 * IronPulse Gym & Fitness Center Design System
 * Modern Sleek Dark/High-Contrast Aesthetic
 */

:root {
    --bg-main: #0b0f19;
    --bg-card: #111827;
    --bg-card-hover: #1f2937;
    --bg-surface: #1e293b;
    --bg-input: #0f172a;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(234, 179, 8, 0.3);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Accent Palette */
    --accent-gold: #f59e0b;
    --accent-gold-hover: #d97706;
    --accent-gold-light: rgba(245, 158, 11, 0.15);
    
    --accent-cyan: #06b6d4;
    --accent-cyan-light: rgba(6, 182, 212, 0.15);
    
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.15);
    
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.15);
    
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.15);
    
    --info: #3b82f6;
    --info-light: rgba(59, 130, 246, 0.15);
    
    --whatsapp: #25d366;
    --whatsapp-hover: #20ba5a;
    --bkash: #e2136e;
    --bkash-hover: #c20f5c;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(245, 158, 11, 0.25);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent-gold);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-gold-hover);
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
    width: 270px;
    background: #0d1322;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 50;
    transition: var(--transition);
}

.brand-section {
    padding: 1.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: var(--shadow-glow);
    color: #000;
}

.brand-text h2 {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #fff;
    line-height: 1.2;
}

.brand-text span {
    font-size: 0.72rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-category {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    font-weight: 700;
    padding: 0.75rem 0.75rem 0.35rem 0.75rem;
    margin-top: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    color: #fff;
    background: var(--bg-surface);
}

.nav-link.active {
    color: #000;
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.nav-link .nav-icon {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
}

.sidebar-user {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--accent-gold);
    border: 1px solid var(--border-highlight);
}

.user-details h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
}

.user-details p {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* Main Content Area */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background: radial-gradient(circle at 80% 10%, rgba(245, 158, 11, 0.04) 0%, transparent 50%), var(--bg-main);
}

/* Topbar */
.app-topbar {
    height: 65px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(13, 19, 34, 0.8);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-search {
    position: relative;
    width: 350px;
}

.topbar-search input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 0.55rem 1rem 0.55rem 2.4rem;
    border-radius: 999px;
    color: #fff;
    font-size: 0.88rem;
    outline: none;
    transition: var(--transition);
}

.topbar-search input:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px var(--accent-gold-light);
}

.topbar-search .search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

/* Content Container */
.page-content {
    padding: 1.75rem;
    flex: 1;
}

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

.page-title h1 {
    font-size: 1.65rem;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.page-title p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

/* Card System */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* Stats / KPI Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.15);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.stat-card.gold::before { background: var(--accent-gold); }
.stat-card.cyan::before { background: var(--accent-cyan); }
.stat-card.green::before { background: var(--success); }
.stat-card.red::before { background: var(--danger); }
.stat-card.blue::before { background: var(--info); }

.stat-content h4 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-content .stat-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: #fff;
    margin-top: 0.35rem;
    line-height: 1.2;
}

.stat-content .stat-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card.gold .stat-icon { background: var(--accent-gold-light); color: var(--accent-gold); }
.stat-card.cyan .stat-icon { background: var(--accent-cyan-light); color: var(--accent-cyan); }
.stat-card.green .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card.red .stat-icon { background: var(--danger-light); color: var(--danger); }
.stat-card.blue .stat-icon { background: var(--info-light); color: var(--info); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #000;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #000;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.35);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-whatsapp {
    background: var(--whatsapp);
    color: #fff;
}

.btn-whatsapp:hover {
    background: var(--whatsapp-hover);
    color: #fff;
}

.btn-bkash {
    background: var(--bkash);
    color: #fff;
}

.btn-bkash:hover {
    background: var(--bkash-hover);
    color: #fff;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
}

.btn-lg {
    padding: 0.8rem 1.6rem;
    font-size: 1rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1;
}

.badge-success { background: var(--success-light); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-warning { background: var(--warning-light); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-danger { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-info { background: var(--info-light); color: var(--info); border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-muted { background: rgba(255, 255, 255, 0.05); color: var(--text-muted); border: 1px solid var(--border-color); }
.badge-bkash { background: rgba(226, 19, 110, 0.15); color: #f43f5e; border: 1px solid rgba(226, 19, 110, 0.3); }

/* Data Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

.table th {
    background: rgba(15, 23, 42, 0.7);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.8px;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: middle;
}

.table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
    color: #fff;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-control, .form-select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 0.65rem 0.95rem;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px var(--accent-gold-light);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    animation: modalPop 0.25s ease-out;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #fff;
}

.modal-body {
    padding: 1.5rem;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Flash alerts */
.alert {
    padding: 0.95rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-success { background: var(--success-light); border: 1px solid rgba(16, 185, 129, 0.3); color: #6ee7b7; }
.alert-error { background: var(--danger-light); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; }
.alert-warning { background: var(--warning-light); border: 1px solid rgba(245, 158, 11, 0.3); color: #fcd34d; }
.alert-info { background: var(--info-light); border: 1px solid rgba(59, 130, 246, 0.3); color: #93c5fd; }

/* QR / Barcode Card & Printable ID */
.member-id-card {
    width: 380px;
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 2px solid var(--border-highlight);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    color: #fff;
    position: relative;
    box-shadow: var(--shadow-card);
    margin: 0 auto;
}

.card-chip {
    width: 38px;
    height: 28px;
    background: linear-gradient(135deg, #eab308, #ca8a04);
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* Responsive Grid & Layout Utilities */
.grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.grid-1-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.full-span {
    grid-column: span 2;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.mobile-toggle-btn {
    display: none;
}

.mobile-sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    margin-left: auto;
    padding: 0 0.5rem;
}

.mobile-sidebar-close:hover {
    color: #fff;
}

.sidebar-backdrop {
    display: none;
}


/* ==========================================================================
   ADVANCED FULLY RESPONSIVE DESIGN SYSTEM (Mobile, Tablet, Desktop, Ultra-Wide)
   ========================================================================== */

/* Touch Scrollbar Styling for Mobile Tables */
.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 158, 11, 0.4) rgba(255, 255, 255, 0.04);
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 999px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(245, 158, 11, 0.35);
    border-radius: 999px;
    transition: var(--transition);
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gold);
}

/* Ensure Table Headers & Cells Never Break Illegibly */
.table th, .table td {
    white-space: nowrap;
}

/* Utility to allow deliberate multiline wrapping on specific columns */
.table td.wrap-cell, .table th.wrap-cell {
    white-space: normal;
    min-width: 160px;
}

/* Mobile Visibility Utilities */
.show-mobile-only {
    display: none !important;
}

/* Base Topbar Styles */
.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.topbar-page-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.mobile-toggle-btn:hover {
    background: var(--accent-gold-light);
    color: var(--accent-gold);
    border-color: var(--accent-gold);
}

.mobile-sidebar-close {
    display: none;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 1.4rem;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    cursor: pointer;
    line-height: 1;
    margin-left: auto;
    transition: var(--transition);
}

.mobile-sidebar-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* ==========================================================================
   Breakpoints: Desktops (1025px - 1200px)
   ========================================================================== */
@media (max-width: 1200px) {
    .app-sidebar {
        width: 250px;
    }
    .topbar-search {
        width: 260px;
    }
}

/* ==========================================================================
   Breakpoints: Tablets & Below (<= 992px)
   Drawer Navigation Mode Activated
   ========================================================================== */
@media (max-width: 992px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        height: 100dvh;
        z-index: 1001;
        box-shadow: none;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .app-sidebar.open {
        transform: translateX(0);
        box-shadow: 25px 0 50px rgba(0, 0, 0, 0.9);
    }

    .mobile-toggle-btn {
        display: inline-flex !important;
    }

    .mobile-sidebar-close {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .app-main {
        width: 100%;
        min-width: 0;
    }

    .grid-2-1,
    .grid-1-2 {
        grid-template-columns: 1fr;
    }

    .full-span {
        grid-column: span 1;
    }

    .app-content {
        padding: 1.25rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 1rem;
    }
}

/* ==========================================================================
   Breakpoints: Small Tablets & Large Phones (<= 768px)
   ========================================================================== */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }

    .show-mobile-only {
        display: inline-flex !important;
    }

    .app-topbar {
        padding: 0 0.85rem;
        height: 58px;
    }

    .topbar-actions {
        gap: 0.4rem;
    }

    .topbar-page-title {
        max-width: 150px;
        font-size: 0.92rem;
    }

    .app-content {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-card {
        padding: 0.95rem;
    }

    .stat-content h4 {
        font-size: 0.7rem;
    }

    .stat-content .stat-value {
        font-size: 1.3rem;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    /* Page Header Flex on Mobile */
    .page-header,
    div[style*="justify-content:space-between"][style*="flex-wrap:wrap"] {
        gap: 0.75rem !important;
    }

    /* Collapse multi-column grids in forms */
    .form-grid,
    div[style*="grid-template-columns:repeat(auto-fit"] {
        grid-template-columns: 1fr !important;
    }

    /* Form Actions & Save/Cancel Button Bars */
    form div[style*="display:flex"][style*="justify-content:space-between"] {
        flex-direction: column-reverse !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }

    form div[style*="display:flex"][style*="justify-content:space-between"] > div {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
    }

    form div[style*="display:flex"][style*="justify-content:space-between"] .btn {
        width: 100% !important;
        justify-content: center !important;
    }

    .card {
        padding: 1.25rem !important;
        border-radius: var(--radius-md) !important;
    }

    .modal {
        width: 95%;
        max-width: 95vw;
        margin: 0.75rem;
    }

    .modal-body {
        padding: 1rem;
        max-height: 75vh;
    }

    .member-id-card {
        width: 100%;
        max-width: 340px;
    }

    #printable-invoice {
        padding: 1rem !important;
    }

    .profile-user-block,
    .profile-meta-block {
        width: 100%;
    }

    .profile-meta-block {
        justify-content: space-between;
        border-top: 1px solid var(--border-color);
        padding-top: 0.75rem;
        margin-top: 0.5rem;
    }

    .profile-meta-block > div {
        text-align: left !important;
    }
}

/* ==========================================================================
   Breakpoints: Standard Mobile Phones (<= 480px)
   ========================================================================== */
@media (max-width: 480px) {
    .app-topbar {
        padding: 0 0.65rem;
        height: 54px;
    }

    .topbar-page-title {
        display: none !important;
    }

    .app-content {
        padding: 0.75rem 0.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 1rem !important;
    }

    .btn {
        padding: 0.45rem 0.8rem;
        font-size: 0.82rem;
    }

    .btn-lg {
        padding: 0.65rem 1.15rem;
        font-size: 0.92rem;
    }

    .form-control, .form-select, select.form-control, input.form-control, textarea.form-control {
        font-size: 16px !important; /* Prevents auto-zoom on iOS Safari */
        padding: 0.6rem 0.75rem !important;
    }

    /* Notification dropdown overlay on small screens */
    #topbar-notification-menu {
        position: fixed !important;
        top: 56px !important;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        max-width: calc(100vw - 16px) !important;
        box-shadow: 0 20px 45px rgba(0, 0, 0, 0.9) !important;
    }

    /* Member badges & cards */
    .member-id-card {
        width: 100%;
        padding: 1.1rem;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    body {
        background: #fff !important;
        color: #000 !important;
    }
    .app-sidebar, .app-topbar, .btn, .no-print, .sidebar-backdrop, .mobile-toggle-btn {
        display: none !important;
    }
    .app-main {
        background: #fff !important;
        width: 100% !important;
    }
    .card {
        border: none !important;
        box-shadow: none !important;
        background: #fff !important;
        color: #000 !important;
    }
    .print-receipt-80mm {
        width: 80mm !important;
        margin: 0 auto !important;
        font-family: monospace !important;
        font-size: 12px !important;
        color: #000 !important;
    }
}

/* User Profile Section in Sidebar */
.sidebar-user .logout-btn { 
    background: transparent; 
    border: none; 
    padding: 4px; 
    cursor: pointer; 
    color: #64748b; 
    font-size: 1.35rem; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: all 0.2s ease; 
    outline: none; 
}
.sidebar-user .logout-btn:hover { 
    color: #ef4444 !important; 
    transform: scale(1.15); 
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.5)); 
}

.topbar-logout-btn:hover { 
    background: #ef4444 !important; 
    border-color: #ef4444 !important; 
    color: #fff !important; 
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4); 
}
.topbar-logout-btn:hover i { 
    color: #fff !important; 
}
