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

:root {
  /* BARNIES-INSPIRED PALETTE (Light Mode) */
  --bg-primary: #f8fafc;
  /* Very light gray/white background */
  --bg-secondary: #ffffff;
  /* Pure white for cards/sidebar */
  --bg-surface: #f1f5f9;
  /* Light gray for inputs/secondary elements */
  --bg-surface-high: #e2e8f0;
  /* Slightly darker gray for hover states */

  /* Primary Green Theme */
  --accent-primary: #009b6e;
  /* Barnies Green */
  --accent-primary-dark: #007a56;
  /* Darker Green */
  --accent-primary-light: #e6f5f1;
  /* Very light green for backgrounds */

  /* Secondary Accents */
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-info: #0ea5e9;

  /* Text Colors */
  --text-primary: #1e293b;
  /* Dark slate for main text */
  --text-secondary: #64748b;
  /* Muted slate for secondary text */
  --text-muted: #94a3b8;
  /* Lighter slate */
  --text-on-primary: #ffffff;
  /* White text on green backgrounds */

  /* Glass / UI Effects */
  --glass-bg: rgba(255, 255, 255, 0.95);
  --glass-border: #e2e8f0;
  --glass-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

  --blur: blur(8px);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  /* Rounded aesthetics */

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Form Select Green Theme Override */
.form-select:focus,
.form-control:focus,
select:focus,
input:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(0, 155, 110, 0.25) !important;
  outline: none !important;
}

.form-select option:checked,
.form-select option:hover,
.form-select option:focus,
select option:checked,
select option:hover {
  background: var(--accent-primary) !important;
  background-color: var(--accent-primary) !important;
  color: white !important;
}

/* Firefox dropdown styling */
@-moz-document url-prefix() {

  .form-select option:checked,
  select option:checked {
    background: var(--accent-primary) linear-gradient(0deg, var(--accent-primary) 0%, var(--accent-primary) 100%) !important;
    color: white !important;
  }
}

html {
  scroll-behavior: auto;
}

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

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

body {
  font-family: 'Cairo', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* Typography Overrides */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Cairo', sans-serif;
  letter-spacing: -0.01em;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 600;
}

a:hover {
  color: var(--accent-primary-dark);
}

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

/* --- Sidebar --- */
.sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--glass-border);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.sidebar-header {
  padding: 1.25rem 1.25rem;
  border-bottom: 1px solid var(--glass-border);
  background: var(--bg-secondary);
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--accent-primary);
  text-decoration: none;
}

.logo-text {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-primary);
  line-height: 1.2;
}

.logo-text strong big {
  color: var(--accent-primary-dark);
}

.sidebar-nav {
  padding: 1.5rem 1rem;
}

.nav-section {
  margin-bottom: 1rem;
}

.nav-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding: 0 1rem;
  letter-spacing: 0.05em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
  margin-bottom: 4px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
}

.nav-item:hover {
  background: #f8fafc;
  color: #009b6e;
  transform: translateX(4px);
}

.nav-item.active {
  background: linear-gradient(135deg, #009b6e, #007a56);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 155, 110, 0.25);
}

.nav-item.active i {
  color: white;
}

.nav-item i {
  font-size: 1rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(0, 155, 110, 0.08);
  color: #009b6e;
  transition: all 0.2s;
}

.nav-item:hover i {
  background: rgba(0, 155, 110, 0.15);
}

.nav-item.active i {
  background: rgba(255, 255, 255, 0.2);
}


/* --- Main Content --- */
.main-content {
  margin-left: 280px;
  flex: 1;
  background: var(--bg-primary);
}

.topbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

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

.topbar-left .form-control {
  border: 2px solid var(--accent-primary);
  border-radius: 10px;
  font-weight: 600;
  color: var(--accent-primary);
  background: linear-gradient(135deg, rgba(0, 155, 110, 0.05) 0%, rgba(0, 155, 110, 0.02) 100%);
  padding: 0.5rem 2.5rem 0.5rem 1rem;
  font-size: 0.875rem;
  min-width: 160px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.topbar-left .form-control:hover {
  border-color: var(--accent-primary-dark);
  box-shadow: 0 2px 8px rgba(0, 155, 110, 0.15);
}

.topbar-left .form-control:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 155, 110, 0.2);
  outline: none;
}

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

