/* =========================================
   1. GLOBAL VARIABLES & THEME
========================================= */
:root {
    --wa-dark: #075e54;
    --wa-green: #128C7E;
    --wa-light: #25D366;
    --bg-gray: #f0f2f5;
    --text-main: #333;
    --text-muted: #666;
    --border-color: #edf2f7;
    --error-red: #dc3545;
}

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background-color: var(--bg-gray); 
    margin: 0; 
    padding: 0; 
    color: var(--text-main); 
}

/* Khusus untuk halaman Login & Register agar berada di tengah layar */
.auth-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

/* =========================================
   2. LAYOUTS & CONTAINERS
========================================= */
.header { background: white; padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.logo-area { display: flex; align-items: center; gap: 10px; font-weight: bold; font-size: 20px; color: var(--wa-dark); text-decoration: none; }
.user-area { display: flex; align-items: center; gap: 15px; }

.main-bg { background-color: var(--wa-green); padding: 30px; padding-bottom: 80px; }
.container { max-width: 1000px; margin: -50px auto 20px auto; padding: 0 20px; }
.container-profile { max-width: 700px; margin: -50px auto 20px auto; padding: 0 20px; }
.container-admin { max-width: 1100px; margin: 20px auto; background: white; padding: 0; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }

.admin-header { background: var(--wa-dark); color: white; padding: 20px 30px; display: flex; justify-content: space-between; align-items: center; }
.admin-header h1 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; }

/* Container Login & Register */
.auth-container { background: white; padding: 30px; border-radius: 10px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); width: 100%; max-width: 400px; text-align: center; }
.auth-container h2 { color: var(--wa-green); margin-bottom: 20px; margin-top: 0; }

