:root {
  --bg: #050b08;
  --bg2: #0a1610;
  --card: rgba(17, 37, 26, 0.6); /* Glassmorphism */
  --card-solid: #11251a;
  --border: rgba(42, 99, 68, 0.4);
  --border-light: rgba(42, 99, 68, 0.8);
  --text: #e4ddd0;
  --text-muted: #7a9485;
  --accent: #d4a843;
  --accent-hover: #e6bc5a;
  --accent-dim: rgba(212,168,67,0.15);
  --green: #1a8c4e;
  --green-light: #27ae60;
  --red: #c0392b;
  --red-light: #e74c3c;
  --orange: #e67e22;
  --blue: #2980b9;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow: 0 10px 40px rgba(0,0,0,0.5);
  --glass-blur: 16px;
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  position: relative;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(26, 140, 78, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(212, 168, 67, 0.1) 0%, transparent 40%);
}

/* EFEK CAHAYA BERGERAK DI LATAR BELAKANG */
body::before, body::after {
  content: '';
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
  animation: floatLight 15s infinite alternate ease-in-out;
}
body::before {
  background: rgba(26, 140, 78, 0.2);
  top: -150px;
  left: -150px;
}
body::after {
  background: rgba(212, 168, 67, 0.15);
  bottom: -150px;
  right: -150px;
  animation-delay: -5s;
}

@keyframes floatLight {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(100px, 80px) scale(1.3); }
}

