/* ============================================================
   WIFI ZONE PAY — Dashboard CSS Global
   ============================================================ */

:root {
  --bg:        #F0F4FA;
  --card:      #FFFFFF;
  --border:    #E4EAF2;
  --text:      #0D1B2A;
  --muted:     #8A97A8;
  --sub:       #4A5568;
  --green:     #00B87A;
  --green-d:   #008F5E;
  --green-bg:  #E6F8F2;
  --yellow:    #F59E0B;
  --yellow-bg: #FFFBEB;
  --red:       #EF4444;
  --red-bg:    #FEF2F2;
  --grey:      #6B7280;
  --grey-bg:   #F9FAFB;
  --sidebar-w: 240px;
  --radius:    14px;
  --shadow:    0 2px 12px rgba(13,27,42,.07);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Layout ── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--text);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo .name {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .3px;
}
.sidebar-logo .sub {
  font-size: 11px;
  color: rgba(255,255,255,.45);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: rgba(255,255,255,.65);
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover    { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active   { background: var(--green); color: #fff; }
.nav-item .icon    { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-bottom {
  padding: 14px 10px;
  border-top: 1px solid rgba(255,255,255,.1);
}

/* ── Main ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 17px; font-weight: 900; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.content { padding: 28px; }

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 14px; font-weight: 800; }
.card-body { padding: 20px; }

/* ── Stat cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.stat-card .icon-box {
  width: 40px; height: 40px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 10px;
}
.stat-card .label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 4px;
}
.stat-card .value {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}
.stat-card .sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge-green  { background: var(--green-bg);  color: var(--green-d); }
.badge-yellow { background: var(--yellow-bg); color: #92400E; }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-grey   { background: var(--grey-bg);   color: var(--grey); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  text-decoration: none;
}
.btn:hover   { opacity: .88; }
.btn:active  { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--green), var(--green-d)); color: #fff; }
.btn-secondary { background: var(--bg); border: 1px solid var(--border); color: var(--sub); }
.btn-red     { background: var(--red-bg); color: var(--red); }
.btn-sm      { padding: 5px 11px; font-size: 11px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  padding: 10px 16px;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  text-align: left;
}
tbody td {
  padding: 13px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:hover { background: #FAFBFD; }
tbody tr:last-child td { border-bottom: none; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 7px;
}
.form-input, .form-select {
  width: 100%;
  height: 44px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 500;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus {
  border-color: var(--green);
  background: #fff;
}

/* ── Search bar ── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.search-input {
  flex: 1;
  height: 40px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 0 12px;
  font-size: 13px;
  background: var(--card);
  outline: none;
}
.search-input:focus { border-color: var(--green); }

/* ── Bar chart ── */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 110px;
  padding: 0 4px;
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.bar-val { font-size: 9px; color: var(--muted); font-weight: 700; }
.bar-fill {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: var(--border);
  transition: height .5s;
  min-height: 4px;
}
.bar-fill.last { background: var(--green); }
.bar-lbl { font-size: 9px; color: var(--muted); font-weight: 600; }

/* ── Progress bars ── */
.progress-row { margin-bottom: 14px; }
.progress-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--sub);
}
.progress-track {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .5s;
}

/* ── Plan selector ── */
.plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.plan-card {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.plan-card.selected {
  border-color: var(--green);
  background: var(--green-bg);
}
.plan-card .plan-price {
  font-size: 14px; font-weight: 900;
}
.plan-card.selected .plan-price { color: var(--green-d); }
.plan-card .plan-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── Code result ── */
.code-box {
  background: var(--green-bg);
  border: 1px solid var(--green);
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
}
.code-display {
  background: #fff;
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  margin-bottom: 10px;
}
.code-display .code-text {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 3px;
  font-family: monospace;
}
.code-display .code-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
.sms-preview {
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--text);
  margin-top: 8px;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  z-index: 9999;
  animation: slideUp .25s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--card);
  border-radius: 16px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 15px; font-weight: 800; }
.modal-body    { padding: 22px; }
.modal-footer  { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

.close-btn {
  background: none; border: none; font-size: 20px;
  cursor: pointer; color: var(--muted); line-height: 1;
}

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--text);
}
.login-box {
  background: var(--card);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo {
  text-align: center;
  margin-bottom: 30px;
}
.login-logo .logo-icon {
  font-size: 42px;
  display: block;
  margin-bottom: 8px;
}
.login-logo h1 {
  font-size: 22px;
  font-weight: 900;
}
.login-logo p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
}
.page-btn {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--sub);
  transition: background .15s;
}
.page-btn:hover   { background: var(--bg); }
.page-btn.active  { background: var(--green); border-color: var(--green); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Responsive ── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 16px; }
}

/* ── Loader ── */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--muted);
  font-size: 14px;
  gap: 10px;
}
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ── */
.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
}
.empty-state .empty-icon { font-size: 36px; margin-bottom: 12px; }
.empty-state h4 { font-size: 14px; font-weight: 700; margin-bottom: 6px; color: var(--sub); }
.empty-state p  { font-size: 12px; }

/* ── Info row (detail panel) ── */
.info-block {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.info-block .info-title { font-weight: 800; font-size: 14px; margin-bottom: 4px; }
.info-block .info-row   { font-size: 12px; color: var(--sub); margin-top: 2px; }
