:root { --bg: #0a0a0a; --card-bg: #141414; --card-light: #1f1f1f; --text: #ffffff; --text-muted: #a1a1aa; --accent: #ef4444; --accent-rgb: 239, 68, 68; --border: #27272a; --green: #22c55e; }
body { margin: 0; font-family: 'Inter', sans-serif; background-color: var(--bg); color: var(--text); overflow: hidden; }
.accent { color: var(--accent); } .accent-bg { background: var(--accent); } .accent-icon { color: var(--accent); filter: drop-shadow(0 0 5px rgba(var(--accent-rgb), 0.5)); }

#auth-wrapper { height: 100vh; display: flex; justify-content: center; align-items: center; background: radial-gradient(circle at center, #2c0b0e, #000); }
.auth-card { background: var(--card-bg); padding: 40px; border-radius: 24px; text-align: center; border: 1px solid var(--border); width: 320px; box-shadow: 0 20px 40px rgba(0,0,0,0.4); }
.gym-logo { font-size: 3.5rem; color: var(--accent); margin-bottom: 15px; }
.btn-login { background: var(--accent); color: white; border: none; padding: 14px; border-radius: 30px; width: 100%; font-weight: 700; margin-top: 25px; cursor: pointer; transition: 0.2s; } .btn-login:hover { filter: brightness(1.1); }

#app-wrapper { display: flex; flex-direction: column; height: 100vh; }
#main-content { flex: 1; padding: 25px; overflow-y: auto; }

/* GRID */
.layout-grid { display: grid; grid-template-columns: 320px 1fr; gap: 20px; margin-bottom: 20px; }
.header-row { height: 80px; } .body-row { height: 660px; } 
.stats-container { display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 320px); gap: 20px; }