/* Efek Kaca Premium (Glassmorphism) */
.glass {
  background: var(--card);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.page { display:none; min-height:100vh; position: relative; z-index: 1; }
.page.active { display:block; animation: fadeIn 0.5s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ===== TOMBOL CHAT TELEGRAM FAB ===== */
.telegram-fab {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #0088cc, #005580);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 6px 20px rgba(0, 136, 204, 0.4);
  z-index: 999;
  text-decoration: none;
  transition: all 0.3s ease;
  animation: pulseGlow 2s infinite;
}
.telegram-fab:hover {
  transform: scale(1.1) rotate(5deg);
  background: linear-gradient(135deg, #005580, #0088cc);
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(0, 136, 204, 0.5); }
  70% { box-shadow: 0 0 0 15px rgba(0, 136, 204, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 136, 204, 0); }
}

/* ===== LOADER ===== */
#loader {
  position: fixed; inset: 0; background: var(--bg); z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#loader.hidden { opacity: 0; visibility: hidden; }
.loader-circle {
  width: 60px; height: 60px; border: 4px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite;
}
#loader p { color: var(--text-muted); letter-spacing: 1px; }

/* ===== AUTH PAGES ===== */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: url('logo-bg.png') no-repeat center center fixed; background-size: cover; position: relative;
}
.auth-wrap::before {
  content: ''; position: absolute; inset: 0; background: rgba(5, 11, 8, 0.85); backdrop-filter: blur(8px); z-index: 1;
}
.auth-card {
  position: relative; z-index: 2; border-radius: var(--radius-lg); padding: 40px 32px;
  width: 100%; max-width: 440px; border: 1px solid var(--border-light);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
}
.auth-logo-box {
  width: 80px; height: 80px; margin: 0 auto 16px; border-radius: 20px; overflow: hidden;
  border: 2px solid var(--accent); box-shadow: 0 10px 30px rgba(212,168,67,0.3);
}
.auth-logo-box img { width: 100%; height: 100%; object-fit: cover; }
.auth-card h1 { font-family: 'Playfair Display', serif; font-weight: 900; font-size: 28px; text-align: center; color: var(--text); }
.auth-card .subtitle { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 28px; letter-spacing: 1px; }
.auth-toggle { display: flex; gap: 4px; background: rgba(0,0,0,0.3); border-radius: 12px; padding: 4px; margin-bottom: 24px; }
.auth-toggle button {
  flex: 1; padding: 12px; border: none; background: transparent; color: var(--text-muted);
  font-size: 14px; font-weight: 600; border-radius: 8px; cursor: pointer; transition: all 0.3s;
}
.auth-toggle button.active { background: linear-gradient(135deg, var(--green), var(--green-light)); color: #fff; box-shadow: 0 4px 15px rgba(39,174,96,0.3); }

/* ===== FORM ELEMENTS ===== */
.input-group { margin-bottom: 16px; }
.input-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.input-group input, .input-group select, .input-group textarea {
  width: 100%; padding: 14px 16px; background: rgba(0,0,0,0.3); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 15px; transition: all 0.2s; outline: none;
}
.input-group input:focus, .input-group select:focus, .input-group textarea:focus { 
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); background: rgba(0,0,0,0.5);
}
.input-group select option { background: var(--card-solid); color: var(--text); }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 24px; border: none; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.3s; text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn-gold { background: linear-gradient(135deg, var(--accent), #c49a38); color: #1a1a0a; box-shadow: 0 4px 20px rgba(212,168,67,0.3); }
.btn-gold:hover { box-shadow: 0 8px 25px rgba(212,168,67,0.5); transform: translateY(-2px); }
.btn-green { background: linear-gradient(135deg, var(--green), var(--green-light)); color: #fff; box-shadow: 0 4px 15px rgba(39,174,96,0.2); }
.btn-red { background: var(--red); color: #fff; }
.btn-outline { background: transparent; color: var(--text-muted); border: 1px solid var(--border-light); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 10px 16px; font-size: 13px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-link { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-muted); }
.auth-link a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* ===== DASHBOARD HEADER ===== */
.dash-header {
  background: rgba(10, 22, 16, 0.7); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border); padding: 0 24px; height: 70px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.dash-brand { font-family: 'Playfair Display', serif; font-weight: 900; font-size: 24px; background: linear-gradient(135deg, var(--green-light), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.dash-user { display: flex; align-items: center; gap: 16px; position: relative; }

.btn-icon { background: rgba(0,0,0,0.3); border: 1px solid var(--border); width: 40px; height: 40px; border-radius: 12px; color: var(--text); cursor: pointer; position: relative; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.btn-icon:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.notif-dot { position: absolute; top: 8px; right: 8px; width: 10px; height: 10px; background: var(--red-light); border-radius: 50%; border: 2px solid var(--bg2); }
.notif-panel { position: absolute; top: 55px; right: 0; width: 320px; border-radius: var(--radius); z-index: 200; max-height: 400px; overflow-y: auto; }
.notif-header { padding: 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 14px; color: var(--accent); }
.notif-item { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.notif-item:last-child { border-bottom: none; }
.notif-item .text { flex: 1; color: var(--text); }
.notif-item .time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.user-profile-mini { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,0.3); padding: 4px 14px 4px 4px; border-radius: 20px; border: 1px solid var(--border); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid var(--accent); }
.user-profile-mini span { font-size: 13px; font-weight: 600; color: var(--text); }

.dash-content { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* ===== STATS GRID (PREMIUM) ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 24px; }
.stat-card {
  border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 12px;
  transition: all 0.3s ease; position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: 0; transition: 0.3s;
}
.stat-card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: 0 15px 30px rgba(0,0,0,0.3); }
.stat-card:hover::before { opacity: 1; }
.stat-card .stat-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.stat-card .stat-icon.green { background: rgba(39,174,96,0.15); color: var(--green-light); }
.stat-card .stat-icon.gold { background: var(--accent-dim); color: var(--accent); }
.stat-card .stat-icon.red { background: rgba(231,76,60,0.15); color: var(--red-light); }
.stat-card .stat-icon.blue { background: rgba(41,128,185,0.15); color: var(--blue); }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .stat-value { font-size: 24px; font-weight: 700; color: var(--text); }

/* KARTU PULANGAN SETERUSNYA (BANNER MENONJOL) */
.next-return-card {
  grid-column: span 2; background: linear-gradient(135deg, #1a8c4e 0%, #0a3d20 100%);
  border: 1px solid var(--green-light); color: white; display: flex; flex-direction: row; align-items: center; justify-content: space-between;
}
.next-return-card:hover { border-color: var(--accent); }
.next-return-card .stat-icon { background: rgba(255,255,255,0.2); color: #fff; width: 56px; height: 56px; font-size: 24px; }
.next-return-card .stat-label { color: rgba(255,255,255,0.8); }
.next-return-card .stat-value { color: #fff; font-size: 24px; }
.next-return-card .days-left { margin-top: 8px; font-size: 12px; background: rgba(0,0,0,0.3); padding: 6px 14px; border-radius: 12px; display: inline-block; width: fit-content; font-weight: 600; }

/* ===== CARDS & SECTIONS ===== */
.card { border-radius: var(--radius); margin-bottom: 24px; overflow: hidden; }
.card-header { padding: 18px 24px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,0.2); }
.card-header i { color: var(--accent); }
.card-body { padding: 24px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin: 28px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { background: rgba(0,0,0,0.3); color: var(--text-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: rgba(26,140,78,0.05); }
.empty-row td { text-align: center; color: var(--text-muted); padding: 40px; font-style: italic; }

.badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-success { background: rgba(39,174,96,0.15); color: var(--green-light); }
.badge-danger { background: rgba(231,76,60,0.15); color: var(--red-light); }
.badge-warning { background: rgba(230,126,34,0.15); color: var(--orange); }
.badge-info { background: rgba(41,128,185,0.15); color: var(--blue); }

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; background: var(--card-solid); border: 1px solid var(--border); border-radius: 12px; padding: 6px; margin-bottom: 24px; overflow-x: auto; }
.tab-btn { padding: 10px 18px; border: none; background: transparent; color: var(--text-muted); font-size: 13px; font-weight: 600; border-radius: 8px; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.tab-btn.active { background: linear-gradient(135deg, var(--green), var(--green-light)); color: #fff; box-shadow: 0 4px 10px rgba(39,174,96,0.2); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.4s ease; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }

/* ===== CHART CONTAINER ===== */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.chart-container { position: relative; width: 100%; height: 300px; background: rgba(0,0,0,0.2); padding: 16px; border-radius: 12px; border: 1px solid var(--border); }

/* ===== MODAL ===== */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 200; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(8px); }
.modal-overlay.active { display: flex; }
.modal-box { border-radius: var(--radius-lg); padding: 32px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.modal-box h3 { font-family: 'Playfair Display', serif; font-size: 22px; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ===== TOAST ===== */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 16px 20px; border-radius: 12px; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px; box-shadow: 0 8px 30px rgba(0,0,0,0.4); transform: translateX(120%); transition: transform 0.3s ease; min-width: 280px; max-width: 420px; backdrop-filter: blur(10px); }
.toast.show { transform: translateX(0); }
.toast-success { background: rgba(26, 61, 40, 0.9); border: 1px solid var(--green); color: var(--green-light); }
.toast-error { background: rgba(61, 26, 26, 0.9); border: 1px solid var(--red); color: var(--red-light); }
.toast-info { background: rgba(26, 42, 61, 0.9); border: 1px solid var(--blue); color: #5dade2; }

.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.2); border-top-color: currentColor; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.file-input-wrap { position: relative; display: flex; align-items: center; gap: 12px; }
.file-input-wrap input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-input-label { padding: 10px 18px; background: rgba(0,0,0,0.3); border: 1px dashed var(--border-light); border-radius: 8px; font-size: 13px; color: var(--text-muted); pointer-events: none; }
.file-name { font-size: 13px; color: var(--green-light); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .chart-grid { grid-template-columns: 1fr; }
  .next-return-card { grid-column: span 1; flex-direction: column; align-items: flex-start; gap: 12px; }
}
@media (max-width: 640px) {
  .dash-header { padding: 0 16px; }
  .dash-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .user-profile-mini span { display: none; }
  .telegram-fab { width: 50px; height: 50px; font-size: 22px; bottom: 20px; right: 20px; }
}
@media (max-width: 400px) { .stats-grid { grid-template-columns: 1fr; } }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.download-link { color: var(--accent); text-decoration: none; font-size: 13px; font-weight: 600; }
.download-link:hover { text-decoration: underline; }