/* style.css - mySUKAN SaaS V31.0 (Premium Login & Layout Fixes) */

:root { 
    --bg-color: #0b1120; 
    --panel-bg: #151e32; 
    --glass-border: rgba(255, 255, 255, 0.08); 
    --text-main: #f8fafc; 
    --text-muted: #94a3b8; 
    --accent-color: #3b82f6; 
    --input-bg: #0f172a; 
    --color-gold: #fbbf24; 
    --color-silver: #cbd5e1; 
    --color-bronze: #d97706;
}

[data-theme="light"] { 
    --bg-color: #f8fafc; 
    --panel-bg: #ffffff; 
    --glass-border: #e2e8f0; 
    --text-main: #0f172a; 
    --text-muted: #64748b; 
    --accent-color: #2563eb; 
    --input-bg: #f1f5f9; 
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body { background-color: var(--bg-color); color: var(--text-main); min-height: 100vh; overflow-x: hidden; display: flex; flex-direction: column; }
main { padding: 30px; max-width: 1600px; margin: 0 auto; flex: 1; width: 100%; }

/* ==========================================================
   LOADING & UTILITIES
   ========================================================== */
#loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(11, 17, 33, 0.95); z-index: 9999; display: none; justify-content: center; align-items: center; flex-direction: column; backdrop-filter: blur(10px);}
.run-track { width: 180px; height: 40px; border-bottom: 4px dashed var(--accent-color); position: relative; margin-bottom: 20px;}
.run-man { position: absolute; bottom: -5px; font-size: 2.8rem; animation: lari 1.5s linear infinite; }
.run-flag { position: absolute; bottom: -5px; right: -30px; font-size: 2.2rem; }
@keyframes lari { 0% { left: -40px; opacity: 0; transform: scaleX(-1) rotate(10deg); } 20% { opacity: 1; transform: scaleX(-1) rotate(-10deg); } 40% { transform: scaleX(-1) rotate(10deg); } 60% { transform: scaleX(-1) rotate(-10deg); } 80% { opacity: 1; transform: scaleX(-1) rotate(10deg); } 100% { left: 170px; opacity: 0; transform: scaleX(-1) rotate(-10deg); } }

#back-to-top { position: fixed; bottom: 30px; right: 30px; z-index: 9990; background: var(--accent-color); color: white; width: 50px; height: 50px; border-radius: 50%; display: none; justify-content: center; align-items: center; cursor: pointer; box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4); border: none; font-size: 1.5rem; transition: 0.3s;}
#back-to-top:hover { transform: translateY(-5px); background: #2563eb; }

/* ==========================================================
   HEADER & NAVBAR
   ========================================================== */
header { background: rgba(11, 17, 33, 0.85); backdrop-filter: blur(15px); border-bottom: 1px solid var(--glass-border); padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100; flex-wrap: wrap; gap: 15px;}
.logo-area { display: flex; align-items: center; gap: 15px; }
.logo-img { max-height: 50px; border-radius: 8px; object-fit: contain; }
.logo-area h1 { font-size: 1.5rem; font-weight: 800; text-transform: uppercase; margin:0; text-shadow: 0 0 15px rgba(255,255,255,0.1);}
.main-nav { display: flex; gap: 5px; align-items: center; background: rgba(0,0,0,0.3); padding: 6px 10px; border-radius: 50px; border: 1px solid var(--glass-border); box-shadow: 0 4px 15px rgba(0,0,0,0.2); flex-wrap: wrap; justify-content: center;}
.nav-item { background: transparent; border: none; color: var(--text-muted); padding: 10px 20px; border-radius: 40px; cursor: pointer; font-weight: 600; transition: 0.3s; display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.nav-item:hover { color: var(--text-main); background: rgba(255,255,255,0.05); }
.nav-item.active { background: linear-gradient(135deg, var(--accent-color), #2563eb); color: white; box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4); }
.nav-divider { width: 1px; height: 25px; background: var(--glass-border); margin: 0 5px; }
.btn-icon { background: transparent; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; transition: 0.3s; padding: 5px 10px; border-radius: 20px;}
.btn-icon:hover { color: var(--text-main); background: rgba(255,255,255,0.1); }

.btn-live-pulse { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #ef4444; padding: 8px 18px; border-radius: 40px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.85rem; letter-spacing: 1px; transition: 0.3s; margin: 0 5px;}
.btn-live-pulse:hover { background: #ef4444; color: white; transform: scale(1.05); }
.live-dot { width: 8px; height: 8px; background: #ef4444; border-radius: 50%; animation: pulse-live 1s infinite alternate; }
.btn-live-pulse:hover .live-dot { background: white; }
@keyframes pulse-live { from { opacity: 1; transform: scale(1); } to { opacity: 0.3; transform: scale(1.5); } }

/* ==========================================================
   BUTTONS & FORMS
   ========================================================== */
.form-group { margin-bottom: 20px; width: 100%; text-align: left; }
.form-group label { display: block; margin-bottom: 8px; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;}
.form-control { width: 100%; padding: 14px; border-radius: 10px; background: var(--input-bg); border: 1px solid var(--glass-border); color: var(--text-main); font-size: 1rem; outline: none; transition: 0.3s; }
.form-control:focus { border-color: var(--accent-color); box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); }

.btn { background: var(--panel-bg); border: 1px solid var(--glass-border); color: var(--text-main); padding: 12px 20px; border-radius: 12px; cursor: pointer; font-weight: 600; transition: all 0.3s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.95rem; }
.btn:hover { background: rgba(255,255,255,0.1); transform: translateY(-2px);}
.btn-primary { background: linear-gradient(135deg, var(--accent-color), #2563eb); border: none; color: white; box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);}
.btn-danger { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239,68,68,0.3); color: #ef4444;}
.btn-success { background: linear-gradient(135deg, #10b981, #059669); border: none; color: white; box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);}

/* ==========================================================
   MODALS & G1 PREMIUM LOGIN
   ========================================================== */
.view-section { display: none; animation: fadeIn 0.4s ease; } .view-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(11, 17, 33, 0.9); z-index: 10000; justify-content: center; align-items: center; padding: 15px; backdrop-filter: blur(5px); }
.modal-overlay.active { display: flex; animation: fadeIn 0.2s; }
.modal-content { background: var(--panel-bg); border: 1px solid var(--glass-border); padding: 35px; border-radius: 20px; text-align: center; max-width: 450px; width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,0.6);}
.modal-buttons { display: flex; gap: 10px; margin-top: 15px; }

/* REKAAN KHAS G1 LOGIN */
.premium-login-modal { background: #0f172a; border-radius: 24px; padding: 45px 35px; border: 1px solid rgba(255,255,255,0.05); }
.premium-login-modal h2 { font-size: 2.2rem; font-weight: 900; margin-bottom: 30px; letter-spacing: 0.5px; color: white; }

.role-tabs-pill { display: flex; background: #0b1120; border-radius: 50px; padding: 6px; margin-bottom: 25px; border: 1px solid rgba(255,255,255,0.05); }
.role-btn-pill { flex: 1; background: transparent; border: none; color: #64748b; padding: 14px 10px; border-radius: 40px; font-weight: 800; font-size: 0.85rem; cursor: pointer; transition: 0.3s; outline: none; -webkit-tap-highlight-color: transparent;}
.role-btn-pill.active { background: #818cf8; color: white; box-shadow: 0 0 20px rgba(129, 140, 248, 0.4); }

.premium-input-wrapper { background: #0b1120; border: 1px solid #334155; border-radius: 16px; overflow: hidden; box-shadow: inset 0 2px 4px rgba(0,0,0,0.5); transition: 0.3s; }
.premium-input-wrapper:focus-within { border-color: #60a5fa; box-shadow: 0 0 15px rgba(96, 165, 250, 0.2); }
.premium-input-wrapper .lock-icon { color: #fbbf24; font-size: 1.2rem; left: 18px;}
.premium-input-wrapper input { background: transparent !important; border: none !important; padding: 18px 45px 18px 55px; font-size: 1.05rem; color: white;}
.premium-input-wrapper input:focus { box-shadow: none !important; }

.btn-premium-batal { background: transparent; border: 1px solid #334155; color: #ef4444; border-radius: 16px; padding: 16px; font-weight: 800; font-size: 1.05rem; flex: 1; transition: 0.3s;}
.btn-premium-batal:hover { border-color: #ef4444; background: rgba(239, 68, 68, 0.05); }
.btn-premium-login { background: #60a5fa; border: none; color: white; border-radius: 16px; padding: 16px; font-weight: 800; font-size: 1.05rem; flex: 1.5; box-shadow: 0 0 20px rgba(96, 165, 250, 0.4); transition: 0.3s;}
.btn-premium-login:hover { transform: translateY(-2px); box-shadow: 0 0 30px rgba(96, 165, 250, 0.6); }

.password-wrapper { position: relative; display: flex; align-items: center; width: 100%; margin-bottom: 15px; }
.password-wrapper .lock-icon { position: absolute; left: 15px; font-size: 1.2rem; color: var(--text-muted); }
.password-wrapper input { width: 100%; padding-left: 45px; padding-right: 50px; margin-bottom: 0 !important; }
.password-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: transparent; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-muted); outline: none; transition: 0.3s; display: flex; justify-content: center; align-items: center; height: 100%;}
.password-toggle:hover { color: white; }

#toast-container { position: fixed; bottom: 30px; left: 30px; z-index: 10001; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: rgba(15, 23, 42, 0.95); border: 1px solid var(--glass-border); color: white; padding: 15px 25px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,0.5); transform: translateX(-150%); transition: 0.4s; display: flex; align-items: center; gap: 12px; border-left: 4px solid #10b981;}
.toast.show { transform: translateX(0); }

/* ==========================================================
   KAD MARKAH KESELURUHAN (NEON GLOW FULL BORDER)
   ========================================================== */
.top-cards-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 25px; margin-bottom: 30px; }
@keyframes neonPulse { 0% { box-shadow: 0 0 5px var(--house-color), inset 0 0 2px var(--house-color); } 100% { box-shadow: 0 0 20px var(--house-color), inset 0 0 10px var(--house-color); } }

.top-card { background: var(--panel-bg); backdrop-filter: blur(10px); border: 2px solid var(--house-color); border-radius: 16px; padding: 25px 20px; position: relative; display: flex; justify-content: space-between; align-items: center; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); overflow: hidden; z-index: 1; animation: neonPulse 2s infinite alternate ease-in-out; }
.top-card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, transparent 40%, var(--house-color) 150%); opacity: 0.2; z-index: -1; transition: 0.3s; }
.top-card:hover { transform: translateY(-8px); box-shadow: 0 0 35px var(--house-color), inset 0 0 15px var(--house-color) !important; }
.top-card:hover::before { opacity: 0.4; }
.tc-left { display: flex; flex-direction: column; gap: 12px; z-index: 2;}
.rank-label { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; padding: 6px 14px; border-radius: 30px; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.2); width: fit-content; color: #fff; letter-spacing: 1.5px; box-shadow: 0 2px 8px rgba(0,0,0,0.3);}
.house-name { font-size: 1.4rem; font-weight: 900; display: flex; align-items: center; gap: 10px; color: white; text-transform: uppercase; text-shadow: 0 2px 4px rgba(0,0,0,0.5);}
.house-indicator-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--house-color); box-shadow: 0 0 10px var(--house-color), 0 0 20px var(--house-color); }
.tc-right { text-align: right; z-index: 2;}
.points { font-size: 4rem; font-weight: 900; line-height: 1; color: white; letter-spacing: -2px; text-shadow: 0 0 15px var(--house-color);}
.points-label { font-size: 0.8rem; font-weight: 800; color: rgba(255,255,255,0.7); text-transform: uppercase; letter-spacing: 3px; margin-top: 5px; display: block;}

/* ==========================================================
   JADUAL PEMARKAHAN 
   ========================================================== */
.dashboard-split { display: flex; gap: 25px; align-items: flex-start; flex-wrap: wrap; position: relative;} 
.dash-left { flex: 1.8; min-width: 300px; display: flex; flex-direction: column; gap: 25px; overflow-x: auto; }
.dash-right { flex: 1; min-width: 300px; height: 100%; }

.table-wrapper { background: var(--panel-bg); border-radius: 20px; padding: 25px; border: 1px solid var(--glass-border); box-shadow: 0 10px 30px rgba(0,0,0,0.2); min-width: 100%; }
.table-header { display: flex; padding-bottom: 15px; border-bottom: 2px solid var(--glass-border); margin-bottom: 15px; font-weight: 800; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; min-width: 500px;}
.table-row { display: flex; align-items: center; padding: 15px; margin-bottom: 10px; border-radius: 12px; background: rgba(0,0,0,0.15); border: 1px solid var(--glass-border); transition: 0.3s; min-width: 500px;}
.table-row:hover { background: rgba(255,255,255,0.05); transform: scale(1.01); }

.col-rank { flex: 0 0 5%; font-weight: 800; font-size: 1.1rem; color: var(--text-muted);}
.col-house { flex: 0 0 35%; font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; gap: 15px; text-transform: uppercase;}
.house-bar { width: 5px; height: 25px; border-radius: 5px; background: var(--house-color); box-shadow: 0 0 10px var(--house-color); }
.col-medal { flex: 0 0 10%; text-align: center; font-size: 1.3rem; } 
.col-points { flex: 1; display: flex; justify-content: flex-end; font-weight: 900; font-size: 1.6rem; color: var(--text-main); }

.racing-bar-row { display: flex; align-items: center; margin-bottom: 20px; gap: 20px; min-width: 500px;}
.rb-label { flex: 0 0 20%; font-weight: 800; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px;}
.rb-track { flex: 1; background: var(--input-bg); height: 24px; border-radius: 20px; overflow: hidden; border: 1px solid var(--glass-border);}
.rb-fill { height: 100%; border-radius: 20px; transition: width 1s cubic-bezier(0.4, 0, 0.2, 1); display: flex; align-items: center; justify-content: flex-end; padding-right: 12px; color:white; font-weight:bold; font-size:0.8rem; box-shadow: 0 0 15px var(--house-color);}

/* ==========================================================
   🔥 G2 UI FIX: ACARA TERKINI (OUTLINE & TRANSPARENT)
   ========================================================== */
.dash-live-events-container { 
    max-height: 550px; 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
    padding-right: 5px; 
    -ms-overflow-style: none;  
    scrollbar-width: none;  
}
.dash-live-events-container::-webkit-scrollbar { display: none; }

.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

/* KAD ACARA OUTLINE */
.event-card { background: transparent; border: 1px solid rgba(255,255,255,0.05); border-radius: 16px; overflow: hidden; transition: transform 0.25s, box-shadow 0.25s; display: flex; flex-direction: column; }
.event-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.02);}

.event-header { display: flex; justify-content: space-between; align-items: center; padding: 18px; gap: 10px;}
.event-title { font-size: 1rem; font-weight: 800; color: var(--text-main); text-transform: uppercase; letter-spacing: 0.5px; flex: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;}
.event-title span { font-weight: 600; font-size: 0.75rem; color: var(--text-muted); background: transparent; padding: 0;}

/* STATUS BADGE OUTLINE */
.status-badge { flex-shrink: 0; font-size: 0.7rem; font-weight: 800; padding: 6px 14px; border-radius: 30px; text-transform: capitalize; letter-spacing: 0.5px; background: transparent !important;}
.status-selesai { color: #4ade80; border: 1px solid #4ade80; }
.status-belum { color: #facc15; border: 1px solid #facc15; }

.event-results { padding: 0 18px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; background: transparent; }
.event-results p { font-size: 0.85rem; font-weight: 600; margin: 0; line-height: 1.5; color: var(--text-main); }
.event-results p small { display: block; padding-left: 22px; color: var(--text-muted); font-size: 0.75rem;}
.event-card-pending { padding: 0 18px 18px 18px; flex: 1; display: flex; align-items: flex-start; font-size: 0.85rem; color: var(--text-muted); }

/* DAFTAR ACARA (GRID) */
.reg-event-card { background: var(--panel-bg); border: 1px solid var(--glass-border); border-radius: 16px; cursor: pointer; transition: 0.3s; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.15); min-height: 160px; position: relative;}
.reg-event-card:hover { border-color: var(--accent-color); transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0,0,0,0.3);}
.reg-card-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 15px 18px; background: rgba(0,0,0,0.2); border-bottom: 1px solid var(--glass-border);}
.reg-card-body { padding: 20px 18px; flex: 1; display: flex; justify-content: space-between; align-items: center; gap:15px;}
.reg-card-title { font-size: 1.1rem; font-weight: 800; color: var(--text-main); margin: 0; text-transform: uppercase; line-height: 1.4;}
.btn-plus { background: linear-gradient(135deg, var(--accent-color), #2563eb); color: white; width: 40px; height: 40px; border-radius: 10px; display: flex; justify-content: center; align-items: center; font-size: 1.5rem; border: none; box-shadow: 0 4px 10px rgba(59, 130, 246, 0.4); flex-shrink: 0; pointer-events: none;}
.reg-event-card:hover .btn-plus { transform: scale(1.05); }

.reg-house-counts { display: flex; justify-content: center; gap: 15px; padding: 12px 18px; background: rgba(0,0,0,0.15); border-top: 1px solid var(--glass-border);}
.count-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.count-circle { width: 32px; height: 32px; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-weight: 800; font-size: 0.85rem; color: white;}
.count-label { font-size: 0.65rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px;}
.filter-group { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; background: var(--panel-bg); padding: 15px; border-radius: 12px; border: 1px solid var(--glass-border);}
.filter-btn { background: var(--input-bg); border: 1px solid var(--glass-border); color: var(--text-muted); padding: 10px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.3s; font-size: 0.85rem;}
.filter-btn.active { background: var(--accent-color); color: white; border-color: var(--accent-color); }
.filter-search { flex: 1; min-width: 200px; margin-bottom: 0 !important; }
.tag-kategori { font-size:0.75rem; background:rgba(255,255,255,0.1); padding:4px 10px; border-radius:8px; color:white; font-weight:600;}

.peserta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-top: 20px; }
.house-box { background: var(--input-bg); padding: 20px; border-radius: 12px; border-top: 4px solid var(--house-color); box-shadow: 0 4px 10px rgba(0,0,0,0.2);}
.murid-item { display: flex; justify-content: space-between; align-items:center; border-bottom: 1px solid rgba(255,255,255,0.05); padding: 10px 0; font-size: 0.9rem; font-weight: 600;}
.search-murid-input { width: 100%; padding: 10px; margin-bottom: 10px; border-radius: 6px; background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); color: white; font-size: 0.85rem; outline:none;}
optgroup { color: var(--accent-color); font-weight: bold; background: var(--panel-bg); }
optgroup option { color: var(--text-main); font-weight: normal; }

/* ==========================================================
   🔥 G2 UI FIX: PANEL ADMIN & TABS PREMIUM
   ========================================================== */
.admin-banner { background: transparent; border-bottom: 1px solid var(--glass-border); padding: 25px 0; display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:15px; margin-bottom: 25px;}
.admin-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 30px; padding-bottom: 10px; -ms-overflow-style: none; scrollbar-width: none;}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab-btn { background: transparent; border: none; color: var(--text-muted); padding: 10px 18px; border-radius: 8px; font-weight: 700; cursor: pointer; white-space: nowrap; transition: 0.3s; font-size: 0.85rem; outline:none; -webkit-tap-highlight-color: transparent;}
.admin-tab-btn.active { background: #60a5fa; color: white; }
.admin-tab-content { display: none; animation: fadeIn 0.4s ease; } .admin-tab-content.active { display: block; }

body[data-role="urusetia"] .admin-only { display: none !important; }
body[data-role="ketua"] .urusetia-only, body[data-role="ketua"] .admin-only { display: none !important; }

/* KAD KEPUTUSAN PREMIUM */
.keputusan-filter-tabs { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 1px solid var(--glass-border); padding-bottom: 15px;}
.keputusan-filter-tabs .btn { background: transparent; border: none; border-radius: 8px; color: var(--text-muted); padding: 10px 20px;}
.keputusan-filter-tabs .btn.active { background: rgba(255,255,255,0.1); color: var(--text-main); border: 1px solid var(--glass-border);}

.result-card { background: var(--panel-bg); border: 1px solid var(--glass-border); border-radius: 16px; padding: 20px 25px; margin-bottom: 20px; box-shadow: 0 5px 20px rgba(0,0,0,0.15); display: flex; flex-direction: column; gap: 15px; border-left: 6px solid var(--medal-color);}
.result-card.emas { --medal-color: var(--color-gold); }
.result-card.perak { --medal-color: var(--color-silver); }
.result-card.gangsa { --medal-color: var(--color-bronze); }
.result-card.keempat { --medal-color: #3b82f6; }
.result-card.kelima { --medal-color: #8b5cf6; }

.rc-header { display: flex; align-items: center; gap: 12px; font-size: 1.1rem; font-weight: 800; color: var(--medal-color); letter-spacing: 1px; text-transform: uppercase;}
.rc-icon { background: rgba(0,0,0,0.2); width: 35px; height: 35px; display: flex; justify-content: center; align-items: center; border-radius: 50%; font-size: 1.2rem;}
.rc-body { display: grid; grid-template-columns: 1fr 2fr; gap: 15px; align-items: start;}
.rc-names-group select { margin-bottom: 10px; }
.rc-names-group select:last-child { margin-bottom: 0; }
.rc-footer { margin-top: 5px; padding-top: 15px; border-top: 1px dashed var(--glass-border); display: flex; gap: 15px; align-items: center;}
.rc-footer input[type="text"] { flex: 1; margin: 0; }
.rc-footer label { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; color: var(--text-main); cursor: pointer; white-space: nowrap;}
.rc-footer input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent-color); cursor: pointer;}

/* DATA MURID & JADUAL */
.admin-card { background: var(--panel-bg); border: 1px solid var(--glass-border); border-radius: 16px; padding: 30px; margin-bottom: 25px;}
.murid-full-section { width: 100%; margin-top: 30px; background: var(--panel-bg); border-radius: 16px; padding: 30px; border: 1px solid var(--glass-border); }
.murid-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; margin-top: 20px;}
.murid-box { background: var(--input-bg); padding: 25px; border-radius: 12px; border: 1px solid var(--glass-border);}
.murid-scroll-list { max-height: 500px; overflow-y: auto; padding-right: 10px; }
.murid-scroll-list ul { display: flex; flex-direction: column; gap: 10px; list-style: none; padding: 0; }
.murid-scroll-list li { background: var(--panel-bg); padding: 12px 15px; border-radius: 10px; border-left: 4px solid var(--house-color); display: flex; justify-content: space-between; align-items: center;}
.murid-badge { background: #334155; color: white; padding: 4px 8px; border-radius: 6px; font-weight: 800; font-size: 0.75rem; margin-right: 10px; display: inline-block; min-width: 50px; text-align: center; }

/* ANALISIS ATLET LIST */
.athlete-rank-list { display: flex; flex-direction: column; gap: 8px; }
.ar-header { display: grid; grid-template-columns: 2fr 1fr 0.5fr 0.5fr 0.5fr 0.8fr; gap: 10px; padding: 10px 15px; font-weight: 800; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; border-bottom: 2px solid var(--glass-border); margin-bottom: 10px;}
.ar-row { display: grid; grid-template-columns: 2fr 1fr 0.5fr 0.5fr 0.5fr 0.8fr; gap: 10px; padding: 12px 15px; background: rgba(0,0,0,0.15); border-radius: 10px; border: 1px solid var(--glass-border); align-items: center; transition: 0.2s;}
.ar-row:hover { background: rgba(255,255,255,0.05); }
.ar-name { font-weight: 700; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
.ar-house { font-weight: 800; text-transform: uppercase; }
.ar-medal { text-align: center; font-weight: 700; }
.ar-pts { text-align: right; font-weight: 900; font-size: 1.2rem; color: white; }

/* TABLE SENARAI ACARA & START LIST */
.analysis-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.85rem; color: var(--text-main); font-weight: 600;}
.analysis-table th { padding: 15px 10px; text-align: left; border-bottom: 1px solid var(--glass-border); font-weight: 800; color: var(--text-muted); text-transform: uppercase; font-size: 0.75rem;}
.analysis-table td { padding: 15px 10px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.analysis-table tr:hover td { background: rgba(255,255,255,0.02); }
.startlist-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: start; }

/* G7: Tetapan Rumah */
.house-settings-row { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; background: var(--panel-bg); padding: 12px 15px; border-radius: 12px; border: 1px solid var(--glass-border); box-shadow: 0 4px 10px rgba(0,0,0,0.1);}
.color-picker-wrap { width: 45px; height: 45px; border-radius: 8px; overflow: hidden; border: 2px solid var(--glass-border); flex-shrink: 0; position: relative;}
.color-picker-wrap input[type="color"] { width: 200%; height: 200%; position: absolute; top: -50%; left: -50%; cursor: pointer; border: none; padding: 0;}
.house-settings-row input[type="text"] { flex: 1; padding: 12px 15px; background: var(--input-bg); color: var(--text-main); border: 1px solid var(--glass-border); border-radius: 8px; font-weight: 700; font-size: 1rem;}
.btn-remove { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); width: 45px; height: 45px; border-radius: 8px; cursor: pointer; font-size: 1.2rem; display: flex; justify-content: center; align-items: center; transition: 0.3s; flex-shrink: 0;}
.btn-remove:hover { background: #ef4444; color: white; transform: scale(1.05);}

/* Grand Finale Overlay */
#grand-finale-overlay { display: none; position: absolute; inset: 0; background: rgba(11, 17, 33, 0.95); z-index: 50; flex-direction: column; align-items: center; justify-content: center; text-align: center; animation: fadeIn 1s ease-in-out; border-radius: 20px; padding: 20px; backdrop-filter: blur(15px); }

/* Footer & Theme */
.footer-wrapper { padding: 25px; display: flex; justify-content: space-between; align-items: center; color: var(--text-muted); font-size: 0.85rem; margin-top: auto; border-top: 1px solid var(--glass-border);}

/* PRINT PDF */
@media print {
    body { background: white !important; color: black !important; }
    body * { visibility: hidden; }
    #dashboard, #dashboard * { visibility: visible; }
    #startlist-container, #startlist-container * { visibility: visible; }
    
    #dashboard, #startlist-container { position: absolute; left: 0; top: 0; width: 100%; margin: 0; padding: 0; display: block;}
    .dash-right, .main-nav, header, .footer-wrapper, .admin-tabs, .admin-banner { display: none !important; }
    
    .startlist-grid { display: block !important; }
    .analysis-table { border-collapse: collapse; width: 100%; font-family: 'Poppins', sans-serif; font-size: 10pt; color: black !important; border: 1px solid #ccc !important; margin-bottom: 30px !important;}
    .analysis-table th { background: #e2e8f0 !important; color: black !important; border-bottom: 2px solid #94a3b8 !important; padding: 10px; -webkit-print-color-adjust: exact; print-color-adjust: exact;}
    .analysis-table td { color: black !important; border-bottom: 1px solid #cbd5e1 !important; padding: 10px; border-right: 1px solid #eee !important;}
    .admin-card { border: none !important; box-shadow: none !important; padding: 0 !important; margin: 0 !important; background: white !important;}
    .print-dashed-line { border-bottom: 1px dashed #64748b !important; width: 100%; }
}

/* ==========================================================
   📱 100% MOBILE RESPONSIVE FIX (SMARTPHONE VIEW)
   ========================================================== */
@media (max-width: 1024px) { 
    .dashboard-split { flex-direction: column; } 
    .dash-left, .dash-right { width: 100%; flex: none; } 
    .startlist-grid { grid-template-columns: 1fr; } 
    #tab-senarai-acara > div, #tab-murid > div, #tab-tetapan-mysukan > div { grid-template-columns: 1fr !important; }
}

@media (max-width: 768px) {
    main { padding: 15px !important; }
    .admin-card, .table-wrapper, .murid-full-section { padding: 20px 15px !important; overflow-x: auto !important; }

    header { padding: 15px !important; flex-direction: column; gap: 10px; justify-content: center; }
    .logo-area { width: 100%; justify-content: center; margin-bottom: 5px; text-align: center; }
    .main-nav { 
        width: 100%; 
        flex-wrap: nowrap !important; 
        overflow-x: auto !important; 
        justify-content: flex-start !important;
        padding: 8px !important;
        -webkit-overflow-scrolling: touch; 
        border-radius: 12px;
    }
    .main-nav::-webkit-scrollbar { display: none; }
    .nav-item { white-space: nowrap; font-size: 0.8rem; padding: 8px 15px; }

    .top-cards-container { gap: 15px; }
    .top-card { padding: 18px 15px; border-width: 1px; border-left-width: 5px; }
    .house-name { font-size: 1.1rem; }
    .points { font-size: 2.8rem !important; }
    .points-label { font-size: 0.7rem; }

    /* Force Horizontal Scroll for Tables */
    #lang-tbl-kedudukan, .table-row, .racing-bar-row { min-width: 450px; }
    .analysis-table { min-width: 550px; font-size: 0.8rem; }
    
    .col-house { font-size: 0.85rem; }
    .col-medal { font-size: 1.1rem; }
    .col-points { font-size: 1.4rem; }

    .form-group label { font-size: 0.75rem; }
    .form-control { padding: 10px 15px; font-size: 0.9rem; }
    .btn { font-size: 0.85rem; padding: 12px 15px; }
    
    .events-grid { grid-template-columns: 1fr; gap: 12px; }
    .reg-event-card { min-height: auto; }
    .murid-grid { grid-template-columns: 1fr; } 
    
    .ar-header, .ar-row { grid-template-columns: 1.5fr 1fr 0.5fr 0.5fr 0.5fr 0.8fr; font-size: 0.8rem;} 
    .ar-name { font-size: 0.85rem; }
    .rc-body { grid-template-columns: 1fr; }
    
    .modal-content { padding: 30px 20px; width: 95%; }
    .premium-login-modal h2 { font-size: 1.8rem; }
    #gf-johan-nama { font-size: 2.5rem !important; }
    
    .admin-tabs { padding-bottom: 15px; }
}