/* 
   KingTV Admin Panel - Professional Theme 
   Modern Dark UI with Glassmorphism & Premium Feel
*/

:root {
  /* Color Palette */
  --bg-body: #0a0c10;
  --bg-sidebar: #0f1215;
  --bg-card: #14171c;
  --bg-input: #1b1e24;

  --primary-color: #e50914; /* Netflix Red-ish but more vibrant */
  --primary-hover: #b80710;
  --primary-glow: rgba(229, 9, 20, 0.4);

  --text-main: #ffffff;
  --text-muted: #a0a0a0;
  --divider: #25282e;

  --success: #28c76f;
  --warning: #ff9f43;
  --danger: #ea5455;
  --info: #00cfe8;

  /* Spacing & Radius */
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;

  /* Effects */
  --glass-bg: rgba(20, 23, 28, 0.7);
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);
  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.2);
  --transition: all 0.3s ease;
}

/* Global Reset & Typography */
* {
  box-sizing: border-box;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--text-main) !important;
}

.stat-val {
    color: var(--text-main) !important;
}

body {
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family:
    "Inter",
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  min-height: 100vh;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #555;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}
ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Utilities */
.text-primary {
  color: var(--primary-color) !important;
}
.text-muted {
  color: var(--text-muted) !important;
}
.bg-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: var(--glass-border);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease forwards;
}

/* ------------------------
   COMPONENT: BUTTONS
------------------------ */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--primary-glow);
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-muted);
}
.btn-outline:hover {
  border-color: var(--text-main);
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.btn-danger,
.btn-success,
.btn-info,
.btn-warning {
  border: none;
  color: white;
}
.btn-danger {
  background: #ea5455;
  color: white;
}
.btn-danger:hover {
  background: #c24041;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(234, 84, 85, 0.4);
}

.btn-success {
  background: #28c76f;
  color: white;
}
.btn-success:hover {
  background: #1f9d57;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 199, 111, 0.4);
}

.btn-info {
  background: #00cfe8;
  color: white;
}
.btn-info:hover {
  background: #00b2c7;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 207, 232, 0.4);
}

.btn-warning {
  background: #ff9f43;
  color: white;
}
.btn-warning:hover {
  background: #d98538;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 159, 67, 0.4);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* ------------------------
   COMPONENT: CARDS
------------------------ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid #1f232b;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  border-color: #2c323d;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid #1f232b;
  font-weight: 600;
  font-size: 16px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body {
  padding: 24px;
}

/* ------------------------
   COMPONENT: FORMS
------------------------ */
.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-control,
.form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: #ffffff !important; /* Force white text */
  font-size: 14px;
  transition: var(--transition);
  outline: none;
  color-scheme: dark; /* Fix date picker icon being black */
}

.form-control::placeholder {
  color: #6c757d;
  opacity: 1;
}

.form-control:focus,
.form-select:focus {
  background: #171a20;
  border-color: var(--primary-color);
  color: #ffffff !important; /* Keep white on focus */
  box-shadow: 0 0 0 4px rgba(229, 9, 20, 0.1);
}

.form-check-input {
  background-color: var(--bg-input);
  border-color: #333;
  cursor: pointer;
}
.form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}
/* Force Update Switch - specific override if needed or just use active state */
.form-check-input.force-update:checked {
    background-color: var(--danger);
    border-color: var(--danger);
}

/* ------------------------
   COMPONENT: TABLES
------------------------ */
.table-container {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text-main);
  /* Override Bootstrap defaults */
  --bs-table-color: var(--text-main);
  --bs-table-bg: transparent;
  --bs-table-border-color: #1f232b;
  --bs-table-hover-bg: rgba(255, 255, 255, 0.05);
  --bs-table-hover-color: var(--text-main);
}
.table th {
  text-align: left;
  padding: 16px 24px;
  color: #8898aa;
  font-weight: 600;
  font-size: 11px;
  border-bottom: 1px solid #1f232b;
  text-transform: uppercase;
  letter-spacing: 1px;
  background-color: #1a1d23 !important; /* Force darker header */
}
.table td {
  padding: 16px 24px;
  border-bottom: 1px solid #1f232b;
  font-size: 14px;
  color: #ffffff !important; /* Force white text */
  background-color: transparent !important; /* Fix white bg issue */
}
.table tr:last-child td {
  border-bottom: none;
}
.table tbody tr:hover td {
  background-color: rgba(255, 255, 255, 0.05) !important; /* Visible hover */
  color: #ffffff !important;
}

/* ------------------------
   LAYOUT: SIDEBAR
------------------------ */
.sidebar {
  width: 280px;
  height: 100vh;
  background: var(--bg-sidebar);
  position: fixed;
  top: 0;
  left: 0;
  border-right: 1px solid #1f232b;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: var(--transition);
}

.sidebar-header {
  height: 80px;
  display: flex;
  align-items: center;
  padding: 0 28px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: white;
}
.sidebar-header span {
  color: var(--primary-color);
  margin-left: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
}

.nav-category {
  padding: 0 28px;
  margin-top: 24px;
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #4b4f58;
  letter-spacing: 1.2px;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 14px 28px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}

.nav-link i {
  width: 24px;
  font-size: 16px;
  margin-right: 12px;
  transition: all 0.2s;
}

.nav-link:hover {
  color: white;
  background: rgba(255, 255, 255, 0.02);
}

.nav-link.active {
  color: white;
  background: linear-gradient(
    90deg,
    rgba(229, 9, 20, 0.1) 0%,
    transparent 100%
  );
  border-left-color: var(--primary-color);
}
.nav-link.active i {
  color: var(--primary-color);
}

/* ------------------------
   LAYOUT: MAIN CONTENT
------------------------ */
.main-content {
  margin-left: 280px;
  padding: 40px;
  min-height: 100vh;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
  animation: slideInLeft 0.5s ease;
}
.page-title {
  font-size: 26px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.5px;
}

/* ------------------------
   PAGE: DASHBOARD
------------------------ */
.stat-card {
  display: flex;
  align-items: center;
  gap: 20px;
}
.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.stat-val {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 4px;
}
.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ------------------------
   PAGE: LOGIN
------------------------ */
.login-page {
  background: radial-gradient(circle at center, #1a1e26 0%, #0a0c10 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.login-card {
  background: #14171c;
  border: 1px solid #1f232b;
  border-radius: 20px;
  padding: 48px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.login-logo {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 10px;
  letter-spacing: -1px;
}
.login-logo span {
  color: var(--primary-color);
}
.login-subtitle {
  color: var(--text-muted);
  margin-bottom: 40px;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.active {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    padding: 20px;
  }
  .nav-burger {
    display: block;
  }
}

/* Mobile Nav Bar */
.mobile-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-sidebar);
  border-bottom: 1px solid #1f232b;
  position: sticky;
  top: 0;
  z-index: 999;
  padding-right: 15px;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 998;
  display: none;
  opacity: 0;
  transition: var(--transition);
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

@media (max-width: 768px) {
  .main-content {
    padding-top: 20px;
  }
}
