/* ==========================================================================
   KaynanamTV — Ultra-Modern Web Admin Dashboard Design System
   Dark Neon Glassmorphism Theme (2026 Edition)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Color Tokens */
  --bg-main: #0b0f19;
  --bg-surface: #111827;
  --bg-card: rgba(31, 41, 55, 0.7);
  --bg-card-hover: rgba(55, 65, 81, 0.85);
  --bg-glass: rgba(17, 24, 39, 0.75);
  --bg-glass-modal: rgba(15, 23, 42, 0.95);
  
  --border-subtle: rgba(75, 85, 99, 0.35);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;

  --clr-brand: #6366f1;
  --clr-brand-glow: rgba(99, 102, 241, 0.4);
  --clr-cyan: #06b6d4;
  --clr-cyan-light: #38bdf8;
  --clr-green: #10b981;
  --clr-green-glow: rgba(16, 185, 129, 0.3);
  --clr-gold: #f59e0b;
  --clr-gold-glow: rgba(245, 158, 11, 0.3);
  --clr-red: #ef4444;
  --clr-red-glow: rgba(239, 68, 68, 0.3);
  --clr-purple: #a855f7;

  --txt-primary: #f9fafb;
  --txt-secondary: #9ca3af;
  --txt-muted: #6b7280;

  --sidebar-w: 260px;
  --header-h: 70px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.08) 0%, transparent 45%);
  background-attachment: fixed;
  color: var(--txt-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #374151;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #4b5563;
}

/* App Layout */
.app-container {
  display: flex;
  width: 100vw;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  transition: var(--transition-smooth);
}

.sidebar-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-glass);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--clr-brand), var(--clr-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 14px var(--clr-brand-glow);
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, var(--clr-cyan-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-info span {
  font-size: 0.72rem;
  color: var(--txt-muted);
  font-weight: 500;
}

.nav-list {
  list-style: none;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--txt-secondary);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  text-decoration: none;
}

.nav-item:hover {
  color: var(--txt-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.25), rgba(99, 102, 241, 0.05));
  border-left: 3px solid var(--clr-brand);
}

.nav-icon {
  font-size: 1.25rem;
}

.nav-badge {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--clr-red);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--clr-red-glow);
}

.sidebar-footer {
  padding: 18px 20px;
  border-top: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.connection-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--clr-green);
  font-weight: 600;
  padding: 6px 12px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 20px;
}

.connection-pill.disconnected {
  color: var(--clr-red);
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Main Content Area */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top Header */
.top-header {
  height: var(--header-h);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-title h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.header-title p {
  font-size: 0.82rem;
  color: var(--txt-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Content Container */
.content-area {
  padding: 32px;
  flex: 1;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stats Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-accent, var(--clr-brand));
  opacity: 0.8;
}

.stat-card:hover {
  transform: translateY(-3px);
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-info h3 {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 4px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--card-accent, var(--txt-primary));
}

.stat-info p {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--txt-secondary);
}

.stat-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-smooth);
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--clr-brand), #4338ca);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--clr-brand-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7c3aed, var(--clr-brand));
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--clr-brand-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-glass);
  color: var(--txt-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.btn-danger:hover {
  background: var(--clr-red);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--clr-red-glow);
}

.btn-success {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}

.btn-success:hover {
  background: var(--clr-green);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--clr-green-glow);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* Section Cards */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-glass);
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* User Management Two-Column Layout */
.users-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1180px) {
  .users-layout {
    grid-template-columns: 1fr;
  }
}

/* Search & Filters Controls */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--txt-muted);
  font-size: 16px;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--txt-primary);
  font-size: 0.92rem;
  font-family: inherit;
  transition: var(--transition-smooth);
}

.search-input:focus {
  outline: none;
  border-color: var(--clr-brand);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  color: var(--txt-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.chip:hover {
  background: var(--bg-card-hover);
  color: #ffffff;
}

.chip.active {
  background: var(--clr-brand);
  border-color: var(--clr-brand);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--clr-brand-glow);
}

.sort-select {
  margin-left: auto;
  padding: 6px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--txt-primary);
  font-size: 0.8rem;
  font-weight: 500;
  outline: none;
}

/* User Card Items */
.user-cards-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 650px;
  overflow-y: auto;
  padding-right: 4px;
}

.user-card-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-card-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateX(3px);
}

.user-card-item.selected {
  background: #1f2937;
  border: 1.5px solid var(--clr-brand);
  box-shadow: var(--shadow-glow);
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-email-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
}

.user-ktv-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--clr-cyan-light);
  background: rgba(6, 182, 212, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
}

.card-bot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-gold {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-indigo {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.activity-text {
  font-size: 0.78rem;
  color: var(--txt-muted);
}

/* User Detail Drawer / Right Panel */
.user-detail-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: sticky;
  top: calc(var(--header-h) + 32px);
  box-shadow: var(--shadow-card);
}

.detail-header-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: 20px;
}

.avatar-circle {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.user-meta-table {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.meta-row span:first-child {
  color: var(--txt-secondary);
}

.meta-row span:last-child {
  font-weight: 600;
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
}

.actions-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Payments Table */
.data-table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--txt-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-glass);
}

.data-table td {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.88rem;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--txt-secondary);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--txt-primary);
  font-size: 0.92rem;
  font-family: inherit;
  transition: var(--transition-smooth);
}

.form-control:focus {
  outline: none;
  border-color: var(--clr-brand);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

textarea.form-control {
  resize: vertical;
  min-height: 120px;
}

/* Toggle Switch */
.switch-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #374151;
  transition: .3s;
  border-radius: 26px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--clr-red);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideInRight 0.3s ease;
  min-width: 280px;
}

.toast-success {
  border-left: 4px solid var(--clr-green);
}

.toast-error {
  border-left: 4px solid var(--clr-red);
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Modal Dialog */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-glass-modal);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-card);
  animation: modalScale 0.25s ease;
}

@keyframes modalScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ── Fullscreen Login Screen ── */
.login-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-main);
  background-image: 
    radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.2) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.15) 0%, transparent 45%);
  backdrop-filter: blur(20px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(99, 102, 241, 0.2);
  animation: modalScale 0.3s ease;
}

.login-brand {
  text-align: center;
  margin-bottom: 26px;
}

.login-brand .brand-icon {
  margin: 0 auto 12px;
  width: 52px;
  height: 52px;
  font-size: 26px;
}

.login-brand h2 {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(to right, #ffffff, var(--clr-cyan-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-brand p {
  font-size: 0.85rem;
  color: var(--txt-secondary);
  margin-top: 2px;
}

.login-error-msg {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 14px;
  text-align: center;
}