.page-content {
  padding: 2rem;
  max-width: 1600px;
  margin: 0 auto;
  animation: fadeInUp 0.5s ease-out forwards;
}

/* --- Components --- */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  /* Pill shape */
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
  font-family: 'Cairo', sans-serif;
}

.btn-primary {
  background: linear-gradient(135deg, #42d392 0%, #009b6e 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 155, 110, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 155, 110, 0.35);
  color: white;
}

.btn-secondary {
  background: white;
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

/* Cards */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-primary-light);
}

.card-header {
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-primary-dark);
}

/* KPI Cards - PREMIUM */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.kpi-card {
  background: linear-gradient(135deg, #42d392 0%, #009b6e 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 15px -3px rgba(0, 155, 110, 0.2), 0 4px 6px -2px rgba(0, 155, 110, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(225deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}

.kpi-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 25px 30px -5px rgba(0, 155, 110, 0.35), 0 10px 10px -5px rgba(0, 155, 110, 0.2);
}

.kpi-label {
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.kpi-value {
  color: white;
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  background: none;
  line-height: 1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.kpi-change {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  width: fit-content;
  backdrop-filter: blur(4px);
}

.kpi-change.positive,
.kpi-change.negative {
  color: white;
}

/* Forms - See Global Form Styles section */

/* Tables */
.data-table th {
  background: var(--nav-active-bg);
  color: var(--accent-primary-dark);
  font-weight: 700;
  text-transform: none;
  font-size: 0.85rem;
  border-bottom: 2px solid var(--accent-primary);
  background-color: var(--accent-primary-light);
}

.data-table td {
  color: var(--text-primary);
  border-bottom: 1px solid var(--glass-border);
  padding: 1rem;
}

.data-table tbody tr:hover {
  background-color: var(--bg-surface);
}

/* Badges */
.status-badge {
  border-radius: 9999px;
  padding: 0.35rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-badge.online {
  background-color: #dcfce7;
  color: #166534;
}

.status-badge.offline {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Auth Pages - POLISHED */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
  padding: 1rem;
}

.auth-card {
  background: white;
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.5);
  text-align: center;
}

.auth-header {
  margin-bottom: 2rem;
}

.auth-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #42d392 0%, #009b6e 100%);
  box-shadow: 0 10px 25px -5px rgba(0, 155, 110, 0.4);
  color: white;
  font-size: 1.5rem;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

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



/* Global Form Styles (Promoted from Auth) */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: #f8fafc;
  transition: all 0.2s;
  font-size: 0.95rem;
  color: var(--text-primary);
}

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

/* Auth Specifics */
.auth-card .form-group {
  text-align: left;
}

.auth-footer {
  margin-top: 2rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Gallery & Events */
.gallery-card {
  background: white;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
}

.gallery-card.entry {
  border-left-color: var(--accent-success);
}

.gallery-card.exit {
  border-left-color: var(--accent-warning);
}

.direction-badge.in {
  background-color: var(--accent-success);
}

.direction-badge.out {
  background-color: var(--accent-warning);
}


/* Gallery Header Override */
.report-header {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-dark));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  color: white !important;
}

.report-header h1 {
  color: white !important;
}

/* Active Team Card */
.active-team-card {
  background: white;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.active-team-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
  border-color: var(--accent-primary);
}

.at-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.at-avatar {
  width: 48px;
  height: 48px;
  background: var(--accent-primary-light);
  color: var(--accent-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.at-info h4 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.at-code {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: monospace;
  background: var(--bg-surface);
  padding: 2px 6px;
  border-radius: 4px;
}

.at-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--glass-border);
}

.at-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent-success);
}

.at-time {
  font-weight: 800;
  color: var(--text-primary);
  font-size: 1.1rem;
}

/* Sidebar Toggle & Mobile Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.sidebar-overlay.active {
  display: block;
}

.sidebar-close {
  display: none;
  /* Default hidden on desktop */
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.25rem;
}

.sidebar-toggle {
  display: flex;
}

/* Sidebar collapsed state */
.sidebar.collapsed {
  transform: translateX(-280px);
}

.sidebar.collapsed+.sidebar-overlay {
  display: none;
}

body.sidebar-collapsed .main-content {
  margin-left: 0;
}

body.sidebar-collapsed .sidebar {
  transform: translateX(-280px);
}