/* =========================================
   3. CARDS & GRIDS
========================================= */
.card, .action-card, .device-card, .terms-card { background: white; padding: 25px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); margin-bottom: 25px; overflow-x: auto; }
.card-header { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #eee; padding-bottom: 15px; margin-bottom: 20px; flex-wrap: wrap; }
.card-header h3 { margin: 0; color: var(--wa-dark); display: flex; align-items: center; gap: 8px;}
.card-header p { margin: 5px 0 0 0; color: var(--text-muted); font-size: 13px; width: 100%;}
.card-border-top, .terms-card { border-top: 4px solid var(--wa-green); }

.welcome-card { background: white; padding: 25px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; border-left: 5px solid var(--wa-light); }
.welcome-card h2 { margin: 0 0 5px 0; color: var(--wa-dark); display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 20px; }
.stat-card { background: white; padding: 25px 20px; border-radius: 8px; text-align: center; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.stat-card h3 { margin: 0; font-size: 28px; color: #1a202c; }
.stat-card p { margin: 5px 0 0 0; font-size: 12px; font-weight: bold; color: #718096; text-transform: uppercase; }

.terms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.terms-item { background: #f8f9fa; padding: 12px; border-radius: 6px; border-left: 3px solid var(--wa-light); }
.terms-item label { display: block; font-size: 11px; color: #718096; text-transform: uppercase; font-weight: bold; }
.terms-item span { font-weight: bold; font-size: 15px; }

.balance-amount { font-size: 32px; font-weight: bold; color: var(--wa-dark); margin: 0 0 20px 0; }

/* =========================================
   4. BUTTONS
========================================= */
.btn-group { display: flex; gap: 15px; }
.btn { flex: 1; padding: 15px; border: none; border-radius: 5px; font-weight: bold; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 8px; color: white; transition: 0.2s; }

.btn-add { background: var(--wa-light); }
.btn-add:hover { background: var(--wa-green); }

.btn-withdraw { background: #ffc107; color: #333; }
.btn-withdraw:hover { background: #e0a800; }
.btn-withdraw:disabled { background: #ccc; cursor: not-allowed; }

.btn-secondary { display: block; width: 100%; padding: 12px; margin-top: 15px; background: #e9f5f2; color: var(--wa-green); border: 1px solid var(--wa-green); border-radius: 5px; text-align: center; text-decoration: none; font-weight: bold; font-size: 14px; transition: 0.2s; box-sizing: border-box; }
.btn-secondary:hover { background: var(--wa-green); color: white; }

.btn-save, .btn-send, .auth-container button { background-color: var(--wa-green); color: white; width: 100%; padding: 14px; border: none; border-radius: 5px; font-weight: bold; cursor: pointer; font-size: 15px; transition: 0.2s; margin-top: 10px; }
.btn-save:hover, .btn-send:hover, .auth-container button:hover { background-color: var(--wa-dark); }
.btn-save:disabled, .btn-send:disabled { background: #ccc; cursor: not-allowed; }

.btn-logout { background: #ffebee; color: #d32f2f; border: 1px solid #ffcdd2; padding: 8px 15px; border-radius: 5px; text-decoration: none; font-weight: bold; font-size: 13px; transition: 0.2s; }
.btn-logout:hover { background: #ffcdd2; }

.btn-back { display: inline-block; margin-bottom: 20px; color: white; text-decoration: none; font-weight: bold; font-size: 14px; }
.btn-back i { margin-right: 5px; }

/* =========================================
   5. TABLES & BADGES
========================================= */
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 500px; }
th { background: #f8f9fa; color: #718096; text-transform: uppercase; font-size: 11px; padding: 15px; text-align: center; border-bottom: 2px solid var(--border-color); }
td { padding: 15px 12px; border-bottom: 1px solid var(--border-color); vertical-align: middle; text-align: center; }
th:first-child, td:first-child { text-align: left; }

.badge { padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: bold; }
.badge-active { background: #c6f6d5; color: #22543d; }
.badge-inactive { background: #fed7d7; color: #822727; }
.badge-pending { background: #fefcbf; color: #975a16; }

.wd-chip { display: none; background: #c6f6d5; color: #22543d; font-size: 11px; padding: 4px 10px; border-radius: 20px; font-weight: bold; margin-left: 10px; vertical-align: middle; border: 1px solid #38a169; animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

/* Khusus Admin Report Table */
.report-controls { display: flex; align-items: center; gap: 15px; margin-bottom: 25px; background: #f8f9fa; padding: 15px; border-radius: 8px; flex-wrap: wrap;}
.clickable-num { cursor: pointer; font-weight: bold; padding: 4px 8px; border-radius: 4px; transition: 0.2s; }
.clickable-num:hover { background: #eee; }
.c-pend { color: #d69e2e; } .c-sent { color: #3182ce; } .c-read { color: #38a169; } .c-fail { color: #e53e3e; }
.detail-row { background: #fcfcfc; display: none; }
.detail-content { text-align: left; padding: 15px !important; font-size: 13px; color: #666; border-left: 4px solid var(--wa-green); line-height: 1.6; }

/* =========================================
   6. FORMS, MODALS & UTILITIES
========================================= */
.form-group { margin-bottom: 15px; text-align: left; }
.form-group label { display: block; font-weight: bold; margin-bottom: 8px; font-size: 13px; color: #555; }
.form-group input, .form-group select, .form-group textarea, .auth-container input { width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; font-family: inherit; font-size: 14px; transition: 0.2s; margin-bottom: 10px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus, .auth-container input:focus { border-color: var(--wa-green); outline: none; }
.form-group input:disabled { background: #e9ecef; cursor: not-allowed; color: #666; }

.input-hint { font-size: 11px; color: var(--error-red); margin-top: -5px; font-weight: bold; margin-bottom: 10px; }
.error { color: var(--error-red); font-size: 14px; margin-bottom: 10px; display: none; font-weight: bold; }
.link { margin-top: 15px; display: block; color: var(--wa-green); text-decoration: none; font-size: 14px; font-weight: bold;}
.status-online { color: var(--wa-light); font-weight: bold; font-size: 14px; }

#qrcode { display: flex; justify-content: center; margin: 20px 0; min-height: 250px; }
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; justify-content: center; align-items: center; padding: 20px; box-sizing: border-box;}
.modal-content { background: white; padding: 30px; border-radius: 10px; width: 100%; max-width: 400px; text-align: center; position: relative; animation: fadeIn 0.3s ease; }

/* =========================================
   7. TABS (ADMIN DASHBOARD)
========================================= */
.tabs-nav { display: flex; background: #fff; border-bottom: 1px solid #ddd; padding: 0 20px; overflow-x: auto; white-space: nowrap; }
.tab-btn { padding: 15px 25px; border: none; background: none; cursor: pointer; font-size: 15px; font-weight: 600; color: #666; position: relative; transition: 0.3s; }
.tab-btn.active { color: var(--wa-green); }
.tab-btn.active::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 3px; background: var(--wa-green); }
.tab-btn:hover { background: #f8f9fa; }
.tab-content { display: none; padding: 30px; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }