/* Root variables for consistent branding */
:root {
  --primary: #0062FF;
  --primary-hover: #004ecc;
  --primary-subtle: #EBF2FF;
  --secondary: #64748B;
  --bg-color: #F8FAFC;
  --card-bg: #FFFFFF;
  --sidebar-bg: #FFFFFF;
  --topbar-bg: #FFFFFF;
  --border-color: #E2E8F0;
  --text-main: #1E293B;
  --text-muted: #64748B;
  --text-inverse: #FFFFFF;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 80px;
  --topbar-height: 70px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode (Premium UI Theme) */
body.dark-mode {
  --bg-color: #0f172a;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: #1e293b;
  --card-bg: #1e293b;
  --sidebar-bg: #111827;
  --topbar-bg: #1e293b;
  --primary-subtle: rgba(0, 98, 255, 0.15);
}

body.dark-mode .sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
}

body.dark-mode .card,
body.dark-mode .topbar,
body.dark-mode .drawer,
body.dark-mode .modal-container,
body.dark-mode .dropdown-menu {
  background: var(--card-bg);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

body.dark-mode .nav-item:not(.active):hover {
  background: rgba(255, 255, 255, 0.05);
}

body.dark-mode table thead {
  background: #0f172a;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode .form-control {
    background: #0f172a !important;
    border-color: #2d3748;
    color: #e2e8f0;
}

body.dark-mode .stats-grid .stat-card {
    background: #1e293b;
}

body.dark-mode .breadcrumb-item {
    color: var(--text-muted);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  transition: var(--transition);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

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

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.logo-text {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-main);
  white-space: nowrap;
  transition: var(--transition);
}

.sidebar.collapsed .logo-text {
  opacity: 0;
  width: 0;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 0.75rem;
}

.nav-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 1.5rem 0.75rem 0.5rem;
  font-weight: 600;
}

.sidebar.collapsed .nav-section-title {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  gap: 0.75rem;
  margin-bottom: 2px;
  transition: var(--transition);
  position: relative;
}

.nav-item:hover {
  background-color: var(--primary-subtle);
  color: var(--primary);
}

.nav-item.active {
  background-color: var(--primary-subtle);
  color: var(--primary);
  font-weight: 600;
}

.nav-item i {
  font-size: 1.25rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-text {
  font-size: 0.925rem;
  white-space: nowrap;
  transition: var(--transition);
}

.sidebar.collapsed .nav-text {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.sidebar.collapsed + .main-content {
  margin-left: var(--sidebar-collapsed-width);
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background-color: var(--topbar-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 900;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sidebar-toggle {
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.sidebar-toggle:hover {
  background-color: var(--bg-color);
  color: var(--primary);
}

.search-bar {
  display: flex;
  align-items: center;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  width: 320px;
  gap: 0.75rem;
}

.search-bar input {
  border: none;
  background: none;
  outline: none;
  font-size: 0.875rem;
  width: 100%;
  color: var(--text-main);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.topbar-action {
  position: relative;
  color: var(--text-muted);
}

.topbar-action:hover {
  color: var(--primary);
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: var(--danger);
  color: white;
  font-size: 0.625rem;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border: 2px solid var(--topbar-bg);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-left: 1.25rem;
  border-left: 1px solid var(--border-color);
  cursor: pointer;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background-color: var(--primary-subtle);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
}

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

/* Page Header */
.page-header {
  padding: 1.5rem;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.breadcrumb-item:hover {
  color: var(--primary);
}

.breadcrumb-separator {
  color: var(--border-color);
}

.page-title-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title-content h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.page-actions {
  display: flex;
  gap: 0.75rem;
}

/* Content Area */
.page-content {
  padding: 0 1.5rem 2rem;
  overflow-y: auto;
}

/* Common Components */
.card {
  background-color: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

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

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition);
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--primary-subtle);
  color: var(--primary);
}

.btn-outline {
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
/* Tabs System */
.tabs-container {
  margin-top: 1rem;
}

.tab-content {
  display: none;
}

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

.tabs-header {
  display: flex;
  gap: 2rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.tab-item {
  padding: 0.75rem 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.tab-item:hover {
  color: var(--primary);
}

.tab-item.active {
  color: var(--primary);
  font-weight: 600;
}

.tab-item.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--primary);
}

/* Profile Specific */
.profile-sidebar {
  width: 340px;
  flex-shrink: 0;
}

.profile-main {
  flex: 1;
}

.profile-header-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.profile-avatar-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid var(--primary-subtle);
  margin-bottom: 1rem;
}

.info-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
}

.info-label {
  color: var(--text-muted);
}

.info-value {
  font-weight: 600;
  color: var(--text-main);
}

.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: var(--border-color);
}

.timeline-event {
  position: relative;
  padding-bottom: 1.5rem;
}

.timeline-event::before {
  content: '';
  position: absolute;
  left: -21px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--primary);
  border: 2px solid white;
}

.timeline-content {
  background: white;
}

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

.timeline-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 2px;
}

.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

@media (max-width: 1200px) {
  .profile-layout {
    flex-direction: column;
  }
  .profile-sidebar {
    width: 100%;
  }
}

.btn-outline:hover {
  background-color: var(--bg-color);
}

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

.stat-card {
  background-color: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-info .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-info .stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-trend {
  font-size: 0.75rem;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

/* Tables */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 1rem 1.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-color);
}

td {
  padding: 1rem 1.5rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

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

tr:hover td {
  background-color: #f8fafc;
}

.badge {
  display: inline-flex;
  padding: 0.25rem 0.625rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: #DCFCE7; color: #15803D; }
.badge-warning { background: #FEF3C7; color: #B45309; }
.badge-danger { background: #FEE2E2; color: #B91C1C; }
.badge-info { background: #DBEAFE; color: #1D4ED8; }

/* Dashboard Widgets */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.widget-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
}

.widget-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* Utility */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-2 { margin-top: 0.5rem; }

@media (max-width: 1024px) {
  .sidebar { width: var(--sidebar-collapsed-width); }
  .logo-text { display: none; }
  .nav-text, .nav-section-title { display: none; }
  .main-content { margin-left: var(--sidebar-collapsed-width); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* Calendar Scheduler Specific */
.calendar-container {
  display: flex;
  flex-direction: column;
  height: 800px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.calendar-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 80px repeat(7, 1fr);
  grid-template-rows: 40px repeat(14, 1fr); /* 8am to 10pm */
  overflow-y: auto;
}

.calendar-cell {
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 8px;
  min-height: 60px;
  position: relative;
}

.calendar-header-cell {
  background: var(--bg-color);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.time-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-color);
}

.booking-item {
  position: absolute;
  left: 4px;
  right: 4px;
  top: 4px;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.75rem;
  color: white;
  z-index: 10;
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.booking-primary { background-color: var(--primary); }
.booking-secondary { background-color: var(--secondary); }
.booking-success { background-color: var(--success); }
.booking-warning { background-color: var(--warning); }

/* Operations Dashboard Specific */
.ops-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
}

.ops-card {
  padding: 1rem;
}

.ops-item {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  padding: 12px 0;
  gap: 12px;
}

.ops-item:last-child {
  border-bottom: none;
}
/* Drawer / Slide-over */
.drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100vh;
  background: white;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.05);
  z-index: 2000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.drawer.show {
  right: 0;
}

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

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(2px);
  z-index: 1500;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.drawer-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* Enhanced Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: white;
  width: 100%;
  max-width: 600px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.modal.show .modal-container {
  transform: translateY(0);
}

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

.modal-body {
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  background: var(--bg-color);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.25rem;
}

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

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  background: var(--bg-color);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px var(--primary-subtle);
}

/* Search Results Dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 100%;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
  padding: 0.5rem;
}

.search-results.show {
  display: block;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.search-result-item:hover {
  background: var(--primary-subtle);
}

/* Visual Chart Polish */
.chart-container-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 20px 0;
}

.chart-bar {
  flex: 1;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  min-height: 20px;
  transition: height 1s ease;
  opacity: 0.8;
}

.chart-bar:hover {
  opacity: 1;
  transform: scaleX(1.05);
}

.chart-line-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-line-path {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: drawLine 2s forwards;
}

@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}

/* Timeline & Profile Polish */
.timeline {
  position: relative;
  padding-left: 1.5rem;
  margin-top: 1rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}

.timeline-event {
  position: relative;
  margin-bottom: 24px;
}

.timeline-event::after {
  content: '';
  position: absolute;
  left: calc(-1.5rem - 5px);
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid white;
}

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

.profile-avatar-large {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  margin: 0 auto 1rem;
  border: 4px solid var(--primary-subtle);
  object-fit: cover;
  display: block;
}

/* Mobile Bottom Nav */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: white;
  border-top: 1px solid var(--border-color);
  z-index: 1000;
  padding: 0.5rem 0;
  box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
}

body.dark-mode .mobile-bottom-nav {
  background: #1e293b;
}

@media (max-width: 1024px) {
  .mobile-bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
  }
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 600;
  flex: 1;
}

.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item i {
  width: 20px;
  height: 20px;
}
