/*
 * ZEROMIKH UNIFIED STYLESHEET
 * Gabungan: User Panel, Admin Panel, & Auth
 */

:root {
    --bg: #f8fafc; --card: #ffffff; --text: #1e293b; --text-m: #64748b; --border: #e2e8f0;
    --primary: #6366f1; --primary-s: #eef2ff; --green: #10b981; --red: #ef4444; --orange: #f59e0b;
    --purple: #a855f7; --blue: #3b82f6; --pink: #ec4899;
    --primary-glow: rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] {
    --bg: #0f172a; --card: #1e293b; --text: #f1f5f9; --text-m: #94a3b8; --border: #334155;
    --primary: #818cf8; --primary-s: rgba(129,140,248,0.1);
    --primary-glow: rgba(129, 140, 248, 0.15);
}

/* --- GLOBAL RESET & TYPOGRAPHY --- */
body { 
    font-family: 'Inter', 'Plus Jakarta Sans', sans-serif; 
    background: var(--bg); 
    color: var(--text); 
    margin: 0; 
    padding: 15px; 
    transition: 0.3s; 
    font-size: 13px; 
    overflow-x: hidden; 
}

.container { max-width: 1100px; margin: auto; }

/* =================================================================
   AUTH PAGE: DYNAMIC THEME (DARK & LIGHT SUPPORT)
   ================================================================= */

/* 1. Definisi Warna Khusus Auth (Light Mode Default) */
:root {
    --auth-bg: #cbd5e1;       /* Background Abu Elegant */
    --auth-card: #ffffff;     /* Card Putih Bersih */
    --auth-text: #1e293b;     /* Teks Gelap */
    --auth-input-bg: #f1f5f9; /* Input Abu Sangat Muda */
    --auth-input-text: #0f172a;
    --auth-border: #e2e8f0;
    --auth-shadow: rgba(0, 0, 0, 0.1);
    --auth-btn: #6366f1;
    --auth-btn-hover: #4f46e5;
    --auth-logo: #1e293b;     
}

/* 2. Definisi Warna Khusus Auth (Dark Mode) */
[data-theme="dark"] {
    --auth-bg: #0f172a;       /* Deep Navy */
    --auth-card: #1e293b;     /* Slate 800 */
    --auth-text: #ffffff;     /* Teks Putih */
    --auth-input-bg: #f8fafc; /* Input Putih Terang */
    --auth-input-text: #0f172a; /* Teks Input Hitam */
    --auth-border: #334155;
    --auth-shadow: rgba(0, 0, 0, 0.5);
    --auth-logo: #ffffff;
}

/* 3. Styling Halaman */
body.auth-page {
    background-color: var(--auth-bg);
    display: flex; 
    align-items: center; 
    justify-content: center; 
    
    /* UBAH BAGIAN INI UNTUK MENGUNCI SCROLL */
    height: 100vh;       /* Paksa tinggi pas 100% layar device */
    width: 100vw;        /* Lebar penuh */
    overflow: hidden;    /* INI KUNCINYA: Hilangkan scrollbar samasekali */
    position: fixed;     /* Tambahan agar benar-benar diam di tempat */
    top: 0;
    left: 0;
    
    padding: 15px;
    color: var(--auth-text);
    transition: background-color 0.3s ease, color 0.3s ease;
    box-sizing: border-box; /* Pastikan padding tidak menambah ukuran */
}

body.auth-page .container {
    padding: 0;
    display: flex; 
    justify-content: center; 
    width: 100%;
}

