/**
 * Supansha Admin Panel — Modern Custom Design System
 * Theme: Dark Mode with Supansha Orange (#f05a28) Accents
 */

:root {
  --bg-main: #0c0e12;
  --bg-surface: #14171d;
  --bg-card: #1a1e26;
  --bg-card-hover: #212630;
  --bg-input: #12151b;
  --border-color: #262c38;
  --border-focus: #f05a28;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  --bs-body-color: var(--text-primary);
  --bs-body-bg: var(--bg-main);

  --accent: #f05a28;
  --accent-hover: #d94819;
  --accent-light: rgba(240, 90, 40, 0.12);
  --accent-glow: rgba(240, 90, 40, 0.25);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.12);

  --sidebar-width: 270px;
  --header-height: 70px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--text-primary) !important;
}

.text-muted {
  color: var(--text-muted) !important;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}
a:hover {
  color: var(--accent-hover);
}

/* ════════════════════════════════════════════════
   SIDEBAR STYLES
════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}
.sidebar-brand-text strong {
  font-size: 1.15rem;
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.1;
}
.sidebar-brand-text small {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.sidebar-nav {
  padding: 1.25rem 1rem;
  flex: 1;
}

.nav-list {
  list-style: none;
}

.nav-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 1rem 0.75rem 0.4rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.7rem 0.85rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
}

.nav-link i {
  font-size: 1.05rem;
  width: 22px;
  text-align: center;
  color: var(--text-muted);
  transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
  background-color: var(--accent-light);
  color: #fff;
}
.nav-link:hover i, .nav-link.active i {
  color: var(--accent);
}

.has-submenu .submenu-arrow {
  font-size: 0.75rem;
  transition: transform 0.25s ease;
}
.has-submenu.open > a > .submenu-arrow {
  transform: rotate(90deg);
}

.submenu-list {
  list-style: none;
  padding-left: 1.8rem;
  margin-top: 2px;
  display: none;
}
.has-submenu.open > .submenu-list {
  display: block;
}
.submenu-list .nav-link {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
}

/* ════════════════════════════════════════════════
   MAIN WRAPPER & TOP NAVBAR
════════════════════════════════════════════════ */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--transition);
}

.top-navbar {
  height: var(--header-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.navbar-left, .navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.sidebar-toggle:hover {
  color: var(--accent);
  background: var(--accent-light);
}

.breadcrumb-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-search {
  position: relative;
  display: flex;
  align-items: center;
}
.nav-search input {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 0.45rem 1rem 0.45rem 2.2rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  width: 220px;
  transition: var(--transition);
}
.nav-search input:focus {
  outline: none;
  border-color: var(--accent);
  width: 280px;
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.nav-search i {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.nav-icon-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.nav-icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}
.user-info-text {
  text-align: left;
  display: flex;
  flex-direction: column;
}
.user-info-text strong {
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.2;
}
.user-info-text small {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ════════════════════════════════════════════════
   CONTENT & CARDS
════════════════════════════════════════════════ */
.content-wrapper {
  padding: 2rem;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.page-header-title h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}
.page-header-title p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.card {
  background: rgba(26, 30, 38, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: all 0.3s ease;
  animation: fadeInUp 0.6s ease-out backwards;
  animation-delay: 0.2s;
  color: var(--text-primary);
}
.card:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.08);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h5 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-header h5 i {
  color: var(--accent);
}

.card-body {
  padding: 1.5rem;
}

/* ════════════════════════════════════════════════
   ANIMATIONS
════════════════════════════════════════════════ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeInUp 0.6s ease-out forwards;
}

/* ════════════════════════════════════════════════
   METRICS & STATS
════════════════════════════════════════════════ */
/* ════════════════════════════════════════════════
   METRICS & STATS - PREMIUM UPGRADE
════════════════════════════════════════════════ */
.stat-card {
  position: relative;
  background: linear-gradient(145deg, rgba(30, 35, 45, 0.7), rgba(20, 24, 30, 0.85));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-top-color: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1.25rem;
  transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  animation: fadeInUp 0.6s ease-out backwards;
  overflow: hidden;
  z-index: 1;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Dynamic Glowing Orb behind card */
.stat-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(240, 90, 40, 0.08) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.6s ease;
  z-index: -1;
  pointer-events: none;
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: rgba(240, 90, 40, 0.4);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 25px rgba(240, 90, 40, 0.15);
  background: linear-gradient(145deg, rgba(35, 40, 50, 0.9), rgba(25, 29, 36, 0.95));
}

/* Stagger animations for stat cards */
.row > div:nth-child(1) .stat-card { animation-delay: 0.1s; }
.row > div:nth-child(2) .stat-card { animation-delay: 0.2s; }
.row > div:nth-child(3) .stat-card { animation-delay: 0.3s; }
.row > div:nth-child(4) .stat-card { animation-delay: 0.4s; }
.row > div:nth-child(5) .stat-card { animation-delay: 0.5s; }

.stat-card .stat-icon {
  margin: 0 !important; /* Overrides inline bootstrap mx-auto mb-3 */
  width: 60px !important;
  height: 60px !important;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stat-card:hover .stat-icon {
  transform: scale(1.15) rotate(8deg);
}

.stat-icon.orange { background: linear-gradient(135deg, rgba(240, 90, 40, 0.2), rgba(240, 90, 40, 0.05)); color: var(--accent); border: 1px solid rgba(240, 90, 40, 0.3); }
.stat-icon.green  { background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05)); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.stat-icon.blue   { background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.05)); color: var(--info); border: 1px solid rgba(59, 130, 246, 0.3); }
.stat-icon.yellow { background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.05)); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.stat-icon.red    { background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.05)); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }

.stat-card .stat-info {
  text-align: left !important; /* Overrides inline text-center */
  flex-grow: 1;
}

.stat-info h3 {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(90deg, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.2rem;
  line-height: 1.1;
}
.stat-info h3 small {
  font-size: 1rem;
  -webkit-text-fill-color: var(--warning);
  vertical-align: text-top;
  margin-left: 4px;
}

.stat-info p {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0;
}

/* ════════════════════════════════════════════════
   FORMS & INPUTS
════════════════════════════════════════════════ */
.form-label {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.45rem;
}

.form-control, .form-select {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  font-size: 0.9rem;
  transition: var(--transition);
  color-scheme: dark;
}

.form-control::file-selector-button {
  color: #212529 !important;
}

.form-check-label {
  color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
  background-color: var(--bg-input);
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control::placeholder {
  color: var(--text-muted);
}

/* ════════════════════════════════════════════════
   BUTTONS & BADGES
════════════════════════════════════════════════ */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #e64a19);
  border: none;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.4rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(240, 90, 40, 0.25);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(240, 90, 40, 0.4);
  background: linear-gradient(135deg, #f26b3c, #f05a28);
}

.btn-secondary {
  background-color: var(--bg-card-hover);
  border-color: var(--border-color);
  color: var(--text-primary);
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.25rem;
  transition: var(--transition);
}
.btn-secondary:hover {
  background-color: var(--border-color);
  color: #fff;
}

.badge {
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.75rem;
}
.badge-active, .badge-published, .badge-completed {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-inactive, .badge-draft, .badge-pending {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-new {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ════════════════════════════════════════════════
   TABLES
════════════════════════════════════════════════ */
.table {
  color: var(--text-secondary);
  margin-bottom: 0;
  vertical-align: middle;
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-secondary);
  --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
  --bs-table-hover-bg: var(--bg-card-hover);
}
.table > :not(caption) > * > * {
  background-color: transparent !important;
  color: var(--text-secondary) !important;
  border-bottom-color: var(--border-color);
}
.table thead th {
  background-color: rgba(20, 23, 29, 0.8) !important;
  color: var(--text-muted) !important;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1rem;
}
.table tbody td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.88rem;
  background-color: transparent !important;
}
.table tbody tr {
  transition: all 0.3s ease;
}
.table tbody tr:hover td {
  background-color: var(--bg-card-hover) !important;
  color: var(--text-primary) !important;
}

.table-img {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.action-btns {
  display: flex;
  gap: 6px;
}

.btn-action {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.85rem;
  transition: var(--transition);
}
.btn-action:hover {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}
.btn-action.btn-delete:hover {
  border-color: var(--danger);
  background: var(--danger);
}

/* ════════════════════════════════════════════════
   MEDIA PREVIEWS
════════════════════════════════════════════════ */
.img-preview-box {
  width: 100%;
  max-width: 240px;
  min-height: 140px;
  height: auto;
  padding: 10px;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-input);
  margin-top: 0.5rem;
}
.img-preview-box img {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* ════════════════════════════════════════════════
   RESPONSIVE & MOBILE OPTIMIZATIONS
════════════════════════════════════════════════ */

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 999;
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sidebar-overlay.show {
  display: block !important;
  opacity: 1 !important;
}

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 15px rgba(0,0,0,0.5);
  }
  .sidebar.open {
    transform: translateX(0) !important;
  }
  .main-wrapper {
    margin-left: 0;
  }
  
  .sidebar-toggle {
    display: inline-flex !important;
  }
}

@media (min-width: 992px) {
  .sidebar-toggle {
    display: none !important; /* Hide toggle on desktop since sidebar is fixed */
  }
}

@media (max-width: 767.98px) {
  .top-navbar {
    padding: 0 1rem;
    height: 60px;
  }
  .sidebar-header {
    height: 60px;
  }
  .breadcrumb-title {
    font-size: 1rem;
  }
  .navbar-left, .navbar-right {
    gap: 8px;
  }
  
  /* Hide 'View Website' text on mobile, show only icon */
  .navbar-right .btn-secondary {
    padding: 0.25rem 0.5rem;
  }
  .navbar-right .btn-secondary i {
    margin: 0 !important;
  }
  .navbar-right .btn-secondary span {
    display: none;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 15px;
    padding: 1rem !important;
  }
  .content-wrapper {
    padding: 1rem;
  }
  
  /* Fix Stat Cards for Mobile */
  .stat-card {
    gap: 0.75rem;
  }
  .stat-icon {
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
  }
  .stat-info h3 {
    font-size: 1.4rem;
  }
  .stat-info p {
    font-size: 0.75rem;
  }

  /* Ensure tables scroll horizontally on small screens without breaking layout */
  .table-responsive, .table-container {
    display: block;
    width: 100%;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  
  .table {
    min-width: 800px; /* Force table to be wide enough so it scrolls instead of squishing */
  }
  .table th, .table td {
    white-space: nowrap; /* Prevent text wrapping so columns maintain their width */
  }
  .table-img {
    width: 40px !important;
    height: 40px !important;
  }
}
