/* =============================================
   BODY FIT – Gym Membership Tracker
   Dark Theme CSS
   ============================================= */

:root {
    --bg:        #0f1117;
    --surface:   #1a1d27;
    --surface2:  #22263a;
    --border:    #2e3250;
    --accent:    #e63946;
    --accent2:   #ff6b6b;
    --text:      #e8eaf6;
    --muted:     #7b82a8;
    --success:   #2ec27e;
    --warning:   #f6c90e;
    --danger:    #e63946;
    --info:      #4fc3f7;
    --blue:      #4361ee;
    --purple:    #7b2d8b;
    --teal:      #0d9488;
    --radius:    10px;
    --shadow:    0 4px 24px rgba(0,0,0,0.4);
    --nav-h:     64px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: 'Segoe UI', system-ui, sans-serif; font-size: 15px; line-height: 1.6; min-height: 100vh; }
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Navbar ── */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h);
    background: var(--surface); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: flex-start;
    padding: 0 1.5rem; z-index: 100; gap: 0;
    box-shadow: 0 2px 16px rgba(0,0,0,0.5);
}
.navbar-brand { display: flex; align-items: center; gap: 0.6rem; font-size: 1.25rem; color: var(--text); flex-shrink: 0; margin-right: 1.5rem; }
.navbar-brand i { color: var(--accent); font-size: 1.4rem; }
.navbar-brand strong { color: var(--accent); }
.navbar-links { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; flex: 1; }
.nav-logout-wrap { margin-left: auto; }
.nav-link { color: var(--muted); padding: 0.4rem 0.75rem; border-radius: 6px; font-size: 0.88rem; display: flex; align-items: center; gap: 0.4rem; transition: all .2s; }
.nav-link:hover { color: var(--text); background: var(--surface2); text-decoration: none; }
.nav-logout { margin-left: 0.5rem; color: var(--danger) !important; }
.nav-logout:hover { background: rgba(230,57,70,0.12) !important; }
.nav-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.25rem; cursor: pointer; }
.mobile-menu { display: none; position: fixed; top: var(--nav-h); left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 0.75rem 1rem; z-index: 99; flex-direction: column; gap: 0.25rem; }
.mobile-menu.open { display: flex; }
.mobile-menu a { color: var(--muted); padding: 0.5rem 0.75rem; border-radius: 6px; display: flex; align-items: center; gap: 0.5rem; }
.mobile-menu a:hover { color: var(--text); background: var(--surface2); text-decoration: none; }

/* ── Main Content ── */
.main-content { padding: 2rem 1.5rem; max-width: 1280px; margin: 0 auto; }
.main-content.with-nav { padding-top: calc(var(--nav-h) + 2rem); }