.grid-item { background: var(--card-bg); border-radius: 16px; border: 1px solid var(--border); padding: 20px; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.header-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 0 25px; display: flex; align-items: center; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.brand-card { gap: 15px; } .brand-card i { font-size: 1.8rem; } .brand-card h2 { margin: 0; font-size: 1.1rem; font-weight: 800; }
.menu-card { justify-content: space-between; } .time-section { display: flex; flex-direction: column; } .clock-text { font-size: 1.5rem; font-weight: 800; } .time-section small { color: #666; font-size: 0.7rem; }
.nav-links { display: flex; gap: 30px; align-items: center; } .nav-item { cursor: pointer; color: var(--text-muted); font-weight: 600; font-size: 0.9rem; transition: 0.2s; } .nav-item:hover, .nav-item.active { color: #fff; } .nav-icon { font-size: 1.2rem; cursor: pointer; color: var(--text-muted); }

.hero-card { padding: 0; border: none; height: 660px; } .hero-bg { width: 100%; height: 100%; object-fit: cover; filter: grayscale(80%) contrast(1.1) brightness(0.6); }
.hero-overlay { position: absolute; inset: 0; padding: 25px; display: flex; flex-direction: column; background: linear-gradient(135deg, rgba(0,0,0,0.8) 0%, rgba(var(--accent-rgb), 0.2) 100%); }
.theme-selector-container { display: flex; align-items: center; gap: 10px; margin-bottom: auto; background: rgba(0,0,0,0.6); padding: 8px 12px; border-radius: 20px; align-self: flex-start; backdrop-filter: blur(5px); border: 1px solid rgba(255,255,255,0.1); }
.theme-btn { width: 18px; height: 18px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; } .theme-btn.active { border-color: white; transform: scale(1.2); }
.theme-red { background: #ef4444; } .theme-blue { background: #3b82f6; } .theme-green { background: #22c55e; } .theme-orange { background: #f97316; }
.hero-stats-blocks { display: flex; flex-direction: column; gap: 15px; } .hero-block { background: rgba(255,255,255,0.05); padding: 15px; border-radius: 16px; display: flex; align-items: center; gap: 15px; border: 1px solid rgba(255,255,255,0.1); } .hero-block i { font-size: 1.8rem; } .hero-block h3 { margin: 0; font-size: 1.4rem; font-weight: 800; } .hero-block small { color: #ccc; font-size: 0.7rem; text-transform: uppercase; font-weight: 600; }

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; font-weight: 700; font-size: 0.95rem; } .card-header.compact { margin-bottom: 10px; }
.plan-list { display: flex; flex-direction: column; justify-content: space-around; flex: 1; gap: 6px; } 
.plan-row { display: flex; align-items: center; justify-content: space-between; background: var(--card-light); padding: 10px 15px; border-radius: 12px; border: 1px solid var(--border); }
.plan-left { display: flex; align-items: center; gap: 15px; }
.donut-svg-wrapper { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.plan-name { font-weight: 700; font-size: 0.85rem; color: var(--text); line-height: 1.2; }
.stat-stack { display: flex; flex-direction: column; gap: 5px; }
.stat-pill { background: #111; border: 1px solid var(--border); border-radius: 20px; padding: 3px 0; width: 70px; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: white; }
.chart-wrapper.compact { flex: 1; position: relative; min-height: 0; } .chart-wrapper-sm { flex: 1; position: relative; }
.legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 4px 0 10px; } .dot.white { background: #fff; }
.toggle-pill { background: var(--card-light); border-radius: 8px; padding: 3px; display: flex; border: 1px solid var(--border); }
.toggle-btn { background: transparent; border: none; color: var(--text-muted); padding: 6px 12px; font-size: 0.7rem; font-weight: 600; cursor: pointer; border-radius: 6px; flex: 1; } .toggle-btn.active { background: var(--accent); color: white; }
.table-header { display: grid; grid-template-columns: 2fr 1fr 2fr; padding-bottom: 8px; border-bottom: 1px solid var(--border); font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.dash-scroll-area { overflow-y: auto; flex: 1; padding-right: 5px; }
.dash-row { display: grid; grid-template-columns: 2fr 1fr 2fr; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: center; font-size: 0.85rem; font-weight: 500; }
.progress-track { background: var(--card-light); height: 6px; border-radius: 3px; overflow: hidden; flex: 1; border: 1px solid var(--border); } .progress-bar { height: 100%; background: var(--accent); } .progress-pct { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); width: 30px; text-align: right; }

.member-charts-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 25px; }
.chart-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 15px; } .chart-card h4 { margin: 0 0 10px 0; font-size: 0.9rem; } .chart-box { height: 150px; position: relative; }

/* MEMBER LIST STYLING */
.member-list-header { display: grid; grid-template-columns: 60px 1.5fr 1fr 1fr 1.5fr; padding: 10px 15px; background: var(--card-light); border-radius: 12px 12px 0 0; font-weight: 700; font-size: 0.8rem; color: var(--text-muted); border: 1px solid var(--border); margin-bottom: 5px; }
.detailed-list { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.member-row { display: grid; grid-template-columns: 60px 1.5fr 1fr 1fr 1.5fr; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 15px; align-items: center; transition: 0.2s; position: relative; } 
.member-row:hover { border-color: var(--accent); background: rgba(255,255,255,0.02); }
.profile-circle { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); cursor: pointer; transition: transform 0.2s; } .profile-circle:hover { transform: scale(1.5); z-index: 10; border-color: var(--accent); }
.info-block { display: flex; flex-direction: column; } 
.name-phone-row { display: flex; align-items: center; gap: 8px; }
.info-main { font-weight: 600; font-size: 0.9rem; } .info-sub { font-size: 0.7rem; color: #888; }
.member-id-tag { font-size: 0.65rem; background: #333; padding: 2px 6px; border-radius: 4px; color: #ccc; margin-bottom: 2px; width: fit-content; }
.status-badge { padding: 4px 8px; border-radius: 6px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; width: fit-content; }
.status-paid { background: rgba(34, 197, 94, 0.15); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.3); } .status-due { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); } .status-pending { background: rgba(249, 115, 22, 0.15); color: #f97316; border: 1px solid rgba(249, 115, 22, 0.3); }
.row-actions { display: flex; gap: 8px; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--card-light); display: flex; align-items: center; justify-content: center; color: #888; cursor: pointer; transition: 0.2s; } .icon-btn:hover { background: #fff; color: #000; } .icon-btn.whatsapp:hover { background: #25D366; color: white; border-color: #25D366; } .icon-btn.delete:hover { background: #ef4444; color: white; border-color: #ef4444; } .icon-btn.bill:hover { background: #3b82f6; color: white; border-color: #3b82f6; } 
.icon-btn.history:hover { background: #eab308; color: white; border-color: #eab308; }

.history-panel { grid-column: 1 / -1; background: #000; border: 1px solid var(--border); border-radius: 8px; margin-top: 10px; padding: 10px; display: none; }
.history-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.history-table th { text-align: left; color: #888; padding: 5px; border-bottom: 1px solid #333; }
.history-table td { padding: 8px 5px; color: #fff; border-bottom: 1px solid #222; }

.mobile-kebab-btn { display: none; font-size: 1.2rem; color: var(--text-muted); cursor: pointer; padding: 10px; position: absolute; right: 10px; top: 10px; }

.section-top { display: flex; justify-content: space-between; margin-bottom: 25px; align-items: center; }
.search-box { background: var(--card-bg); padding: 12px; border-radius: 12px; border: 1px solid var(--border); display: flex; gap: 10px; margin-bottom: 25px; } .search-box input { background: transparent; border: none; color: white; width: 100%; outline: none; }
.member-card { background: var(--card-bg); padding: 20px; border-radius: 16px; border: 1px solid var(--border); position: relative; }
.finance-summary-bar { background: var(--card-light); padding: 15px; border-radius: 12px; margin-bottom: 20px; border: 1px solid var(--border); text-align: right; font-weight: 600; }
.btn-sm { background: var(--accent); color: white; border: none; padding: 8px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 0.85rem; width: auto; display: inline-flex; align-items: center; gap: 6px; } .btn-sm:hover { filter: brightness(1.1); box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.3); }
.btn-save { background: var(--accent); color: white; border: none; padding: 14px; border-radius: 12px; font-weight: 700; cursor: pointer; width: 100%; margin-top: 10px; font-size: 1rem; } .btn-save:hover { filter: brightness(1.1); box-shadow: 0 0 15px rgba(var(--accent-rgb), 0.3); }
.profile-upload-container { display: flex; flex-direction: column; align-items: center; margin-bottom: 15px; } .profile-upload-container img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 2px dashed var(--border); cursor: pointer; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.9); display: none; justify-content: center; align-items: center; z-index: 100; backdrop-filter: blur(5px); }
.modal-box { background: var(--card-bg); width: 90%; max-width: 450px; border-radius: 20px; border: 1px solid var(--border); padding: 30px; }
.modal-head { display: flex; justify-content: space-between; margin-bottom: 25px; } .close { cursor: pointer; font-size: 1.2rem; color: #888; }
input, select { width: 100%; background: var(--bg); border: 1px solid var(--border); padding: 14px; border-radius: 10px; color: var(--text); margin-bottom: 15px; box-sizing: border-box; }
.split-inputs { display: flex; gap: 15px; } .split-inputs > * { flex: 1; }

/* OVERVIEW GRID */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 25px; }
.stat-card { background: var(--card-light); border: 1px solid var(--border); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; transition: transform 0.2s ease; }
.stat-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.stat-icon-circle { width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; font-size: 1.2rem; }
.icon-blue { background: #e0f2fe; color: #0284c7; } .icon-green { background: #dcfce7; color: #16a34a; } .icon-red { background: #fee2e2; color: #dc2626; } .icon-orange { background: #ffedd5; color: #ea580c; } .icon-purple { background: #f3e8ff; color: #9333ea; } .icon-teal { background: #ccfbf1; color: #0d9488; }
.stat-number { font-size: 1.6rem; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }

/* THEME TOGGLE */
.theme-switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.theme-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #1f1f1f; transition: .4s; border: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 5px; }
.slider.round { border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 2px; background-color: white; transition: .4s; border-radius: 50%; z-index: 2; }
input:checked + .slider:before { transform: translateX(22px); }
.icon-sun { font-size: 12px; color: #f59e0b; z-index: 1; } .icon-moon { font-size: 12px; color: #a1a1aa; z-index: 1; }

/* MOBILE */
.bottom-nav { display: none; }
@media (max-width: 1024px) {
    .layout-grid { display: flex; flex-direction: column; height: auto; gap: 25px; }
    .header-row { height: auto; } .menu-card { flex-direction: column; align-items: flex-start; gap: 20px; padding: 20px; }
    .hero-card { height: 380px; } 
    .stats-container, .member-charts-container { display: flex; flex-direction: column; height: auto; }
    .grid-item { height: 300px; }
    .member-list-header { display: none; }
    .member-row { display: flex; flex-direction: column; align-items: flex-start; gap: 15px; padding-top: 40px; position: relative; }
    .mobile-kebab-btn { display: block; }
    .row-actions { display: none; width: 100%; justify-content: space-between; background: var(--card-light); padding: 10px; border-radius: 8px; margin-top: 5px; }
    .row-actions.show { display: flex; }
    .icon-btn.history, .history-panel { display: none !important; }
    
    .nav-links { display: none !important; }
    .bottom-nav { display: flex; justify-content: space-around; align-items: center; position: fixed; bottom: 0; left: 0; width: 100%; background: #000; border-top: 1px solid var(--border); padding: 12px 0; z-index: 1000; padding-bottom: env(safe-area-inset-bottom); }
    .nav-btn { display: flex; flex-direction: column; align-items: center; color: #666; font-size: 0.65rem; font-weight: 600; cursor: pointer; transition: 0.3s; }
    .nav-btn i { font-size: 1.3rem; margin-bottom: 4px; }
    .nav-btn.active { color: var(--accent); } .nav-btn.active i { transform: translateY(-2px); }
    .brand-card { justify-content: center; border: none; background: transparent; box-shadow: none; }
    .menu-card { width: 100%; justify-content: center; flex-direction: row; padding: 10px; }
    .grid-item, .hero-card { height: auto; min-height: 250px; }
    #main-content { padding-bottom: 90px; }
}

/* LIGHT MODE FIXES */
body.light-mode { --bg: #f3f4f6; --card-bg: #ffffff; --card-light: #f9fafb; --text: #111827; --text-muted: #6b7280; --border: #e5e7eb; }
body.light-mode .btn-save, body.light-mode .btn-sm, body.light-mode .btn-login, body.light-mode .stat-pill, body.light-mode .nav-btn.active { color: #fff !important; }
body.light-mode .grid-item, body.light-mode .header-card, body.light-mode .stat-card { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); }
body.light-mode .plan-name, body.light-mode .stat-number, body.light-mode .clock-text, body.light-mode .info-main, body.light-mode h2, body.light-mode h3, body.light-mode h4 { color: #000000 !important; }
body.light-mode input, body.light-mode select { color: #000000 !important; background: #ffffff !important; border-color: #ccc !important; }
body.light-mode .hero-overlay h3, body.light-mode .hero-overlay small, body.light-mode .hero-overlay i { color: #ffffff !important; }
body.light-mode .nav-item { color: #555 !important; } body.light-mode .nav-item:hover, body.light-mode .nav-item.active { color: #000 !important; }
body.light-mode .card-header span { color: #000 !important; } body.light-mode .legend, body.light-mode .legend span { color: #444 !important; }
body.light-mode .legend span[style*="color:#fff"] { color: #000 !important; } body.light-mode .legend span[style*="color:#666"] { color: #555 !important; } body.light-mode .stat-label { color: #444 !important; }
body.light-mode .dot.white { background: #333 !important; }
body.light-mode input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }
body.light-mode select option { background-color: #ffffff; color: #000000; }
body.light-mode ::placeholder { color: #666 !important; opacity: 1; }
body.light-mode label { color: #333 !important; font-weight: 600; }
