/* JoPLAYER Master Control Hub - Enterprise SaaS Clean Dark Theme */
:root {
  --bg-base: #0a0d14;
  --bg-surface: #101522;
  --bg-card: rgba(18, 24, 38, 0.7);
  --bg-card-hover: rgba(26, 35, 54, 0.85);
  --bg-glass: rgba(16, 21, 34, 0.75);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-focus: #00d2ff;
  
  --primary: #00d2ff;
  --primary-glow: rgba(0, 210, 255, 0.25);
  --primary-gradient: linear-gradient(135deg, #00d2ff 0%, #0088ff 100%);
  
  --accent: #7928ca;
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info: #38bdf8;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(0, 210, 255, 0.03) 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(121, 40, 202, 0.03) 0%, transparent 40%);
  background-attachment: fixed;
  overflow-x: hidden;
  font-size: 14px;
}

body[dir="rtl"] { direction: rtl; text-align: right; }
body[dir="ltr"] { direction: ltr; text-align: left; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #334155; }

/* Colors */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }
.text-muted { color: var(--text-muted); }

/* Typography */
h1, h2, h3, h4 { font-weight: 700; color: #fff; letter-spacing: -0.02em; }

/* Top Header */
.top-header {
  background: rgba(10, 13, 20, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 24px;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid rgba(0, 210, 255, 0.3);
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-accent {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* SQL Security Key Indicator */
.security-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--success);
  font-weight: 600;
}

.sec-dot {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success);
}

/* Balance Widget */
.balance-widget {
  background: rgba(0, 210, 255, 0.08);
  border: 1px solid rgba(0, 210, 255, 0.25);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
}

.balance-content {
  display: flex;
  flex-direction: column;
}

.balance-title {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.balance-amount {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
}

/* User Pill */
.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #1e293b;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
}

.user-role-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.user-role-badge.role-admin {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.user-role-badge.role-reseller {
  background: rgba(0, 210, 255, 0.15);
  color: var(--primary);
  border: 1px solid rgba(0, 210, 255, 0.3);
}

/* Nav Tabs Bar */
.nav-tabs-bar {
  background: rgba(13, 17, 28, 0.7);
  border-bottom: 1px solid var(--border-glass);
  padding: 0 24px;
}

.nav-tabs-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 14px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: #fff;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(0, 210, 255, 0.03);
}

/* Main Container */
.main-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  width: 100%;
  flex: 1;
}

.tab-content {
  display: none;
}

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

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

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

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

.stat-header {
  margin-bottom: 8px;
}

.stat-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.stat-subtext {
  font-size: 0.74rem;
  color: var(--text-dim);
}

/* Glass Panel */
.glass-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 3px;
}

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

/* Table Filter Group */
.table-filter-group {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.03);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
}

.btn-filter {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-filter.active {
  background: #1e293b;
  color: #fff;
}

/* Custom Table */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: inherit;
  font-size: 0.85rem;
}

.custom-table th {
  background: rgba(255, 255, 255, 0.02);
  padding: 12px 16px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  border-bottom: 1px solid var(--border-glass);
  white-space: nowrap;
}

.custom-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-glass);
  vertical-align: middle;
}

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

/* Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.badge-active {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-expired {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-used {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.code-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(0, 210, 255, 0.08);
  border: 1px solid rgba(0, 210, 255, 0.2);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.code-badge:hover {
  background: rgba(0, 210, 255, 0.18);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: #07090e;
}

.btn-primary:hover {
  background: #38bdf8;
  box-shadow: 0 0 14px var(--primary-glow);
}

.btn-secondary {
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
  background: #334155;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-danger-outline {
  background: transparent;
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.12);
}

.btn-success {
  background: var(--success);
  color: #07090e;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-hint {
  display: block;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.form-input, .form-select {
  width: 100%;
  background: #0d111c;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fff;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-input-sm {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.form-input:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(0, 210, 255, 0.15);
}

/* Plans Grid (Generate Code) */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.plan-card {
  background: #0d111c;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.plan-card:hover {
  border-color: rgba(0, 210, 255, 0.4);
}

.plan-card.selected {
  border-color: var(--primary);
  background: rgba(0, 210, 255, 0.05);
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.15);
}

.plan-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 210, 255, 0.15);
  color: var(--primary);
  font-weight: 700;
}

body[dir="rtl"] .plan-badge {
  left: auto;
  right: 10px;
}

.plan-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  margin-top: 14px;
  margin-bottom: 4px;
}

.plan-duration {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.plan-cost {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--success);
}

/* Summary Box */
.summary-box {
  background: #070a12;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.summary-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.summary-val {
  font-size: 1.3rem;
  font-weight: 800;
}

/* Re-Branding Grid */
.branding-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .branding-grid { grid-template-columns: 1fr; }
}

.color-swatches {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.color-swatch-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.color-swatch-btn.selected {
  border-color: #fff;
  transform: scale(1.1);
}

/* Mockup Container */
.mockup-container {
  background: #05070c;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.mockup-window-bar {
  background: #0d111c;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass);
}

.mockup-window-dots {
  display: flex;
  gap: 5px;
}

.mockup-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.mockup-dot-red { background: #ef4444; }
.mockup-dot-yellow { background: #f59e0b; }
.mockup-dot-green { background: #10b981; }

.mockup-window-title {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.mockup-active-tag {
  font-size: 0.65rem;
  color: var(--success);
  font-weight: 700;
}

.mockup-app-body {
  display: flex;
  height: 280px;
}

.mockup-sidebar {
  width: 140px;
  background: #0a0e18;
  border-inline-end: 1px solid var(--border-glass);
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.mockup-brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--primary);
  background: rgba(0, 210, 255, 0.05);
  margin-bottom: 16px;
}

.mockup-logo-img {
  width: 22px;
  height: 22px;
  border-radius: 4px;
}

.mockup-brand-text {
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.mockup-joplayer-label { color: #fff; }
.mockup-cross-symbol { font-size: 0.65rem; color: var(--text-dim); }
.mockup-provider-label { color: var(--primary); }

.mockup-menu-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mockup-menu-item {
  padding: 6px 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-radius: 4px;
}

.mockup-menu-item.active {
  background: #1e293b;
  color: #fff;
  font-weight: 600;
}

.mockup-main {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.mockup-hero-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.mockup-hero-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.mockup-welcome-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--primary);
}

/* Emergency Kill Switch Box */
.emergency-box {
  background: #0f1524;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}

.emergency-title {
  font-size: 1rem;
  color: #fff;
  margin-bottom: 2px;
}

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

/* Auth View */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  margin-bottom: 12px;
  border: 1.5px solid rgba(0, 210, 255, 0.3);
}

.auth-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.auth-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-glass);
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: center;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

body[dir="rtl"] .modal-close-btn {
  left: auto;
  right: 16px;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.modal-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body[dir="rtl"] .toast-container {
  left: auto;
  right: 24px;
}

.toast {
  background: #1e293b;
  border: 1px solid var(--border-glass);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.3s ease;
}

.toast-success {
  border-color: rgba(16, 185, 129, 0.4);
  background: #0f241d;
  color: #10b981;
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.4);
  background: #2b1114;
  color: #ef4444;
}

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