body.sidebar-collapsed .sidebar.open {
  transform: translateX(0);
}

body.sidebar-collapsed .sidebar.open+.sidebar-overlay {
  display: block;
}

/* Filter Bar */
.filter-bar {
  background: white;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
}

/* User Menu */
.user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem 0.5rem 0.5rem;
  background: white;
  border: 1px solid var(--glass-border);
  border-radius: 9999px;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.user-menu:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--accent-primary-light);
  color: var(--accent-primary-dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  padding-right: 0.25rem;
}

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: white;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  min-width: 200px;
  z-index: 1000;
  margin-top: 0.5rem;
}

.dropdown-menu.active {
  display: block;
  animation: fadeIn 0.1s ease-out;
}

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

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

.user-dropdown {
  position: relative;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.dropdown-item:hover {
  background-color: var(--bg-surface);
  color: var(--accent-primary);
  padding-left: 1.25rem;
}

/* Responsive */
/* Show only on mobile when needed */


/* Gallery Styles (Consolidated) */
.gallery-stats {
  margin-bottom: 1rem;
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: white;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

.wow-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.gallery-card {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
}

.gallery-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-primary);
}

.gallery-card.ok,
.gallery-card.compliant {
  border-left: 4px solid var(--accent-success);
}

.gallery-card.warning {
  border-left: 4px solid var(--accent-warning);
}

.gallery-card.no-ppe,
.gallery-card.violation {
  border-left: 4px solid var(--accent-danger);
}

.gallery-image {
  position: relative;
  height: 220px;
  background: var(--bg-surface);
}

.gallery-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 3rem;
  color: var(--text-muted);
}

.gallery-info {
  padding: 1.25rem;
}

.gallery-time {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
}

.gallery-date {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.missing-items {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.item-badge {
  background: #fee2e2;
  color: #991b1b;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Camera Grid (Live Feeds) */
.camera-grid {
  display: grid;
  gap: 1.5rem;
  transition: all 0.3s ease;
}

.camera-grid.layout-1 {
  grid-template-columns: 1fr;
}

.camera-grid.layout-2 {
  grid-template-columns: repeat(2, 1fr);
}

.camera-grid.layout-4 {
  grid-template-columns: repeat(2, 1fr);
}

.camera-grid.layout-9 {
  grid-template-columns: repeat(3, 1fr);
}

.camera-grid.layout-16 {
  grid-template-columns: repeat(4, 1fr);
}

@media (min-width: 1200px) {
  .camera-grid.layout-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.camera-card {
  background: white;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.camera-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.camera-card.selected {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-light);
}

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

.camera-name {
  font-weight: 700;
  color: var(--text-primary);
}

.camera-feed {
  aspect-ratio: 16/9;
  background: black;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.camera-footer {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--bg-primary);
  border-top: 1px solid var(--glass-border);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Pagination */
.pagination-wrapper {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-link {
  padding: 0.5rem 1rem;
  background: white;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-weight: 600;
  transition: all var(--transition-fast);
}

.page-link:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

/* Branch Cards (Missing Styles) */
.branch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.branch-card {
  display: block;
  background: white;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  text-decoration: none;
  color: var(--text-primary);
}

.branch-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-primary);
}

.branch-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--glass-border);
}

.branch-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

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

.branch-stat {
  display: flex;
  flex-direction: column;
}

.branch-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.branch-stat-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
}


/* Recent Alerts (Timeline) */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.event-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: white;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  transition: all var(--transition-fast);
}

.event-item:hover {
  border-color: var(--glass-border);
  box-shadow: var(--shadow-sm);
}

.event-item.warning {
  border-left: 4px solid var(--accent-warning);
}

.event-item.danger {
  border-left: 4px solid var(--accent-danger);
}

.event-item.info {
  border-left: 4px solid var(--accent-info);
}

.event-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.event-item.warning .event-icon {
  color: var(--accent-warning);
  background: #fef3c7;
}

.event-item.danger .event-icon {
  color: var(--accent-danger);
  background: #fee2e2;
}

.event-content {
  flex: 1;
}

.event-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.event-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

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

/* Modals (Fixed Overlay) */
.modal-overlay {
  display: none;
  /* Hidden by default */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  box-sizing: border-box;
}