/* Card Login */
.auth-card {
    background: var(--auth-card);
    padding: 40px 30px; 
    max-width: 380px; 
    width: 100%; 
    border-radius: 20px; 
    border: 1px solid var(--auth-border); 
    box-shadow: 0 20px 60px -10px var(--auth-shadow); 
    text-align: center; /* Default center untuk isi */
    position: relative;
    overflow: hidden; 
    box-sizing: border-box;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* --- LOGO: Fix Rata Tengah --- */
.auth-card .logo {
    font-size: 32px; 
    font-weight: 800;
    margin-bottom: 0px; /* Rapat ke bawah */
    color: var(--auth-logo);
    letter-spacing: -1px;
    line-height: 1;
    
    /* Pengunci Posisi Tengah */
    display: block;
    width: 100%;
    text-align: center;
}
.auth-card .logo span { color: var(--auth-btn); }

/* --- SUBTITLE: Fix Rata Tengah & Gradient --- */
.logo-subtitle {
    font-size: 18px; 
    font-weight: 700; 
    margin-top: 6px;       /* Jarak rapat ke logo */
    margin-bottom: 35px;   /* Jarak ke form */
    
    /* Gradient Text */
    background: linear-gradient(90deg, #6366f1, #a855f7); 
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: #6366f1;
    
    /* Pengunci Posisi Tengah */
    display: block;
    width: 100%;
    text-align: center;
    line-height: 1.2;
}

/* Wrapper Form */
.form-container { 
    position: relative; 
    min-height: 240px; 
}

.form-view {
    width: 100%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.form-view.hidden { display: none; }

.auth-card .input-group {
    margin-bottom: 15px; 
    width: 100%;
}

/* Input Styling */
.auth-card input {
    background: var(--auth-input-bg) !important;
    border: 2px solid transparent;
    color: var(--auth-input-text) !important;
    height: 48px; 
    padding: 0 16px;
    border-radius: 10px;
    width: 100%;
    font-weight: 600;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s;
}

.auth-card input::placeholder { 
    color: #94a3b8; 
    font-weight: 500; 
}

.auth-card input:focus {
    background: #ffffff !important; 
    border-color: var(--auth-btn);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

/* Tombol */
.auth-card .btn-main {
    background: var(--auth-btn);
    color: white;
    border: none;
    height: 48px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    width: 100%;
    margin-top: 10px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    transition: 0.2s;
}

.auth-card .btn-main:hover {
    background: var(--auth-btn-hover);
    transform: translateY(-2px);
}

/* Link Footer */
.link-auth { display: block; margin-top: 25px; color: #64748b; text-decoration: none; font-size: 13px; font-weight: 500; }
.link-auth:hover { color: var(--auth-text); } 
.link-auth span { color: var(--auth-btn); font-weight: 600; }

.auth-card label { display: none; }

.auth-card .msg { padding: 12px; border-radius: 8px; font-size: 13px; font-weight: 600; margin-bottom: 20px; text-align: left; line-height: 1.4; }
.auth-card .msg-err { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); }
.auth-card .msg-ok { background: rgba(34, 197, 94, 0.1); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.2); }

/* --- FIX AUTOFILL BROWSER --- */
/* Light Mode */
.auth-page input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #f1f5f9 inset !important;
    -webkit-text-fill-color: #0f172a !important;
}
/* Dark Mode */
[data-theme="dark"] .auth-page input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #f8fafc inset !important;
    -webkit-text-fill-color: #0f172a !important;
}

/* =================================================================
   DASHBOARD & OTHER STYLES (Code Lama Anda - Tidak Berubah)
   ================================================================= */

/* --- COMPONENTS: HEADER & NAV --- */
.sticky-header { position: sticky; top: 0; z-index: 99; background: var(--bg); padding-top: 10px; padding-bottom: 5px; margin-bottom: 20px; }
.top-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 10px; }
.logo-wrap { display: flex; flex-direction: column; }
/* Logo Dashboard (beda class dgn auth) */
.top-nav .logo { font-size: 20px; font-weight: 800; white-space: nowrap; letter-spacing: -0.5px; line-height: 1; } 
.top-nav .logo span { color: var(--primary); }

