/* ==============================
   LUMINA DASHBOARD PREMIUM UI
   ============================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* Colors */
  --primary: #C4622D;
  --primary-hover: #D5733E;
  --primary-glow: rgba(196, 98, 45, 0.15);
  --bg: #020617;
  --surface: #0f172a;
  --surface-hover: #1e293b;
  --surface-glass: rgba(15, 23, 42, 0.7);
  --border: rgba(255, 255, 255, 0.08);
  --border-active: rgba(196, 98, 45, 0.3);
  --text: #f8fafc;
  --text-muted: #94a3b8;

  /* Dimensions */
  --sidebar-w: 260px;
  --header-h: 70px;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;

  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
  scrollbar-gutter: stable;
}

/* Typography */
h1,
h2,
h3,
h4 {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

/* Layout Structure */
.dash-wrap {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

.dash-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  background: var(--bg);
  transition: var(--transition);
}

/* Responsive Layout Adjustment */
@media (max-width: 1023px) {
  .dash-main {
    margin-left: 0;
    width: 100%;
  }
}

/* Specific Tweak for tables on very small screens */
@media (max-width: 600px) {

  th,
  td {
    padding: 12px 10px !important;
    font-size: 11px !important;
  }
}

/* Activity Items on Mobile */
@media (max-width: 400px) {
  .page-title {
    font-size: 18px !important;
  }

  .stat-card {
    padding: 15px !important;
  }

  .flex.gap-4 {
    gap: 12px !important;
  }
}

/* Sidebar Styling */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
  }
}

.sb-logo {
  padding: 0 24px;
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}

.sb-logo-mark {
  background: var(--primary);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-weight: 900;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
}

.sb-logo-text {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: white;
  font-size: 18px;
}

.sb-badge {
  font-size: 9px;
  font-weight: 800;
  color: var(--primary);
  background: rgba(196, 98, 45, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-left: auto;
}

.sb-nav {
  flex: 1;
  padding: 20px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sb-section {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  padding: 16px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  transition: var(--transition);
}

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

.nav-item.active {
  color: white;
  background: var(--primary-glow);
  border: 1px solid var(--border-active);
}

.nav-item.active svg {
  color: var(--primary);
  transform: scale(1.1);
}

.nav-item.danger {
  color: #f87171;
  margin-top: auto;
}

.nav-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

/* Topbar Styling */
.topbar {
  position: sticky;
  top: 0;
  z-index: 900;
  background: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(12px);
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 767px) {
  .topbar {
    padding: 0 20px;
  }
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.topbar-hamburger {
  display: none;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.topbar-hamburger:hover {
  background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 1023px) {
  .topbar-hamburger {
    display: flex;
  }
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--primary);
}

.topbar-sep {
  color: var(--border);
  font-size: 18px;
  font-weight: 300;
}

.page-label {
  font-size: 15px;
  font-weight: 700;
  color: white;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Premium User Dropdown System */
.premium-dropdown {
  position: relative;
  display: inline-block;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.topbar-user:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.premium-dropdown-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: var(--transition);
  z-index: 1001;
}

.premium-dropdown.open .premium-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.dropdown-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--primary);
}

.dropdown-status {
  font-size: 12px;
  font-weight: 600;
  color: white;
  margin-top: 4px;
}

.premium-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.85rem 1.5rem;
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: var(--transition);
  white-space: nowrap;
}

.premium-dropdown-item i {
  font-size: 14px;
  width: 20px;
  text-align: center;
  transition: var(--transition);
}

.premium-dropdown-item:hover {
  background: rgba(196, 98, 45, 0.05);
  color: var(--primary);
  padding-left: 2rem;
}

.premium-dropdown-item:hover i {
  color: var(--primary);
  transform: scale(1.1);
}

.premium-dropdown-item.active {
  background: var(--primary-glow);
  color: var(--primary);
  font-weight: 700;
}

.premium-dropdown-item.logout {
  color: #f87171;
}

.premium-dropdown-item.logout:hover {
  background: rgba(239, 68, 68, 0.1);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

@media (max-width: 600px) {
  .topbar-user-info {
    display: none;
  }
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.topbar-user .name {
  font-size: 13px;
  font-weight: 700;
  color: white;
  line-height: 1.2;
}

.topbar-user .role {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Modal */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 32px;
}

/* Topbar Actions */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 16px;
  padding-right: 16px;
  border-right: 1px solid var(--border);
}

@media (max-width: 767px) {
  .topbar-actions {
    display: none;
  }
}

.quick-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.quick-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border-color: rgba(255, 255, 255, 0.2);
}

.quick-btn.active {
  color: var(--primary);
  border-color: var(--border-active);
  background: var(--primary-glow);
}

/* Page Content */
.page-content {
  padding: 40px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 767px) {
  .page-content {
    padding: 24px 20px;
  }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 40px;
}

.page-eyebrow {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--primary);
  margin-bottom: 8px;
}