/* When active, use flex to center */
.modal-overlay.active,
.modal-overlay[style*="display: block"] {
  display: flex !important;
}

.modal {
  background: white;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0;
  overflow: auto;
  animation: slideIn 0.3s ease-out;
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 2rem;
}

/* Premium Footer */
.app-footer {
  margin-top: auto;
  padding: 1.25rem 2rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-top: 2px solid #e2e8f0;
  position: relative;
  z-index: 10;
}

.footer-content {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-brand strong {
  background: linear-gradient(135deg, #009b6e 0%, #007a56 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  font-size: 1rem;
}

.footer-contact {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.25rem;
  background: linear-gradient(135deg, #009b6e 0%, #007a56 100%);
  border-radius: 10px;
  color: white;
  font-weight: 600;
  transition: all 0.25s ease;
  border: none;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(0, 155, 110, 0.25);
}

.footer-contact:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 155, 110, 0.35);
  color: white;
}

.footer-contact i {
  font-size: 1.2em;
}

/* Custom Green Dropdown Styling */
.custom-select-wrapper {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  width: 100%;
  padding: 0.65rem 2.5rem 0.65rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9rem;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
}

.custom-select-trigger:hover {
  border-color: #009b6e;
}

.custom-select-trigger::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.7rem;
  color: #64748b;
  position: absolute;
  right: 1rem;
}

.custom-select-wrapper.open .custom-select-trigger {
  border-color: #009b6e;
  box-shadow: 0 0 0 3px rgba(0, 155, 110, 0.1);
}

.custom-select-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  display: none;
}

.custom-select-wrapper.open .custom-select-options {
  display: block;
}

.custom-select-option {
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: all 0.15s;
}

.custom-select-option:hover {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
}

.custom-select-option.selected {
  background: linear-gradient(135deg, #009b6e 0%, #007a56 100%);
  color: white;
}

.custom-select-option:first-child {
  border-radius: 8px 8px 0 0;
}

.custom-select-option:last-child {
  border-radius: 0 0 8px 8px;
}

/* Global Form Styling */
.form-control,
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  background: #f8fafc;
  transition: all 0.2s;
  font-family: 'Cairo', sans-serif;
}

.form-control:focus,
.form-select:focus {
  border-color: #009b6e;
  outline: none;
  box-shadow: 0 0 0 4px rgba(0, 155, 110, 0.15);
  background: white;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

/* Enhanced Card Styling */
.card {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* Premium Page Header */
.premium-header {
  background: linear-gradient(135deg, #009b6e 0%, #007a56 100%);
  border-radius: 16px;
  padding: 1.75rem 2rem;
  margin-bottom: 2rem;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 8px 30px rgba(0, 155, 110, 0.25);
}

.premium-header h1,
.premium-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.premium-header p {
  margin: 0.25rem 0 0 0;
  opacity: 0.85;
  font-size: 0.9rem;
}

.premium-header .status-dot {
  width: 10px;
  height: 10px;
  background: #4ade80;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

/* Enhanced Branch Cards */
.branch-card-premium {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.branch-card-premium:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.branch-card-header {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.branch-card-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 10px;
}

.branch-card-header h3 i {
  color: #009b6e;
}

.branch-card-body {
  padding: 1.5rem;
}

.branch-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.branch-stat {
  background: #f8fafc;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.branch-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  font-weight: 600;
  margin-bottom: 4px;
}

.branch-stat-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
}

.branch-card-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}

.branch-card-actions .btn {
  flex: 1;
  justify-content: center;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
}

/* ============================================
   PREMIUM LIVE MONITOR ENHANCEMENT STYLES
   ============================================ */

/* Enhanced Camera Grid with Better Spacing */
.camera-grid.enhanced {
  gap: 1.25rem;
  padding: 0.5rem;
}

/* Premium Camera Card - Glassmorphism Design */
.camera-card.premium {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  position: relative;
}

.camera-card.premium:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow:
    0 25px 50px -12px rgba(0, 155, 110, 0.25),
    0 0 0 1px rgba(0, 155, 110, 0.3),
    0 0 30px rgba(0, 155, 110, 0.15);
  border-color: rgba(0, 155, 110, 0.4);
}

.camera-card.premium.selected {
  border-color: var(--accent-primary);
  box-shadow:
    0 0 0 3px rgba(0, 155, 110, 0.2),
    0 0 30px rgba(0, 155, 110, 0.2);
}

/* Status-based Glow Effects */
.camera-card.premium.status-live {
  border-color: rgba(16, 185, 129, 0.3);
}

.camera-card.premium.status-live:hover {
  box-shadow:
    0 25px 50px -12px rgba(16, 185, 129, 0.25),
    0 0 40px rgba(16, 185, 129, 0.2);
}

.camera-card.premium.status-connecting {
  border-color: rgba(245, 158, 11, 0.3);
}

.camera-card.premium.status-connecting:hover {
  box-shadow:
    0 25px 50px -12px rgba(245, 158, 11, 0.25),
    0 0 40px rgba(245, 158, 11, 0.2);
}

.camera-card.premium.status-offline {
  border-color: rgba(239, 68, 68, 0.3);
}

.camera-card.premium.status-offline:hover {
  box-shadow:
    0 25px 50px -12px rgba(239, 68, 68, 0.25),
    0 0 40px rgba(239, 68, 68, 0.2);
}

/* Enhanced Camera Header */
.camera-header.premium {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1.25rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.9) 100%);
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
  position: relative;
}