.say-hi { font-size: 11px; font-weight: 800; margin-top: 4px; background: linear-gradient(45deg, var(--primary), var(--purple), var(--pink)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.nav-actions { display: flex; gap: 4px; align-items: center; }
.btn-nav { background:var(--card); border:1px solid var(--border); padding:5px 8px; border-radius:8px; cursor:pointer; color:var(--text); font-weight:700; text-decoration:none; font-size:10px; white-space: nowrap; display: flex; align-items: center; transition: 0.2s; }

/* --- COMPONENTS: CARDS & STATS --- */
.card { background: var(--card); border-radius: 20px; padding: 20px; margin-bottom: 20px; border: 1px solid var(--border); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.stat-card { background: var(--card); padding: 12px 10px; border-radius: 12px; border: 1px solid var(--border); text-align: center; cursor: pointer; transition: transform 0.2s, filter 0.2s; user-select: none; }
.stat-card:hover, .stat-clickable:hover { transform: translateY(-3px); filter: brightness(0.95); }
.stat-card:active { transform: scale(0.98); }
.stat-card small { color: var(--text-m); font-size: 9px; font-weight: 700; text-transform: uppercase; display: block; }
.stat-card div { font-size: 16px; font-weight: 800; margin-top: 2px; }

/* Stat Colors */
.stat-card.s-balance { grid-column: span 2; border-bottom: 3px solid var(--green) !important; color: var(--green); display: flex; justify-content: space-between; align-items: center; text-align: left; cursor: default; }
.stat-card.s-balance:hover { transform: none; filter: none; }
.s-total, .s-members { border-bottom: 3px solid var(--blue); color: var(--blue); }
.s-aktif { border-bottom: 3px solid var(--green); color: var(--green); }
.s-omset { border-bottom: 3px solid var(--green); color: var(--green); grid-column: span 2; }
.s-warn { border-bottom: 3px solid var(--orange); color: var(--orange); }
.s-exp { border-bottom: 3px solid var(--red); color: var(--red); }
.s-subdom { border-bottom: 3px solid var(--purple) !important; color: var(--purple); }
.s-layanan { border-bottom: 3px solid var(--pink) !important; color: var(--pink); }

/* --- COMPONENTS: FORMS & INPUTS (GLOBAL DASHBOARD) --- */
.grid-f { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; }
label { display: block; font-size: 11px; font-weight: 600; color: var(--text-m); margin-bottom: 6px; }
/* Input global (kecuali auth) */
body:not(.auth-page) input, body:not(.auth-page) select { background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 12px; border-radius: 12px; width: 100%; box-sizing: border-box; outline: none; margin-bottom: 8px; transition: 0.3s; }
body:not(.auth-page) input:focus, body:not(.auth-page) select:focus { border-color: var(--primary); }

body:not(.auth-page) .btn-main { background: var(--primary); color: white; border: none; padding: 14px; border-radius: 12px; font-weight: 700; width: 100%; margin-top: 15px; cursor: pointer; transition: 0.3s; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
body:not(.auth-page) .btn-main:hover { transform: translateY(-1px); box-shadow: 0 8px 15px rgba(0,0,0,0.15); }

#price-display { background: var(--primary-s); color: var(--primary); padding: 12px; border-radius: 12px; font-weight: 800; font-size: 14px; text-align: center; margin-top: 15px; border: 1px dashed var(--primary); }
#form-wrapper { display: block; transition: 0.3s; }
.toggle-icon { display: none; margin-left: auto; font-size: 18px; color: var(--text-m); }

/* --- COMPONENTS: TABLES --- */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th { text-align: left; font-size: 10px; color: var(--text-m); padding: 12px; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); }

/* --- COMPONENTS: BADGES & BUTTONS --- */
.badge { padding: 4px 8px; border-radius: 6px; font-size: 10px; font-weight: 800; display: inline-block; }
.bg-bs { background: #e0f2fe; color: #0284c7; border: 1px solid #bae6fd; } 
.bg-pg { background: #fff7ed; color: #ea580c; border: 1px solid #fed7aa; } 
.bg-pending { background: #fef9c3; color: #ca8a04; border: 1px solid #fde047; } 
.bg-lunas { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; } 
.dot { height: 8px; width: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }

.btn-action { padding: 6px 12px; border-radius: 8px; border: none; font-size: 10px; font-weight: 700; cursor: pointer; text-decoration: none; display: inline-block; margin-left: 2px; transition: 0.2s; color: white; }
.btn-action:hover { filter: brightness(0.9); transform: translateY(-1px); }
.btn-renew, .btn-acc { background: var(--green); box-shadow: 0 2px 5px rgba(16, 185, 129, 0.2); }
.btn-setup { background: var(--blue); box-shadow: 0 2px 5px rgba(59, 130, 246, 0.2); }
.btn-pg, .btn-db, .btn-free { background: var(--purple); box-shadow: 0 2px 5px rgba(168, 85, 247, 0.2); }
.btn-edit { background: var(--orange); }
.btn-del { background: var(--red); }
.btn-undo { background: var(--text-m); color: white; }

/* --- COMPONENTS: TABS --- */
.tab-nav { display: flex; gap: 5px; border-bottom: 1px solid var(--border); margin-bottom: 15px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.tab-nav::-webkit-scrollbar { display: none; }
.tab-btn { background: none; border: 1px solid transparent; color: var(--text-m); font-weight: 700; font-size: 11px; padding: 10px 14px; cursor: pointer; white-space: nowrap; border-radius: 10px; transition: 0.2s; flex-shrink: 0; }
.tab-btn.active { color: var(--primary); background: var(--primary-s); border-color: var(--primary); }
.tab-btn:hover { background: var(--bg); }
.tab-content { display: none; animation: fadeIn 0.3s ease-in-out; }
.tab-content.active { display: block; }
.badge-count { background: var(--red); color: white; padding: 2px 6px; border-radius: 10px; font-size: 9px; margin-left: 5px; }

/* --- COMPONENTS: MODAL & ALERTS --- */
.modal { display:none; position:fixed; z-index:999; left:0; top:0; width:100%; height:100%; background:rgba(0,0,0,0.5); align-items:center; justify-content:center; backdrop-filter: blur(4px); }
.modal-content { background:var(--card); padding:25px; border-radius:20px; width:90%; max-width:350px; border:1px solid var(--border); }
.alert { padding: 15px; border-radius: 15px; text-align: center; margin-bottom: 20px; font-weight: 700; background: var(--primary-s); color: var(--primary); border: 1px solid var(--primary); }

#simpleOverlay { display:none; position:fixed; z-index:9999; left:0; top:0; width:100%; height:100%; background:rgba(0,0,0,0.85); align-items:center; justify-content:center; color:white; text-align:center; }
.spinner { border: 4px solid rgba(255,255,255,0.1); border-top: 4px solid var(--primary); border-radius: 50%; width: 50px; height: 50px; animation: spin 1s linear infinite; margin: 0 auto 20px; }

/* --- EXTRAS & ANIMATIONS --- */
.wa-float { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: flex; align-items: center; justify-content: center; text-decoration: none; transition: all 0.3s ease; }
.wa-float:hover { transform: scale(1.1); }
.wa-float svg { width: 42px; height: 42px; fill: #25d366; filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.1)); animation: wa-bounce 3s infinite ease-in-out; }

.theme-switch { position: fixed; top: 20px; right: 20px; background: var(--card); backdrop-filter: blur(10px); border: 1px solid var(--border); padding: 8px 15px; border-radius: 12px; cursor: pointer; color: var(--text); font-size: 12px; font-weight: 700; z-index: 100; }

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes wa-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

@media (max-width: 768px) {
    #form-wrapper { display: none; overflow: hidden; padding-top: 10px; border-top: 1px solid var(--border); }
    #form-wrapper.show { display: block; animation: fadeIn 0.3s; }
    .card-header-mobile { cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding-bottom: 0px; margin-bottom: 0px; }
    .toggle-icon { display: block; transition: 0.3s; }
    .toggle-icon.rotate { transform: rotate(180deg); }
}