/* ── Page Header ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.75rem; flex-wrap: wrap; gap: 0.75rem; }
.page-header h2 { font-size: 1.5rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.page-header h2 i { color: var(--accent); }
.page-sub { color: var(--muted); font-size: 0.95rem; }
.page-header-right { display: flex; align-items: center; gap: 1rem; }

/* ── Cards ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.card-header h3 { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 0.4rem; }
.card-header h3 i { color: var(--accent); }
.card-link { font-size: 0.85rem; color: var(--accent2); }
.card-body { padding: 1.25rem; }
.form-card { max-width: 760px; }
.mb-4 { margin-bottom: 1.5rem; }

/* ── Stats Grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; display: flex; align-items: center; gap: 1rem; transition: transform .2s; }
.stat-card:hover { transform: translateY(-2px); }
.stat-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0; }
.stat-info { display: flex; flex-direction: column; }
.stat-number { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.stat-blue   .stat-icon { background: rgba(67,97,238,0.15); color: #4361ee; }
.stat-green  .stat-icon { background: rgba(46,194,126,0.15); color: var(--success); }
.stat-yellow .stat-icon { background: rgba(246,201,14,0.15); color: var(--warning); }
.stat-red    .stat-icon { background: rgba(230,57,70,0.15);  color: var(--danger); }
.stat-purple .stat-icon { background: rgba(123,45,139,0.15); color: #b060c0; }
.stat-teal   .stat-icon { background: rgba(13,148,136,0.15); color: var(--teal); }

/* ── Dashboard Grid ── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* ── Quick Actions ── */
.quick-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.75rem; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 1.1rem; border-radius: 7px; border: none; cursor: pointer; font-size: 0.9rem; font-weight: 500; transition: all .2s; text-decoration: none !important; }
.btn-primary  { background: var(--accent);   color: #fff; }
.btn-primary:hover  { background: #c1121f; }
.btn-success  { background: var(--success);  color: #fff; }
.btn-success:hover  { background: #25a06a; }
.btn-warning  { background: var(--warning);  color: #000; }
.btn-warning:hover  { background: #d4a800; }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-danger:hover   { background: #c1121f; }
.btn-secondary{ background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover{ background: var(--border); }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; margin-top: 0.5rem; }
.btn-info { background: var(--info); color: #000; }

/* ── Tables ── */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table thead tr { background: var(--surface2); }
.table th { padding: 0.75rem 1rem; text-align: left; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; text-align: left; }
.table td:last-child { text-align: right; }
.table th:last-child { text-align: right; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(255,255,255,0.02); }
.actions { display: flex; gap: 0.4rem; align-items: center; vertical-align: middle; }
.table-toolbar { margin-bottom: 1rem; }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1.1rem; }
.form-group label { font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.form-control { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 0.6rem 0.9rem; border-radius: 7px; font-size: 0.9rem; transition: border-color .2s; width: 100%; }
.form-control:focus { outline: none; border-color: var(--accent); }
.form-control option { background: var(--surface2); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.input-icon-right { position: relative; }
.input-icon-right .form-control { padding-right: 2.5rem; }
.toggle-password { position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%); cursor: pointer; color: var(--muted); }
.search-input { max-width: 300px; }

/* ── Alerts ── */
.alert { padding: 0.85rem 1.1rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: 0.9rem; display: flex; align-items: center; gap: 0.5rem; }
.alert-success { background: rgba(46,194,126,0.12); border: 1px solid rgba(46,194,126,0.3); color: var(--success); }
.alert-danger  { background: rgba(230,57,70,0.12);  border: 1px solid rgba(230,57,70,0.3);  color: var(--danger); }
.alert-warning { background: rgba(246,201,14,0.12); border: 1px solid rgba(246,201,14,0.3); color: var(--warning); }
.alert-info    { background: rgba(79,195,247,0.12); border: 1px solid rgba(79,195,247,0.3); color: var(--info); }

/* ── Badges ── */
.badge { display: inline-block; padding: 0.22em 0.65em; border-radius: 5px; font-size: 0.78rem; font-weight: 600; }
.badge-success { background: rgba(46,194,126,0.15); color: var(--success); }
.badge-danger  { background: rgba(230,57,70,0.15);  color: var(--danger); }
.badge-warning { background: rgba(246,201,14,0.15); color: var(--warning); }
.badge-info    { background: rgba(79,195,247,0.15); color: var(--info); }
.badge-secondary{background: rgba(123,130,168,0.15);color: var(--muted); }
.revenue-badge { background: rgba(46,194,126,0.12); border: 1px solid rgba(46,194,126,0.25); color: var(--success); padding: 0.4rem 0.9rem; border-radius: 20px; font-size: 0.9rem; font-weight: 600; }

/* ── Auth Layout ── */
.auth-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 30% 40%, rgba(230,57,70,0.08) 0%, transparent 60%), var(--bg); }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 2.5rem 2rem; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo i { font-size: 2.5rem; color: var(--accent); margin-bottom: 0.5rem; }
.auth-logo h1 { font-size: 1.75rem; letter-spacing: 2px; }
.auth-logo strong { color: var(--accent); }
.auth-logo p { color: var(--muted); font-size: 0.9rem; margin-top: 0.25rem; }
.auth-footer-text { text-align: center; margin-top: 1.25rem; color: var(--muted); font-size: 0.88rem; }

/* Role Toggle */
.role-toggle { display: flex; gap: 0.5rem; }
.role-btn { flex: 1; }
.role-btn input { display: none; }
.role-btn span { display: flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.55rem; border: 1px solid var(--border); border-radius: 7px; cursor: pointer; transition: all .2s; font-size: 0.9rem; color: var(--muted); }
.role-btn input:checked + span { border-color: var(--accent); background: rgba(230,57,70,0.1); color: var(--text); }

/* ── Plans Grid ── */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.25rem; }
.plan-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: transform .2s, box-shadow .2s; }
.plan-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.plan-header { background: linear-gradient(135deg, rgba(230,57,70,0.2), rgba(67,97,238,0.2)); padding: 1.25rem; display: flex; align-items: flex-start; justify-content: space-between; }
.plan-header h3 { font-size: 1.05rem; font-weight: 700; }
.plan-price { font-size: 1.2rem; font-weight: 800; color: var(--accent2); }
.plan-body { padding: 1rem 1.25rem; }
.plan-duration { color: var(--muted); font-size: 0.88rem; margin-bottom: 0.4rem; }
.plan-desc { font-size: 0.85rem; color: var(--muted); }
.plan-actions { padding: 0.75rem 1.25rem; border-top: 1px solid var(--border); display: flex; gap: 0.5rem; }

/* ── Plan Preview (assign membership) ── */
.plan-preview { background: rgba(67,97,238,0.08); border: 1px solid rgba(67,97,238,0.2); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.plan-preview h4 { font-size: 0.9rem; margin-bottom: 0.5rem; color: var(--info); }
.plan-preview p { font-size: 0.88rem; color: var(--muted); margin-bottom: 0.2rem; }

/* ── Membership Hero (member dashboard) ── */
.membership-hero { margin-bottom: 1.75rem; }
.membership-card { border-radius: 14px; padding: 1.75rem; }
.active-card { background: linear-gradient(135deg, #1a2448, #2d1b38); border: 1px solid rgba(230,57,70,0.3); }
.inactive-card { background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2.5rem; gap: 0.75rem; }
.inactive-card .card-null-icon { font-size: 3rem; color: var(--muted); }
.inactive-card h3 { color: var(--muted); }
.mc-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.25rem; }
.mc-gym { font-size: 0.8rem; letter-spacing: 2px; color: var(--accent2); font-weight: 600; }
.mc-plan { font-size: 1.5rem; font-weight: 800; margin-top: 0.2rem; }
.mc-icon { font-size: 2.5rem; color: rgba(255,255,255,0.1); }
.mc-details { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }
.mc-item { display: flex; flex-direction: column; gap: 0.15rem; }
.mc-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.mc-val { font-size: 0.95rem; font-weight: 600; }
.mc-warning { margin-top: 1rem; background: rgba(246,201,14,0.1); border: 1px solid rgba(246,201,14,0.25); border-radius: 7px; padding: 0.65rem 1rem; font-size: 0.85rem; color: var(--warning); display: flex; align-items: center; gap: 0.4rem; }

/* ── Info Grid (member membership page) ── */
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.info-item { display: flex; flex-direction: column; gap: 0.2rem; }
.info-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.info-val { font-size: 0.95rem; font-weight: 600; }

/* ── Modal ── */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 200; align-items: center; justify-content: center; }
.modal.open { display: flex; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.75rem; width: 100%; max-width: 440px; box-shadow: var(--shadow); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-header h3 { font-size: 1rem; display: flex; align-items: center; gap: 0.4rem; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 1.4rem; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }

/* ── Footer ── */
.footer { text-align: center; padding: 1.5rem; color: var(--muted); font-size: 0.82rem; border-top: 1px solid var(--border); margin-top: 3rem; }
.footer strong { color: var(--accent); }

/* ── Text Utilities ── */
.text-muted   { color: var(--muted) !important; }
.text-center  { text-align: center; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger  { color: var(--danger) !important; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .mc-details { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
    .navbar-links { display: none; }
    .nav-toggle { display: block; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .table { display: block; overflow-x: auto; }
    .auth-card { margin: 1rem; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .mc-details { grid-template-columns: 1fr 1fr; }
    .main-content { padding-left: 1rem; padding-right: 1rem; }
}
.table td.actions {
    vertical-align: middle;
    white-space: nowrap;
}
.table tbody tr td {
    vertical-align: middle !important;
}
/* ─── Add these to your existing CSS file ─────────────────────────────────── */

/* Section labels above stat grids */
.stats-section-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted, #6b7280);
    margin: 1.25rem 0 0.5rem 0;
}

/* Revenue grid - 3 columns */
.stats-grid-revenue {
    grid-template-columns: repeat(3, 1fr);
}

/* Indigo stat card (this year) */
.stat-card.stat-indigo {
    border-left: 4px solid #6366f1;
}
.stat-card.stat-indigo .stat-icon {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

/* Orange stat card (this month) */
.stat-card.stat-orange {
    border-left: 4px solid #f97316;
}
.stat-card.stat-orange .stat-icon {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
}

/* Growth badge under revenue numbers */
.stat-growth {
    display: block;
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
}

.stat-growth.growth-up {
    color: #22c55e;
}

.stat-growth.growth-down {
    color: #ef4444;
}

.stat-growth.growth-neutral {
    color: var(--text-muted, #6b7280);
    font-weight: 400;
}

.growth-sub {
    font-weight: 400;
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.8;
}

/* Scrollable card body for tables */
.card-body-scroll {
    max-height: 300px;
    overflow-y: auto;
    padding: 0 !important;
}

/* Sticky table header when scrolling */
.card-body-scroll .table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--card-header-bg, #1f2d1c);
}

/* Scrollbar styling */
.card-body-scroll::-webkit-scrollbar {
    width: 4px;
}
.card-body-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.card-body-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
.card-body-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Responsive: stack revenue cards on smaller screens */
@media (max-width: 768px) {
    .stats-grid-revenue {
        grid-template-columns: 1fr;
    }
}
/* Hide browser's native password reveal button */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none !important;
}

input[type="password"]::-webkit-textfield-decoration-container {
    display: none !important;
}
.btn-done {
    padding: 0.25rem 0.75rem;
    border-radius: 5px;
    background: rgba(46, 194, 126, 0.12);
    color: var(--success);
    border: 1px solid rgba(46, 194, 126, 0.3);
    font-size: 0.8rem;
    font-weight: 600;
}
.btn-done {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    border-radius: 5px;
    background: rgba(46, 194, 126, 0.12);
    color: var(--success);
    border: 1px solid rgba(46, 194, 126, 0.3);
    font-size: 0.8rem;
    font-weight: 600;
    vertical-align: middle;
}
/* ── Attendance Table Fix ── */
#membersTable {
    table-layout: fixed;
}

#membersTable th:nth-child(1),
#membersTable td:nth-child(1) {
    width: 50px;
    text-align: center;
}

#membersTable th:nth-child(2),
#membersTable td:nth-child(2) {
    width: 24%;
}

#membersTable th:nth-child(3),
#membersTable td:nth-child(3),
#membersTable th:nth-child(4),
#membersTable td:nth-child(4) {
    width: 22%;
    white-space: nowrap;
}

#membersTable th:nth-child(5),
#membersTable td:nth-child(5) {
    width: 110px;
    white-space: nowrap;
}

#membersTable th:nth-child(6),
#membersTable td:nth-child(6) {
    width: 100px;
    text-align: right;
    vertical-align: middle;
}

/* Fix: actions td uses flex but td ignores it — use inline-flex on the wrapper instead */
#membersTable td.actions {
    display: table-cell;   /* override the flex that was breaking it */
    text-align: right;
    vertical-align: middle;
    white-space: nowrap;
}