/* Pulsing Status Indicator */
.status-indicator {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-indicator.live {
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-live 2s infinite;
}

.status-indicator.connecting {
  background: #f59e0b;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  animation: pulse-connecting 1.5s infinite;
}

.status-indicator.offline {
  background: #ef4444;
}

@keyframes pulse-live {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

@keyframes pulse-connecting {
  0% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

/* Camera Name with Badge */
.camera-name-group {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.camera-name.premium {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Recording Indicator */
.recording-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recording-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
  animation: blink 1s infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

/* Violation Count Badge */
.violation-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0 6px;
  border-radius: 9999px;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

/* Header Actions */
.camera-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-action-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 155, 110, 0.08);
  border: none;
  border-radius: 8px;
  color: var(--accent-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

.header-action-btn:hover {
  background: var(--accent-primary);
  color: white;
  transform: scale(1.1);
}

/* Premium Feed Container - Dark Mode */
.camera-feed.premium {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Feed Image/Video */
.camera-feed.premium img,
.camera-feed.premium video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

/* Gradient Overlay on Feed */
.feed-gradient-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
      rgba(0, 0, 0, 0) 0%,
      rgba(0, 0, 0, 0) 60%,
      rgba(0, 0, 0, 0.4) 100%);
  z-index: 2;
  pointer-events: none;
}

/* Enhanced Loading State */
.camera-loading-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  z-index: 5;
}

.loading-spinner-ring {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-primary);
  animation: spinner-rotate 1s linear infinite;
  margin-bottom: 1rem;
  position: relative;
}

.loading-spinner-ring::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: rgba(0, 155, 110, 0.4);
  animation: spinner-rotate 1.5s linear infinite reverse;
}

@keyframes spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

.loading-status-text {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
}

.loading-source-text {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.75rem;
  margin-top: 0.5rem;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

/* Connection Retry Countdown */
.retry-countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1rem;
}

.retry-countdown-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.retry-btn {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-dark) 100%);
  color: white;
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.retry-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 155, 110, 0.4);
}

/* Quick Actions Overlay */
.quick-actions-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 10;
}

.camera-feed.premium:hover .quick-actions-overlay {
  opacity: 1;
  visibility: visible;
}

.quick-action-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  color: white;
  font-size: 1.125rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-action-btn:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: scale(1.1);
}

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

.quick-action-btn i {
  pointer-events: none;
}

/* Stream Health Indicators */
.stream-health-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
  z-index: 3;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.camera-feed.premium:hover .stream-health-bar {
  opacity: 1;
}

.health-metric {
  display: flex;
  align-items: center;
  gap: 4px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.7rem;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.health-metric i {
  font-size: 0.65rem;
  opacity: 0.7;
}

.health-metric.good {
  color: #10b981;
}

.health-metric.warning {
  color: #f59e0b;
}

.health-metric.bad {
  color: #ef4444;
}

.quality-badge {
  background: rgba(0, 155, 110, 0.9);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* Enhanced Camera Footer */
.camera-footer.premium {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 1.25rem;
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.98) 0%, rgba(241, 245, 249, 0.98) 100%);
  border-top: 1px solid rgba(226, 232, 240, 0.6);
  font-size: 0.8rem;
}

