/* ====================================================
   NOKOS OTP PANEL — Main Stylesheet
   Clean White Modern Design
   ==================================================== */

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

:root {
  --primary:       #2563eb;
  --primary-light: #eff6ff;
  --primary-dark:  #1d4ed8;
  --success:       #16a34a;
  --success-light: #f0fdf4;
  --danger:        #dc2626;
  --danger-light:  #fef2f2;
  --warning:       #d97706;
  --warning-light: #fffbeb;
  --purple:        #7c3aed;
  --purple-light:  #f5f3ff;
  --orange:        #ea580c;
  --orange-light:  #fff7ed;

  --bg:        #f8fafc;
  --surface:   #ffffff;
  --border:    #e2e8f0;
  --border-hover: #cbd5e1;

  --text:      #0f172a;
  --text-sec:  #475569;
  --text-muted:#94a3b8;

  --nav-h:     64px;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.05);
}

html { scroll-behavior: smooth; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; min-height: 100vh; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ====================================================
   NAVBAR
   ==================================================== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; gap: 16px;
}

.navbar-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.navbar-icon { width: 36px; height: 36px; background: var(--primary); color: #fff; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.navbar-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; }
.navbar-name { font-weight: 700; font-size: 15px; color: var(--text); }

.navbar-links { display: flex; align-items: center; gap: 4px; }
.nav-link { display: flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: var(--radius-sm); color: var(--text-sec); font-weight: 500; transition: all .15s; font-size: 13.5px; text-decoration: none; }
.nav-link:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.nav-link.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

.navbar-user { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.user-badge { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 500; }
.badge-admin { background: #fef3c7; color: #92400e; }
.badge-user  { background: var(--primary-light); color: var(--primary-dark); }

.btn-logout { background: none; border: 1px solid var(--border); color: var(--text-sec); padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; transition: all .15s; }
.btn-logout:hover { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }

/* ====================================================
   MAIN CONTENT
   ==================================================== */
.main-content { padding: calc(var(--nav-h) + 28px) 28px 40px; max-width: 1400px; margin: 0 auto; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 28px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--text); }
.page-subtitle { color: var(--text-sec); font-size: 13.5px; margin-top: 3px; }

/* ====================================================
   ALERTS
   ==================================================== */
.alert { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 13.5px; font-weight: 500; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #bbf7d0; }
.alert-error   { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }

/* ====================================================
   CARDS
   ==================================================== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.link-more { font-size: 12.5px; color: var(--primary); font-weight: 500; }

/* ====================================================
   STATS
   ==================================================== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow); transition: box-shadow .2s; }
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.icon-blue   { background: var(--primary-light); color: var(--primary); }
.icon-green  { background: var(--success-light); color: var(--success); }
.icon-purple { background: var(--purple-light); color: var(--purple); }
.icon-orange { background: var(--orange-light); color: var(--orange); }
.stat-label  { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }
.stat-value  { font-size: 22px; font-weight: 700; color: var(--text); margin-top: 2px; }

/* ====================================================
   DASHBOARD GRID
   ==================================================== */
.dashboard-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }
.card-wide { grid-column: 1; }
@media (max-width: 1100px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* ====================================================
   TABLE
   ==================================================== */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { background: #f8fafc; padding: 11px 16px; text-align: left; font-weight: 600; color: var(--text-sec); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }
.empty-row { text-align: center; padding: 40px !important; color: var(--text-muted); font-size: 14px; }

.code-sm  { font-family: 'SF Mono', Monaco, monospace; font-size: 12px; background: #f1f5f9; padding: 2px 6px; border-radius: 4px; color: var(--text-sec); }
.code-otp { font-family: 'SF Mono', Monaco, monospace; font-size: 13px; background: #ecfdf5; color: #059669; padding: 3px 8px; border-radius: 5px; font-weight: 700; letter-spacing: 1px; }
.phone-cell { font-family: 'SF Mono', Monaco, monospace; font-size: 12.5px; color: var(--text-sec); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }

/* ====================================================
   BADGES
   ==================================================== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger   { background: var(--danger-light); color: var(--danger); }
.badge-warning  { background: var(--warning-light); color: var(--warning); }
.badge-info     { background: var(--primary-light); color: var(--primary); }
.badge-admin    { background: #fef3c7; color: #92400e; }

/* ====================================================
   TOP SERVICES
   ==================================================== */
.top-services { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.service-row { display: flex; align-items: center; gap: 12px; }
.service-rank { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.rank-1 { background: #fef3c7; color: #92400e; }
.rank-2 { background: #f1f5f9; color: #475569; }
.rank-3 { background: #fff7ed; color: #ea580c; }
.rank-4, .rank-5 { background: #f8fafc; color: #94a3b8; }
.service-info { flex: 1; min-width: 0; }
.service-name { font-size: 13px; font-weight: 500; display: block; margin-bottom: 4px; }
.service-bar-wrap { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.service-bar { height: 100%; background: var(--primary); border-radius: 2px; transition: width .6s ease; }
.service-count { font-size: 13px; font-weight: 600; color: var(--text-sec); flex-shrink: 0; }
.empty-text { text-align: center; color: var(--text-muted); padding: 32px; font-size: 13px; }

/* ====================================================
   BOT STATUS
   ==================================================== */
.bot-status-wrap { display: flex; align-items: center; gap: 8px; }
.bot-status-dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-green { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.dot-red   { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.2); }
.dot-yellow { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.2); }
.bot-status-label { font-size: 13px; font-weight: 500; color: var(--text-sec); }

/* ====================================================
   FILTER TABS
   ==================================================== */
.filter-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-tab { display: flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text-sec); font-size: 13px; font-weight: 500; cursor: pointer; transition: all .15s; }
.filter-tab:hover { border-color: var(--primary); color: var(--primary); }
.filter-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; }

.search-wrap { display: flex; align-items: center; }
.search-input { width: 260px; padding: 9px 14px; }

/* ====================================================
   FORMS
   ==================================================== */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.label-required { color: var(--danger); }
.form-input { width: 100%; padding: 9px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13.5px; color: var(--text); background: var(--surface); transition: border-color .15s, box-shadow .15s; font-family: inherit; }
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.input-wrapper { position: relative; }
.input-wrapper .form-input { padding-right: 42px; }
.toggle-pw { position: absolute; right: 1px; top: 1px; bottom: 1px; padding: 0 12px; background: none; border: none; cursor: pointer; color: var(--text-muted); border-left: 1px solid var(--border); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; transition: color .15s; }
.toggle-pw:hover { color: var(--primary); }

/* ====================================================
   BUTTONS
   ==================================================== */
.btn-primary { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s; font-family: inherit; text-decoration: none; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn-full { width: 100%; justify-content: center; padding: 12px; }

.btn-sm { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 500; cursor: pointer; transition: all .15s; font-family: inherit; border: 1px solid transparent; }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text-sec); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-danger { background: var(--danger-light); color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: var(--danger); color: #fff; }

/* ====================================================
   SETTINGS
   ==================================================== */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; margin-bottom: 24px; }
.settings-card .settings-body { padding: 20px; }
.settings-action { text-align: right; }
.logo-preview { margin-top: 12px; }
.logo-preview-img { max-height: 60px; border-radius: 8px; border: 1px solid var(--border); padding: 4px; }

/* ====================================================
   USERS
   ==================================================== */
.user-row { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 30px; height: 30px; background: var(--primary-light); color: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }

/* ====================================================
   AUTH PAGES
   ==================================================== */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(135deg, #f0f7ff 0%, #fafafa 50%, #f5f0ff 100%); }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 40px; width: 100%; max-width: 420px; }
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-logo { width: 64px; height: 64px; background: var(--primary); color: #fff; border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 28px; margin: 0 auto 16px; }
.auth-title { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.auth-subtitle { color: var(--text-sec); font-size: 13.5px; }
.auth-form { display: flex; flex-direction: column; gap: 0; }
.auth-footer { text-align: center; margin-top: 24px; font-size: 13.5px; color: var(--text-sec); }

/* ====================================================
   ERROR PAGE
   ==================================================== */
.error-page { text-align: center; padding: 80px 24px; }
.error-icon { font-size: 64px; color: var(--warning); margin-bottom: 20px; }
.error-title { font-size: 24px; font-weight: 700; margin-bottom: 12px; }
.error-msg { color: var(--text-sec); margin-bottom: 28px; }

/* ====================================================
   RESPONSIVE
   ==================================================== */
@media (max-width: 768px) {
  .navbar-links { display: none; }
  .main-content { padding: calc(var(--nav-h) + 20px) 16px 32px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .search-input { width: 100%; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
}

/* ====================================================
   NAV SALDO
   ==================================================== */
.nav-saldo {
  display: flex; align-items: center; gap: 6px;
  background: #f0fdf4; color: #16a34a;
  padding: 6px 12px; border-radius: 20px;
  font-size: 13px; font-weight: 600;
  border: 1px solid #bbf7d0;
}

/* ====================================================
   HAMBURGER & MOBILE DRAWER
   ==================================================== */
.hamburger {
  display: none;
  background: none; border: 1px solid var(--border);
  color: var(--text-sec); padding: 8px 10px;
  border-radius: var(--radius-sm); cursor: pointer;
  font-size: 16px; transition: all .15s;
}
.hamburger:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

.mobile-drawer {
  position: fixed; top: 0; left: -280px; width: 280px; height: 100vh;
  background: var(--surface); border-right: 1px solid var(--border);
  box-shadow: var(--shadow-lg); z-index: 999;
  transition: left .25s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.mobile-drawer.open { left: 0; }

.drawer-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 998;
}
.drawer-overlay.open { display: block; }

.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.drawer-title { font-weight: 700; font-size: 15px; }
.drawer-close {
  background: none; border: none; font-size: 18px;
  color: var(--text-sec); cursor: pointer; padding: 4px 8px;
  border-radius: 6px;
}
.drawer-close:hover { background: var(--danger-light); color: var(--danger); }

.drawer-user {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; background: var(--primary-light);
  border-bottom: 1px solid var(--border);
}
.drawer-avatar {
  width: 38px; height: 38px; background: var(--primary);
  color: #fff; border-radius: 50%; display: flex;
  align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.drawer-username { font-weight: 600; font-size: 14px; }
.drawer-role { font-size: 12px; color: var(--text-muted); text-transform: capitalize; }
.drawer-saldo {
  margin-left: auto; background: #f0fdf4; color: #16a34a;
  padding: 4px 10px; border-radius: 12px; font-size: 12px;
  font-weight: 600; border: 1px solid #bbf7d0; white-space: nowrap;
}

.drawer-links { padding: 12px 0; flex: 1; overflow-y: auto; }
.drawer-link {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 20px; color: var(--text-sec); font-size: 14px;
  font-weight: 500; text-decoration: none;
  transition: all .15s; border-left: 3px solid transparent;
  width: 100%; background: none; border-top: none; border-right: none; border-bottom: none;
  cursor: pointer; font-family: inherit;
}
.drawer-link:hover { background: var(--primary-light); color: var(--primary); border-left-color: var(--primary); text-decoration: none; }
.drawer-link.active { background: var(--primary-light); color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.drawer-logout { color: var(--danger) !important; }
.drawer-logout:hover { background: var(--danger-light) !important; border-left-color: var(--danger) !important; }

@media (max-width: 768px) {
  .hamburger { display: flex; }
  .navbar-links { display: none !important; }
  .nav-saldo { display: none; }
}

/* ====================================================
   TOPBAR (minimal header)
   ==================================================== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; gap: 12px;
}
.topbar-brand { display: flex; align-items: center; gap: 9px; }
.topbar-icon { width: 32px; height: 32px; background: var(--primary); color: #fff; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.topbar-logo { width: 32px; height: 32px; object-fit: contain; border-radius: 8px; }
.topbar-name { font-weight: 700; font-size: 14px; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 8px; }

/* ====================================================
   BOTTOM NAVIGATION BAR
   ==================================================== */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: 62px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(0,0,0,.07);
  display: flex; align-items: stretch;
}
.bn-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  color: var(--text-muted); font-size: 11px; font-weight: 500;
  text-decoration: none; transition: all .15s;
  padding: 6px 4px; border-top: 2px solid transparent;
  position: relative;
}
.bn-item i { font-size: 20px; transition: all .15s; }
.bn-item:hover { color: var(--primary); text-decoration: none; }
.bn-item.active { color: var(--primary); border-top-color: var(--primary); }
.bn-item.active i { transform: translateY(-2px); }

/* Override main-content padding for new layout */
.main-content {
  padding-top: calc(56px + 20px) !important;
  padding-bottom: calc(62px + 20px) !important;
}