.page-title {
  font-size: 32px;
  font-weight: 900;
  color: white;
  text-transform: uppercase;
  letter-spacing: -0.02em;
}

.page-desc {
  font-size: 15px;
  color: var(--text-muted);
  margin-top: 8px;
  max-width: 600px;
}

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

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

.stat-card {
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-active);
  background: var(--surface);
}

.stat-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.stat-value {
  font-size: 36px;
  font-weight: 800;
  color: white;
  line-height: 1;
}

.stat-sub {
  font-size: 12px;
  font-weight: 700;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-sub.up {
  color: #4ade80;
}

.stat-sub.down {
  color: #f87171;
}

.stat-sub.primary {
  color: var(--primary);
}

/* Section Grid */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 24px;
}

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

/* Generic Card Styling */
.card {
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: var(--transition);
  min-width: 0;
  /* Critical for grid content overflow */
  width: 100%;
  overflow: hidden;
  /* Prevent internal bleed */
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.card-title {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: white;
}

/* Tables Styling */
.tbl-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.2);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th {
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.02);
  text-align: left;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: white;
}

td.bold {
  color: white;
  font-weight: 600;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-green {
  background: rgba(34, 197, 94, 0.1);
  color: #4ade80;
}

.badge-yellow {
  background: rgba(234, 179, 8, 0.1);
  color: #facc15;
}

.badge-red {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

.badge-blue {
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
}

.badge-orange {
  background: rgba(196, 98, 45, 0.1);
  color: #fb923c;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 10px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(196, 98, 45, 0.3);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border-color: rgba(255, 255, 255, 0.2);
}

/* Event Cards (Snapshot in Overview) */
.event-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.event-card:hover {
  border-color: var(--border-active);
  background: rgba(255, 255, 255, 0.04);
}

.event-date-box {
  width: 48px;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

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

.form-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
}

.form-input,
.form-select,
.form-textarea {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 14px;
  color: white;
  outline: none;
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

/* Utilities */
.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.space-y-4>*+* {
  margin-top: 16px;
}

.space-y-8>*+* {
  margin-top: 32px;
}

#sb-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 950;
}

/* Status dots */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
}

.status-online {
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
}

.status-offline {
  background: #94a3b8;
}

/* User Dashboard Specifics */
.user-topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.user-topnav-inner {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 767px) {
  .user-topnav {
    height: auto;
  }

  .user-topnav-inner {
    height: 70px;
    padding: 0 20px;
  }
}

.user-nav-links {
  display: flex;
  gap: 32px;
  height: 100%;
  align-items: center;
}

@media (max-width: 1023px) {
  .user-nav-links {
    display: none;
  }
}

.user-nav-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: var(--transition);
  position: relative;
  padding: 10px 0;
}

.user-nav-link:hover {
  color: white;
}

.user-nav-link.active {
  color: var(--primary);
}

.user-nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.user-main {
  padding-top: 100px;
  padding-bottom: 40px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 767px) {
  .user-main {
    padding-top: 130px;
    padding-left: 20px;
    padding-right: 20px;
  }
}

/* User Mobile Nav */
.user-mobile-nav {
  display: none;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border);
  justify-content: space-around;
}

@media (max-width: 1023px) {
  .user-mobile-nav {
    display: flex;
  }
}

.user-mobile-link {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-decoration: none;
}

.user-mobile-link.active {
  color: var(--primary);
}

#user-mobile-menu {
  display: none;
  flex-direction: column;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 0;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  border-bottom: 2px solid var(--primary);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
  animation: userMobileSlideDown 0.3s ease-out;
}

@keyframes userMobileSlideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-mobile-menu-link {
  padding: 14px 24px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
  display: block;
}

.user-mobile-menu-link:last-child {
  border-bottom: none;
}

.user-mobile-menu-link:hover,
.user-mobile-menu-link.active {
  background: rgba(196, 98, 45, 0.05);
  color: white;
  padding-left: 28px;
}

/* --- Added Responsiveness Tweak (Admin/User) --- */
@media (max-width: 1023px) {
  .page-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 15px !important;
  }
}

@media (max-width: 1100px) {
  .grid-2 {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 768px) {
  .page-content {
    padding: 20px 16px !important;
  }

  .card {
    padding: 24px 16px !important;
    border-radius: var(--radius-md) !important;
  }

  .stat-card {
    padding: 20px;
  }

  .stat-value {
    font-size: 26px !important;
  }

  .page-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 15px !important;
  }
}

@media (max-width: 600px) {
  .tbl-wrap {
    margin: 0 -16px;
    width: calc(100% + 32px);
    border-radius: 0;
  }

  th,
  td {
    padding: 12px 10px !important;
    font-size: 11px !important;
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 0 15px;
  }

  .topbar-user-info {
    display: none;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px !important;
  }

  .card-header .btn {
    width: 100%;
  }
}