.camera-footer-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
}

.camera-footer-left i {
  color: var(--accent-primary);
  font-size: 0.75rem;
}

.role-badge {
  background: linear-gradient(135deg, rgba(0, 155, 110, 0.1) 0%, rgba(0, 155, 110, 0.05) 100%);
  color: var(--accent-primary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid rgba(0, 155, 110, 0.15);
}

/* Drag Handle */
.drag-handle {
  position: absolute;
  top: 0.75rem;
  right: 3.5rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: grab;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 5;
}

.camera-card.premium:hover .drag-handle {
  opacity: 1;
}

.drag-handle:active {
  cursor: grabbing;
}

.camera-card.dragging {
  opacity: 0.5;
  transform: scale(1.02);
}

.camera-card.drag-over {
  border: 2px dashed var(--accent-primary);
}

/* Comparison Mode */
.comparison-checkbox {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.camera-card.premium:hover .comparison-checkbox {
  opacity: 1;
}

.comparison-checkbox input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent-primary);
}

.comparison-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  display: none;
  flex-direction: column;
}

.comparison-panel.active {
  display: flex;
}

.comparison-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.comparison-header h3 {
  color: white;
  font-weight: 600;
  margin: 0;
}

.comparison-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.comparison-close:hover {
  background: rgba(239, 68, 68, 0.8);
}

.comparison-content {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem;
}

.comparison-feed {
  background: #1e293b;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.comparison-feed-header {
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  color: white;
  font-weight: 600;
}

.comparison-feed-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Picture-in-Picture Mode */
.pip-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 320px;
  height: 180px;
  background: #0f172a;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  z-index: 9998;
  display: none;
  resize: both;
  min-width: 200px;
  min-height: 112px;
  max-width: 640px;
  max-height: 360px;
}

.pip-container.active {
  display: block;
  animation: pip-slide-in 0.3s ease;
}

@keyframes pip-slide-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
  }

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

.pip-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 100%);
  z-index: 2;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.pip-container:hover .pip-header {
  opacity: 1;
}

.pip-title {
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
}

.pip-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
}

.pip-close:hover {
  background: rgba(239, 68, 68, 0.8);
}

.pip-content {
  width: 100%;
  height: 100%;
}

.pip-content img,
.pip-content video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Search & Filter Bar Enhancement */
.camera-search-input {
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: 9999px;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  font-size: 0.85rem;
  width: 220px;
  transition: all 0.2s ease;
}

.camera-search-input:focus {
  background: white;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 155, 110, 0.15);
  outline: none;
  width: 280px;
}

.search-wrapper {
  position: relative;
}

.search-wrapper i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.status-filter-pills {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: 9999px;
}

.status-pill {
  padding: 0.375rem 0.875rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.status-pill:hover {
  color: var(--accent-primary);
}

.status-pill.active {
  background: white;
  color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

/* Keyboard Shortcuts Modal */
.shortcuts-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.shortcuts-modal.active {
  display: flex;
}

.shortcuts-content {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.shortcuts-content h3 {
  margin: 0 0 1.5rem 0;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.shortcut-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.shortcut-keys {
  display: flex;
  gap: 0.25rem;
}

.shortcut-key {
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: monospace;
  color: var(--text-primary);
  min-width: 28px;
  text-align: center;
}

.shortcut-desc {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Zoom Controls */
.zoom-slider-container {
  position: absolute;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  display: none;
  align-items: center;
  gap: 0.75rem;
  z-index: 15;
}

.camera-feed.premium:hover .zoom-slider-container.active {
  display: flex;
}

.zoom-slider {
  width: 100px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 9999px;
  outline: none;
}

.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent-primary);
  border-radius: 50%;
  cursor: pointer;
}

.zoom-label {
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 40px;
  text-align: center;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .camera-grid.enhanced {
    gap: 1rem;
  }

  .quick-actions-overlay {
    opacity: 1;
    visibility: visible;
    background: transparent;
  }

  .quick-action-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .camera-search-input {
    width: 150px;
  }

  .camera-search-input:focus {
    width: 180px;
  }

  .pip-container {
    width: 200px;
    height: 112px;
    bottom: 10px;
    right: 10px;
  }
}