:root {
    /* Color Palette */
    --primary-color: #00549f;     /* Your brand blue */
    --primary-hover: #004080;     /* Darker blue for hover states */
    --primary-color-dark: #003366; /* Darker shade for borders etc. */
    --secondary-color: #607890;   /* Muted blue-grey */
    --success-color: #0d8a6f;     /* Teal-leaning green */
    --danger-color: #dc3545;      /* Accessible red */
    --warning-color: #f0a500;     /* Warm amber */
    --info-color: #0098da;        /* Light blue */
    
    /* Background Colors */
    --bg-dark: #0a1929;          /* Dark blue-based */
    --bg-medium: #102a43;        /* Navy-tinted medium */
    --bg-light: #1b3a57;         /* Lighter navy */
    --bg-lighter: #2d4a6d;       /* Soft blue-grey */
    
    /* Text Colors */
    --text-primary: #f8fafc;     /* Off-white */
    --text-secondary: #cbd5e1;   /* Light grey */
    --text-muted: #94a3b8;      /* Muted grey */
    
    /* Border Colors */
    --border-color: #1b3a57;     /* Matches bg-light */
    --border-light: #2d4a6d;     /* Matches bg-lighter */

    /* Root Nav-Bar */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 78px;
    --sidebar-bg: #102a43;
    --sidebar-hover-bg: #1d1b31;
    --text-color: #fff;
    --transition-speed: 0.5s;
    --active-link-color: #0088cc;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  
  /* Border Radius */
  --border-radius-sm: 0.25rem;
  --border-radius-md: 0.5rem;
  --border-radius-lg: 0.75rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Header sizing */
  --settings-header-height: 48px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
  }

  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  
  body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
  }
  
  .camtelli-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }
  
  
  /* Header Styles */
  .settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-xl);
    background-color: var(--bg-medium);
    border-bottom: 1px solid var(--border-color);
    min-height: var(--settings-header-height);
  }
  
  .hidden { 
    display: none !important; 
  }
  
  .logo-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
  }
  
  .logo-container i {
    font-size: 1.8rem;
    color: var(--primary-color);
  }
  
  .logo-container h1 {
    font-size: 1.5rem;
    font-weight: 600;
  }

  /* Logo as image: tie size to header height, keep aspect ratio */
  .logo-link {
    display: inline-flex;
    align-items: center;
  }

  .logo-img {
    max-height: calc(var(--settings-header-height) * 0.85);
    height: auto;
    width: auto;
    display: block;
  }

  /* License badge (moved from inline styles in header.ejs) */
  .license-badge {
    margin-left: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #fff;
  }
  .license-badge.ok { background: #2e7d32; }
  .license-badge.bad { background: #b71c1c; }
  
  .user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
  }
  
  .user-name {
    font-weight: 500;
  }
  
  .user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
  position: relative;
  }
  
  .user-avatar i {
    font-size: 1.2rem;
  }

/* Avatar button + witness timer overlay */
.avatar-button {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.avatar-button img {
  display: block;
  width: 80%;
  height: 80%;
  object-fit: cover;
  border-radius: 50%;
}

.witness-timer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 1.4rem;
  padding: 0 0.2rem;
  border-radius: 999px;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
  box-shadow: var(--shadow-sm);
}

/* Avatar dropdown menu */
.avatar-menu {
  position: absolute;
  top: calc(100% + var(--spacing-xs));
  right: 0;
  background-color: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 9rem;
  z-index: 1000;
  padding: var(--spacing-xs) 0;
}

.avatar-menu button {
  width: 100%;
  padding: var(--spacing-xs) var(--spacing-md);
  border: none;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  font-size: 0.85rem;
  cursor: pointer;
  display: block;
}

.avatar-menu button:hover {
  background-color: var(--bg-lighter);
}
  
  /* Main Content Styles */
  .settings-main {
    display: flex;
    flex: 1;
  }
  
  /* Content Styles */
  .settings-content {
    flex: 1;
    padding: var(--spacing-xl);
    overflow-y: auto;
  }
  
  .settings-panel {
    display: none;
  }
  
  .settings-panel.active {
    display: block;
  }
  
  .settings-panel h2 {
    margin-bottom: var(--spacing-xl);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.5rem;
  }
  
  /* Card Styles */
  .settings-card {
    background-color: var(--bg-medium);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: var(--spacing-xl);
    overflow: hidden;
  }
  
  .settings-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-light);
  }
  
  .settings-card-header h3 {
    font-size: 1.1rem;
    font-weight: 500;
  }
  
  .settings-card-body {
    padding: var(--spacing-lg);
  }
  
  /* Button Styles */
  .btn-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
  }
  
  .btn-icon:hover {
    background-color: var(--bg-lighter);
    color: var(--text-primary);
  }
  
  .refresh-btn, .help-btn, .add-btn {
    background-color: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast), color var(--transition-fast);
  }
  
  .refresh-btn:hover, .help-btn:hover {
    background-color: var(--bg-lighter);
    color: var(--text-primary);
  }
  
  .add-btn {
    color: var(--success-color);
  }
  
  .add-btn:hover {
    background-color: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
  }
  
  .btn-save {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--border-radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-fast);
  }
  
  .btn-save:hover {
    background-color: var(--primary-hover);
  }
  
  .btn-cancel, .btn-close {
    background-color: var(--bg-lighter);
    color: var(--text-primary);
    border: none;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--border-radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-fast);
  }
  
  .btn-cancel:hover, .btn-close:hover {
    background-color: var(--secondary-color);
  }

  .btn-secondary {
    background:
      linear-gradient(180deg,
        rgba(0, 84, 159, 0.20) 0%,
        rgba(0, 84, 159, 0.12) 100%);
    color: var(--text-primary);
    border: 1px solid rgba(96, 120, 144, 0.45);
    border-top-color: rgba(203, 213, 225, 0.18);
    border-radius: 999px;
    padding: 0.38rem 0.8rem;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow:
      inset 0 1px 0 rgba(248, 250, 252, 0.06),
      0 1px 2px rgba(0, 0, 0, 0.22);
    transition:
      background-color var(--transition-fast),
      border-color var(--transition-fast),
      color var(--transition-fast),
      transform var(--transition-fast),
      box-shadow var(--transition-fast);
  }
  .btn-secondary:hover {
    background:
      linear-gradient(180deg,
        rgba(0, 84, 159, 0.30) 0%,
        rgba(0, 84, 159, 0.18) 100%);
    border-color: rgba(0, 152, 218, 0.55);
    color: #ffffff;
    box-shadow:
      inset 0 1px 0 rgba(248, 250, 252, 0.10),
      0 4px 10px rgba(0, 0, 0, 0.22);
    transform: translateY(-1px);
  }
  .btn-secondary:active {
    transform: translateY(0);
    box-shadow:
      inset 0 1px 2px rgba(0, 0, 0, 0.25),
      0 1px 3px rgba(0, 0, 0, 0.18);
  }
  .btn-secondary:focus-visible {
    outline: none;
    border-color: var(--info-color);
    box-shadow:
      0 0 0 3px rgba(0, 152, 218, 0.22),
      inset 0 1px 0 rgba(248, 250, 252, 0.08);
  }
  .btn-secondary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
  }
  
  
  /* Info Grid Styles */
  .info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--spacing-lg);
  }
  
  .info-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
  }
  
  .info-label {
    color: var(--text-muted);
    font-size: 0.9rem;
  }
  
  .info-value {
    font-weight: 500;
    font-size: 1.1rem;
  }
  
  /* Progress Bar Styles */
  .progress-container {
    width: 100%;
    height: auto;
    background-color: var(--bg-light);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    margin-top: var(--spacing-xs);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: var(--spacing-xs);
  }
  
  .search-status-text {
    font-size: 0.9rem;
    margin-bottom: var(--spacing-xs);
    color: var(--text-secondary);
  }
  
  .progress-bar {
    height: 1rem;
    background-color: var(--primary-color);
    background-image: linear-gradient(45deg, 
      rgba(255, 255, 255, 0.15) 25%, 
      transparent 25%, 
      transparent 50%, 
      rgba(255, 255, 255, 0.15) 50%, 
      rgba(255, 255, 255, 0.15) 75%, 
      transparent 75%, 
      transparent);
    background-size: 1rem 1rem;
    border-radius: var(--border-radius-sm);
    text-align: center;
    font-size: 0.75rem;
    color: white;
    line-height: 1rem;
    transition: width 0.3s ease;
    animation: progress-bar-stripes 1s linear infinite;
  }
  
  .progress-label {
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
  }
  
  .search-summary-box {
    background-color: var(--bg-light);
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-md);
    margin-top: var(--spacing-xs);
    border: 1px solid var(--border-light);
  }
  
  .search-summary-box #cameras-found {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
  }
  
  .search-summary-box #search-details {
    font-size: 0.9rem;
    color: var(--text-secondary);
  }
  
  .search-results-summary {
    margin-top: var(--spacing-md);
  }
  
  @keyframes progress-bar-stripes {
    from { background-position: 1rem 0; }
    to { background-position: 0 0; }
  }
  
  /* Form Styles */
  .settings-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
  }
  
  .form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
  }

/* Capability list: alternating background stripes for better visual separation */
.capability-list .form-group {
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--border-radius-sm);
}

.capability-list .form-group:nth-child(odd) {
  background-color: var(--bg-light);
}

.capability-list .form-group:nth-child(even) {
  background-color: var(--bg-medium);
}
  
  .form-group label {
    font-weight: 500;
    color: var(--text-secondary);
  }
  
  .modern-input, .modern-select {
    background-color: var(--bg-light);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius-md);
    font-size: 1rem;
    transition: border-color var(--transition-fast);
  }
  
  .modern-input:focus, .modern-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
  }
  
  .modern-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
  }
  
  .input-with-unit {
    display: flex;
    align-items: center;
  }
  
  .input-unit {
    background-color: var(--bg-lighter);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    border-left: none;
  }
  
  .input-with-unit .modern-input {
    border-radius: var(--border-radius-md) 0 0 var(--border-radius-md);
  }
  
  .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
  }
  
  /* Toggle Switch Styles */
  .toggle-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .toggle {
    position: relative;
    display: inline-block;
    width: 3rem;
    height: 1.5rem;
  }
  
  .toggle input {
    opacity: 0;
    width: 0;
    height: 0;
  }
  
  .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-light);
    transition: var(--transition-normal);
    border-radius: 1.5rem;
  }
  
  .toggle-slider:before {
    position: absolute;
    content: "";
    height: 1.1rem;
    width: 1.1rem;
    left: 0.2rem;
    bottom: 0.2rem;
    background-color: var(--text-secondary);
    transition: var(--transition-normal);
    border-radius: 50%;
  }
  
  input:checked + .toggle-slider {
    background-color: var(--primary-color);
  }
  
  input:checked + .toggle-slider:before {
    transform: translateX(1.5rem);
    background-color: white;
  }
  
  /* Camera Grid Styles */
  .camera-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--spacing-lg);
  }
  
  .camera-card {
    background-color: var(--bg-light);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
  }
  
  .camera-preview {
    position: relative;
    height: 180px;
    overflow: hidden;
  }
  
  .camera-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  .camera-status {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
  }
  
  .camera-status.online {
    background-color: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
  }
  
  .camera-status.offline {
    background-color: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
  }
  
  .camera-info {
    padding: var(--spacing-md);
  }
  
  .camera-info h4 {
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
  }
  
  .camera-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-md);
  }
  
  .camera-actions {
    display: flex;
    gap: var(--spacing-sm);
  }
  
  /* Storage Overview Styles */
  .storage-overview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
  }
  
  .storage-chart-container {
    width: 100%;
    height: 250px;
  }
  
  .storage-stats {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
  }
  
  .stat-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
  }
  
  .stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
  }
  
  .stat-value {
    font-weight: 500;
    font-size: 1.1rem;
  }
  
  /* Modal Styles */
  .modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
  }
  
  .modal.active {
    display: flex;
  }
  
  .modal-content {
    background-color: var(--bg-medium);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
  }
  
  .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
  }
  
  .modal-header h3 {
    font-size: 1.2rem;
    font-weight: 500;
  }
  
  .close-modal {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    transition: background-color var(--transition-fast), color var(--transition-fast);
  }
  
  .close-modal:hover {
    background-color: var(--bg-lighter);
    color: var(--text-primary);
  }
  
  .modal-body {
    padding: var(--spacing-lg);
    flex: 1;
    overflow-y: auto;
  }
  
  .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--border-color);
  }
  
  /* Help Content Styles */
  .help-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
  }
  
  .help-note {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: rgba(59, 130, 246, 0.1);
    border-radius: var(--border-radius-md);
    border-left: 3px solid var(--info-color);
  }
  
  .help-note i {
    color: var(--info-color);
    font-size: 1.2rem;
    margin-top: 0.2rem;
  }
  
  /* Tooltip Styles */
  [data-tooltip] {
    position: relative;
  }
  
  [data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 10;
    margin-bottom: var(--spacing-xs);
    box-shadow: var(--shadow-md);
  }
  
  /* Toast Notification Styles */
  .toast-container {
    position: fixed;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    z-index: 1000;
  }
  
  .toast {
    background-color: var(--bg-medium);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    min-width: 300px;
    max-width: 450px;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 4.7s forwards;
  }
  
  .toast.success {
    border-left-color: var(--success-color);
  }
  
  .toast.error {
    border-left-color: var(--danger-color);
  }
  
  .toast.warning {
    border-left-color: var(--warning-color);
  }
  
  .toast.info {
    border-left-color: var(--info-color);
  }
  
  .toast-icon {
    font-size: 1.2rem;
  }
  
  .toast.success .toast-icon {
    color: var(--success-color);
  }
  
  .toast.error .toast-icon {
    color: var(--danger-color);
  }
  
  .toast.warning .toast-icon {
    color: var(--warning-color);
  }
  
  .toast.info .toast-icon {
    color: var(--info-color);
  }
  
  .toast-content {
    flex: 1;
  }
  
  .toast-title {
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
  }
  
  .toast-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
    max-height: 150px;
    overflow-y: auto;
    white-space: pre-line;
  }
  
  .toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
  }
  
  @keyframes slideIn {
    from {
      transform: translateX(100%);
      opacity: 0;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }
  
  @keyframes fadeOut {
    from {
      opacity: 1;
    }
    to {
      opacity: 0;
    }
  }
  
  /* For multiline toast messages */
  .toast.multiline {
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 6.7s forwards;
  }
  
  .toast.multiline .toast-message {
    margin-top: var(--spacing-sm);
    padding-right: var(--spacing-sm);
  }
  
  /* Responsive Styles */
  @media (max-width: 1024px) {
    .storage-overview {
      grid-template-columns: 1fr;
    }
  }
  
  @media (max-width: 768px) {
    .settings-main {
      flex-direction: column;
    }
    
    .settings-sidebar {
      width: 100%;
      border-right: none;
      border-bottom: 1px solid var(--border-color);
    }
    
    .settings-nav {
      display: flex;
      overflow-x: auto;
      padding: var(--spacing-sm);
    }
    
    .settings-nav li {
      padding: var(--spacing-sm) var(--spacing-md);
      white-space: nowrap;
    }
    
    .settings-nav li.active {
      border-left: none;
      border-bottom: 3px solid var(--primary-color);
    }
    
    .info-grid {
      grid-template-columns: 1fr;
    }
  }
  
  @media (max-width: 480px) {
    .settings-header {
      flex-direction: column;
      gap: var(--spacing-md);
      text-align: center;
    }
    
    .camera-grid {
      grid-template-columns: 1fr;
    }
    
    .modal-content {
      width: 95%;
    }
  }

.login form{
    position: absolute;
    height: 410px;
    width: 400px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-sizing: border-box;
    background-color: #1d1b31;
    border: 3px solid #3b3a42;
    border-radius: 30px;
    letter-spacing: 0.6px;
    padding: 10px 30px 20px 30px;
}
.login form label, .login form a{
    color: rgba(255,255,255,0.95);
}
.login form h3{
    color: rgba(255,255,255,0.95);
    font-size: 30px;
    font-weight: 450;
}
.login label{
    display: block;
    margin-top: 20px;
    font-size: 15px;
    font-weight: 450;
}
.login input{
    display: block;
    height: 40px;
    width: 100%;
    color: rgba(255,255,255,0.95);
    background-color: #2f2d41;
    border-radius: 4px;
    padding: 0 10px;
    margin-top: 5px;
    font-size: 15px;
    border: none;
    outline: none;
}
login input::placeholder{
    color: rgba(255,255,255,0.95);
}
.login button{
    margin: 40px 0px 5px 0px;
    width: 100%;
    background-color: rgba(255,255,255,0.93);
    color: #1d1b31;
    padding: 10px 0;
    font-size: 20px;
    font-weight: 450;
    border-radius: 10px;
}
.login button:hover {
    background-color: rgba(255,255,255,1.0); 
  }

tr:nth-child(even) {
    background-color: #00549f1f;
    /* background-color: #00549f42; */
}


/* TIMEPICKER STYLE */

.container {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}


/* TIMEPICKER CONTAINER */


.timepicker_container {
    background: linear-gradient(#00549f1f, #00549fbd);
    display: flex;
    flex-direction: column;
    padding: 1rem;
}
.timepicker_week_container {
    display: flex;
}
.timepicker_blind {
    width: 100px;
    height: 25px;
    margin: 2px;
}
.timepicker_weekday {
    width: 100px;
    border: solid 1px white;
    color: #00549f;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2px;
}
.timepicker_hour {
    display: flex;
}
.timepicker_time {
    width: 100px;
    height: 25px;
    color: white;
    background-color: #00549f;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2px;
    font-size: 14px;
}
.task {
    background-color: white;
    height: 25px;
    width: 100px;
    margin: 2px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
}

/* NVR */

.nvr-wrapper {
    height: calc(100vh - 30px); /* Subtract header height */
    display: grid;
    position: relative;
    box-sizing: border-box;
    grid-template-columns: minmax(160px, var(--menu-width, 160px)) auto; /* Make menu width variable, with a minimum size */
    grid-template-rows: minmax(0, 1fr); /* Explicitly define a single flexible row */
    max-height: calc(100vh - 30px); /* Ensure it never exceeds viewport height */
    background: rgba(11, 11, 26, 0.95); 
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3); /* Inner shadow for depth - From nvr-enhancements */
}
.nvrMenu {
    grid-column: 1 / 2;
    grid-row: 1 / 2; /* Occupy the single defined row */
    overflow-y: auto; /* Allow vertical scrolling */
    overflow-x: visible; /* Always allow elements to overflow horizontally */
    scrollbar-width: none; /* For Firefox */
    position: relative; /* Required for resize handle positioning */
    transition: width 0.1s ease; /* Smooth transition when resizing programmatically */
    resize: horizontal; /* Native resizing - backup method */
    /* background-color: rgba(11, 11, 26, 0.95);  */
    border-right: 1px solid rgba(94, 94, 153, 0.2); /* Subtle separator - From nvr-enhancements */
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.4); /* Edge shadow for depth - From nvr-enhancements */
    padding-right: 10px; /* Add padding for the resize handle */
}

/* Hide scrollbar for WebKit/Blink based browsers */
.nvrMenu::-webkit-scrollbar {
    display: none; /* From home-styles */
    width: 6px; /* Narrow scrollbar - From nvr-enhancements */
}

/* Added from nvr-enhancements */
.nvrMenu::-webkit-scrollbar-track {
    background: rgba(17, 16, 29, 0.7); /* Dark track */
}

/* Added from nvr-enhancements */
.nvrMenu::-webkit-scrollbar-thumb {
    background: rgba(94, 94, 153, 0.5); /* Blue-ish thumb */
    border-radius: 3px; /* Rounded corners */
}

/* Added from nvr-enhancements */
.nvrMenu::-webkit-scrollbar-thumb:hover {
    background: rgba(94, 94, 153, 0.7); /* Darker on hover */
}

/* Toggle button for NVR Menu */
.nvr-menu-toggle-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1050; /* Ensure it's above other elements like the resize handle */
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 28px; /* Slightly smaller */
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, left 0.3s ease; /* Added left transition */
}

.nvr-menu-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

.nvr-menu-toggle-btn img {
    width: 14px; /* Adjust for your chevron icon */
    height: 14px;
    filter: invert(1); /* Assuming a white icon is needed */
    transition: transform 0.3s ease;
    transform: rotate(90deg); /* Point right (to expand/show) when menu is initially visible */
}

/* Styles for when the menu is collapsed */
.nvr-wrapper.menu-collapsed {
    grid-template-columns: 0px auto;
}

.nvr-wrapper.menu-collapsed .nvrMenu {
    display: none;
}


.nvr-wrapper.menu-collapsed .nvr-menu-toggle-btn img {
    transform: rotate(-90deg); /* Point left (to collapse/hide) when menu is hidden */
}

/* Resize handle for the menu */
.menu-resize-handle {
    position: absolute;
    top: 0;
    right: 1px;
    width: 4px; /* Content width */
    height: 100%;
    cursor: col-resize;
    z-index: 100;
    background: rgba(11, 11, 26, 0.95);
    border-right: 1px solid rgba(94, 94, 153, 0.5); /* Subtle left border */
    transition: background-color 0.2s ease, background 0.2s ease; /* Added background to transition */
}

.menu-resize-handle:hover,
.menu-resize-handle.active {
    background-color: rgba(94, 94, 153, 0.8); /* Kept hover/active background color */
    background: rgba(94, 94, 153, 0.8); /* Ensure gradient is overridden on hover */
}

/* Make menu elements responsive to container width */
.nvrMenuElement {
    display: grid;
    grid-template-columns: calc(100% - 35px) 35px; /* Make thumbnail area responsive */
    grid-template-rows: 20px 27px 27px 14px;
    /* margin-bottom: 10px; From home-styles, overridden below */
    /* background-color: #1d1b31; From home-styles, overridden below */
    /* width: calc(100% - 10px); From home-styles, overridden below */
    /* margin-left: 5px; From home-styles, overridden below */
    /* margin-right: 5px; From home-styles, overridden below */

    /* Added/Merged from nvr-enhancements.css */
    background: linear-gradient(to bottom, #232342, #1d1b31); /* Gradient background */
    border-radius: 3px; /* Rounded corners */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Shadow for depth */
    overflow: hidden; /* Keep content within rounded corners */
    transition: all 0.2s ease; /* Smooth hover effect */
    margin: 8px 4px; /* Adjusted margins */
    border: 1px solid rgba(94, 94, 153, 0.2); /* Subtle border */
    width: calc(100% - 8px); /* Make it responsive to container width */
}

/* Added from nvr-enhancements.css */
.nvrMenuElement:hover {
    transform: translateY(-2px); /* Slight raise effect on hover */
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3); /* Enhanced shadow on hover */
    border-color: rgba(94, 94, 153, 0.4); /* More visible border on hover */
}


/* Adjust thumbnail to be responsive */
.thumb {
    grid-column: 1 / 2;
    grid-row: 1 / 5;
    width: 100%; /* From home-styles, duplicated below */
    overflow: hidden; /* From home-styles, duplicated below */

    /* Added/Merged from nvr-enhancements.css */
    position: relative; /* For overlay effects */
    height: 100%; /* Fill the grid area */
}

.thumb img {
    width: 100%; /* From home-styles, duplicated below */
    height: auto; /* From home-styles, overridden by 100% below */
    object-fit: cover; /* From home-styles, duplicated below */

    /* Added/Merged from nvr-enhancements.css */
    transition: transform 0.3s ease; /* Smooth zoom effect */
    height: 100%; /* Fill the container */
}

/* Added from nvr-enhancements.css */
.nvrMenuElement:hover .thumb img {
    transform: scale(1.03); /* Subtle zoom on hover */
}

/* Group buttons enhancement */
.group-button-container {
  margin: 5px;
  display: flex;
  align-items: center;
  padding: 0;
  transition: all 0.2s ease;
  position: relative;
}

/* Group and grid element styles - consolidated */
.grp-name {
  background: linear-gradient(to right, #2e2e4a, #212146);
  color: #fff;
  border-radius: 3px;
  padding: 6px 10px;
  flex: 1;
  min-width: 0;
  transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  overflow: hidden;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
}

/* Add hover effect for the group name */
.grp-name:hover {
  background: linear-gradient(to right, #3a3a5a, #2a2a56);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Style the edit button to make it more visible */
.grp-name-edit-btn {
  width: 0;
  height: 24px;
  padding: 2px;
  border-radius: 50%;
  background-color: #3a4ed5;
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, width 0.3s ease, background-color 0.3s ease, margin-left 0.3s ease;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3);
  will-change: opacity, width, margin-left;
  margin-left: 0;
  overflow: hidden;
}

/* Button image sizing */
.grp-name-edit-btn img {
  width: 16px;
  height: 16px;
  filter: brightness(2);
}

/* Make sure the button appears properly on hover */
.group-button-container:hover .grp-name-edit-btn {
  opacity: 1;
  width: 24px;
  margin-left: 5px;
  pointer-events: auto;
}

/* Additional hover effect for the button itself */
.grp-name-edit-btn:hover {
  opacity: 1 !important; 
  background-color: var(--primary-color);
  transform: scale(1.05);
  pointer-events: auto !important;
}

/* Active group button style */
.grp-name.active {
  background: linear-gradient(to right, #3f3f87, #323278);
  border-left: 3px solid #5c5cd6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}

.grp-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  padding-right: 5px;
}

/* cameraTitle from home-styles.css (base) */
.cameraTitle {
    grid-column: 1 / 3;
    grid-row: 1 / 2;
    height: 20px;
    z-index: +1;
    background: linear-gradient(to right, rgba(36, 36, 72, 0.9), rgba(29, 27, 49, 0.8)); /* Gradient background */
    color: #fff;
    padding: 0px 8px; /* Better padding */
    font-size: 13px;
    font-weight: 400;
    text-overflow: ellipsis; /* Add ellipsis for long text */
    white-space: nowrap; /* Prevent wrapping */
    overflow: hidden; /* Hide overflow */
    border-bottom: 1px solid rgba(94, 94, 153, 0.3); /* Bottom separator */
    cursor: pointer; /* Show pointer cursor to indicate clickable */
    transition: background 0.2s ease; /* Smooth transition */
}

/* Added from nvr-enhancements.css */
.cameraTitle:hover {
    background: linear-gradient(to right, rgba(46, 46, 92, 0.9), rgba(39, 37, 69, 0.8)); /* Lighter gradient on hover */
    color: #fff; /* Ensured from nvr-enhancements */
}

.videoButtonOne {
    grid-column: 2 / 3;
    grid-row: 2 / 3;  
    display: flex; /* From home-styles, duplicated below */
    justify-content: center; /* From home-styles, duplicated below */
    /* Added/Merged from nvr-enhancements.css */
    align-items: center;
}
.videoButtonTwo {
    grid-column: 2 / 3;
    grid-row: 3 / 4;   
    position: relative;
    display: flex; /* From home-styles, duplicated below */
    justify-content: center; /* From home-styles, duplicated below */
    /* Added/Merged from nvr-enhancements.css */
    align-items: center;
}
.liveButton {
    padding: 12px;
    border: 0;
    color: transparent;
    background-color: transparent;
    background-image: URL(../images/cam-60.svg);
    background-size: cover;
    /* Added/Merged from nvr-enhancements.css */
    opacity: 0.7; /* Slightly transparent by default */
    transition: all 0.2s ease; /* Smooth hover effect */
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3)); /* Shadow effect */
    max-width: 100%; /* Ensure button doesn't overflow */
    box-sizing: border-box; /* Include padding in width calculation */
 }

 /* Added from nvr-enhancements.css */
 .liveButton:hover, .playButton:hover {
    opacity: 1; /* Full opacity on hover */
    transform: scale(1.05); /* Slightly reduced scale from 1.1 to prevent overflow */
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4)) brightness(1.2); /* Enhanced shadow and brightness */
}

 .playButton {
    padding: 12px;
    border: 0;
    color: transparent;
    background-color: transparent;
    background-image: URL(../images/play-60.svg);
    background-size: cover;
    /* Added/Merged from nvr-enhancements.css */
    opacity: 0.7; /* Slightly transparent by default */
    transition: all 0.2s ease; /* Smooth hover effect */
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3)); /* Shadow effect */
    max-width: 100%; /* Ensure button doesn't overflow */
    box-sizing: border-box; /* Include padding in width calculation */
 }
 
 .removeButton {
    position: absolute;
    z-index: +2;
    border: 0;
    color: transparent;
    /* background-color: transparent; */
    background-color: rgba(80, 0, 0, 0.9); /* Darker red on hover - this makes sense to add for hover*/
    background-image: URL(../images/delete-60.svg);
    background-size: cover;
    visibility: hidden;
    opacity: 0.7; /* Slightly transparent by default */
    transition: all 0.2s ease; /* Smooth hover effect */
    /* background-color: rgba(50, 0, 0, 0.7); Red-tinted background - from enhancements, let's keep the original transparent one and rely on image */
    border-radius: 50%; /* Circular */
    padding: 12px; /* Padding */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4); /* Shadow */
 }

/* Added from nvr-enhancements.css */
.removeButton:hover {
    opacity: 1; /* Full opacity on hover */
    transform: scale(1.1); /* Slight enlargement on hover */
    background-color: rgba(80, 0, 0, 0.9); /* Darker red on hover - this makes sense to add for hover*/
}

.videoPanel {
    grid-column: 2 / 3;
    grid-row: 1 / 2; /* Occupy the single defined row */
    height: 100%;
    width: 100%;
    max-width: 100%;
    position: relative;
    flex-wrap: wrap;
    overflow: hidden; /* Prevent scrolling in the videoPanel */
    background: rgba(255,255,255,0.07);
}

.videoLive {
    margin: 0 auto;
    /* height: calc(100% - 120px); */ /* MOVED to .videoLive.playBack */
    /* min-height: 0; */ /* MOVED to .videoLive.playBack */
    height: 100%; /* Restore to full height by default */
    flex: 1; /* Add flex back for default live view behavior if needed, or manage via JS */
    width: 100%;
    max-width: calc(100% - 10px); /* Account for margin */
    object-fit: contain; /* Preserve aspect ratio */
    display: block; /* Remove any inline spacing issues */
}

/* Styles for when .videoLive is in playback mode (with timeline) */
.videoLive.playBack {
    height: calc(100% - 120px); /* 120px is the known timeline height */
    min-height: 0; /* Allow it to shrink fully if calc results in a small value */
    flex: none; /* Override flex: 1 if it was added back to .videoLive general rule */
}

.remove {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden; /* Add this! It's crucial. */
}
.groupPanel {
    height: 100%;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    align-content: flex-start;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start; /* Added as a default based on JS */
    padding: 10px;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.4); /* Inner shadow for depth */
    border-radius: 4px; /* Slightly rounded corners */
}

/* Group panel element styles */
.grpEl {
    background-color: rgba(255, 255, 255, 0.05) !important; /* Slightly lighter background */
    border: 1px solid rgba(120, 120, 180, 0.2) !important; /* More subtle border */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important; /* Softer shadow */
    border-radius: 3px !important;
    margin: 5px 5px 5px 5px !important; /* Consistent margin */
    /* overflow: hidden !important; conflict on Firefox */
    position: relative !important; /* For overlay positioning */
    display: flex !important; /* Use flexbox for alignment */
    justify-content: center !important; /* Center content horizontally */
    align-items: center !important; /* Center content vertically */
    object-fit: cover !important;
    object-position: 50% 0% !important; /* Keep the top of the video visible, crop from bottom */
    box-sizing: border-box !important;
    min-width: 0; /* Added from JS inline style */
}

.grpEl:hover {
    /* transform: translateY(-2px);  */
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3); /* Enhanced shadow on hover */
    border-color: rgba(94, 94, 153, 0.4); /* More visible border on hover */
}

.grpCam-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    background-size: cover;
    background-position: center center;
    filter: blur(4px) brightness(0.7);
    z-index: 5;
    transition: opacity 0.5s ease;
}

.grpElOverlay {
  position: absolute;
  z-index: +1;
  height: 25px;
  border-radius: 5px;
  padding: 2px 0px 0px 6px;
  color: #fff;
  visibility: hidden;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: opacity 0.2s ease, visibility 0.2s ease;
  font-size: 13px;
  background: linear-gradient(to right, rgba(29, 27, 69, 0.8), rgba(29, 27, 49, 0.6));
}

/* Drag n Drop */
.draggable {  
    cursor: move;
}
.draggable.dragging {
    opacity: .5 ;
}

/* Outer Border */
.vis-timeline {
    border: 0 !important;
}

.vis-item.vis-background {
    background-color: greenyellow !important;
    color: greenyellow !important;
    border-radius: 0 !important;
}

.vis-item {
    border-color: #1d1b31;
    background-color: #1d1b31;
  }

.vis-foreground .vis-group {
    border-bottom: 0px !important;
}

/*Messstriche*/
.vis-time-axis .vis-grid.vis-vertical {
    position:absolute;
    border-width: 3px !important;
    border-left-style: solid !important;
    border-image: 
    linear-gradient(
      to bottom, 
      red, 
      rgba(0, 0, 0, 0)
    ) 1 100%;
  }

.vis-panel.vis-bottom,
.vis-panel.vis-center,
.vis-panel.vis-top {
    border-left-style: hidden !important;
    border-right-style:hidden !important;
  }


.vis-panel.vis-center,
.vis-panel.vis-left,
.vis-panel.vis-right {
border-top-style:hidden !important;
border-image: linear-gradient(to right, #3acfd5 0%, #3a4ed5 100%) 1 !important;
border-width: 3px !important;
border-bottom-style: solid !important;
}

/* NAV-BAR */

/* Modern Navigation Styles - No jQuery Required */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');


.sidebar * {
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

.sidebar {
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  background: var(--bg-medium);
  border-right: 1px solid var(--border-color);
  padding: var(--spacing-md) 0;
  min-height: 100vh;
  z-index: 100;
  transition: width var(--transition-speed) ease;
}

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

.sidebar.close .logo-details .logo_name {
  opacity: 0;
  pointer-events: none;
  transition-delay: 0s;
}

.sidebar .nav-links {
  height: 100%;
  padding: 30px 0 100px 0;
  overflow: auto;
  scrollbar-width: none; /* Firefox */
}

.sidebar .nav-links::-webkit-scrollbar {
  display: none;
}

.sidebar.close .nav-links {
  overflow: visible;
}

.sidebar .nav-links li {
  position: relative;
  list-style: none;
  transition: background 0.4s ease;
}

.sidebar .nav-links li:hover {
  background-color: var(--bg-light);
  color: var(--text-primary);
}

.sidebar .nav-links li .icon-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar.close .nav-links li .icon-link {
  display: block;
}

.sidebar .nav-links li img {
  height: 50px;
  min-width: var(--sidebar-collapsed-width);
  padding: 10px;
  text-align: center;
  line-height: 50px;
  color: var(--text-color);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.navigation-icon {
  width: 25px;
  height: 25px;
}

img.arrow {
  padding: 17px !important;
  text-align: left !important;
  transition: transform 0.3s ease;
}

.sidebar .nav-links li.showMenu img.arrow {
  transform: rotate(-180deg);
}

.sidebar.close .nav-links img.arrow {
  display: none;
}

.sidebar .nav-links li a {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.sidebar .nav-links li a.active,
.sidebar .nav-links li a:hover {
  opacity: 1;
}

.sidebar .nav-links li div.active {
  background-color: var(--bg-light);
  color: var(--primary-color);
  border-left: 3px solid var(--primary-color);
}

.sidebar .nav-links li a .link_name {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-color);
  transition: opacity 0.4s ease;
}

.sidebar.close .nav-links li a .link_name {
  opacity: 0;
  pointer-events: none;
}

.sidebar .nav-links li .sub-menu {
  padding: 6px 6px 14px 80px;
  margin-top: -10px;
  background-color: var(--bg-light);
  color: var(--primary-color);
  border-left: 3px solid var(--primary-color);
  display: none;
}

.sidebar .nav-links li.showMenu .sub-menu {
  display: block;
}

.sidebar .nav-links li .sub-menu a {
  color: var(--text-color);
  font-size: 15px;
  padding: 5px 0;
  white-space: nowrap;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.sidebar .nav-links li .sub-menu a:hover {
  opacity: 1;
}

.sidebar .nav-links li .sub-menu a.active {
  opacity: 1;
  font-weight: 500;
  background-color: rgba(255, 255, 255, 0.05);
}

.sidebar.close .nav-links li .sub-menu {
  position: absolute;
  left: 100%;
  top: -10px;
  margin-top: 0;
  padding: 10px 20px;
  border-radius: 0 6px 6px 0;
  opacity: 0;
  display: block;
  pointer-events: none;
  transition: 0s;
  background: var(--sidebar-hover-bg);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}

.sidebar.close .nav-links li:hover .sub-menu {
  top: 0;
  opacity: 1;
  pointer-events: auto;
  transition: all 0.4s ease;
}

.sidebar .nav-links li .sub-menu .link_name {
  display: none;
}

.sidebar.close .nav-links li .sub-menu .link_name {
  font-size: 18px;
  opacity: 1;
  display: block;
}

.sidebar .nav-links li .sub-menu.blank {
  opacity: 1;
  pointer-events: auto;
  padding: 3px 20px 6px 16px;
  opacity: 0;
  pointer-events: none;
}

.sidebar .nav-links li:hover .sub-menu.blank {
  top: 50%;
  transform: translateY(-50%);
}

.sidebar .footer {
  position: fixed;
  bottom: 0;
  width: var(--sidebar-width);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-medium);
  padding: 12px 0;
  transition: all var(--transition-speed) ease;
  border: 1px solid var(--border-color);
}

.sidebar.close .footer {
  background: none;
  width: var(--sidebar-collapsed-width);
}

.sidebar .footer button {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 4px;
  transition: background 0.3s ease;
}

.sidebar .footer button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.clear {
  clear: both;
}

/* Mobile responsive adjustments */
@media (max-width: 400px) {
  .sidebar.close.small-screen {
    width: 0;
  }
  
  .sidebar.close.small-screen ~ .home-section {
    width: 100%;
    left: 0;
    z-index: 100;
  }

  /* Adjust menu toggle for mobile */
  .bx-menu {
    display: block !important;
  }
  
  /* Make sure submenus are properly positioned on mobile */
  .sidebar.close .nav-links li .sub-menu {
    position: fixed;
    left: 0;
    top: auto;
    width: 100%;
    border-radius: 0;
  }
} 

/* User List Styles */
.user-list {
  display: flex;
  flex-direction: column;
  width: 100%;
  border-radius: var(--border-radius-md);
  overflow: hidden;
}

.list-header {
  display: grid;
  grid-template-columns: repeat(var(--column-count), 1fr) 90px;
  background-color: var(--bg-light);
  padding: var(--spacing-md);
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

.list-item {
  display: grid;
  grid-template-columns: repeat(var(--column-count), 1fr) 90px;
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
  align-items: center;
  transition: background-color var(--transition-fast);
}
.list-item span {
  overflow: hidden; /* Prevent overflow from affecting layout */
  white-space: nowrap; /* Prevent text from wrapping */
  text-overflow: ellipsis; /* Add ellipsis for overflowed text */
}

.list-item:hover {
  background-color: var(--bg-light);
}

.list-item:last-child {
  border-bottom: none;
}

.list-actions {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .list-header, .list-item {
    grid-template-columns: repeat(2, 1fr) 120px;
  }
  
  .list-header span:nth-child(3),
  .list-header span:nth-child(4),
  .list-item span:nth-child(3),
  .list-item span:nth-child(4) {
    display: none;
  }
}

@media (max-width: 480px) {
  .list-header, .list-item {
    grid-template-columns: 1fr 120px;
  }
  
  .list-header span:nth-child(2),
  .list-item span:nth-child(2) {
    display: none;
  }
} 

/* List item styles for camera search */
.list-item.unsaved {
  background-color: rgba(240, 165, 0, 0.1);
  border-left: 3px solid var(--warning-color);
}

.list-item.unsaved:hover {
  background-color: rgba(240, 165, 0, 0.2);
}

.action-btn.add-camera {
  color: var(--success-color);
}

.action-btn.add-camera:hover {
  background-color: rgba(13, 138, 111, 0.1);
}

@media (max-width: 768px) {
  .list-header, .list-item {
    grid-template-columns: 1fr 1fr 1fr 120px;
  }
  .list-header span:nth-child(3),
  .list-item span:nth-child(3) {
    display: none;
  }
}

/* Animation for refresh icon */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.spin-animation {
  animation: spin 1s linear infinite;
}

.input-group {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.input-group .modern-select {
  flex: 1;
  min-width: 0;
}

.input-group .modern-input {
  flex: 1;
}

.stream-mode-toggle.active {
  background-color: var(--bg-lighter);
  color: var(--text-primary);
}

.input-separator {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0 var(--spacing-xs);
}

.form-helper-text {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 4px;
}

/* Add styles for the compact header */
.compact-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background-color: var(--bg-medium);
  border-bottom: 1px solid var(--border-color);
  height: 30px; /* Fix height to match subtraction in nvr-wrapper */
  min-height: 30px; /* Ensure minimum height */
  max-height: 30px; /* Ensure maximum height */
  /*overflow: hidden; Prevent content overflow */
}

.compact-header .header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-header .header-left a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.compact-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.header-controls {
  display: flex;
  gap: 10px;
}

.btn-fullscreen {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border-radius: 3px;
}

.btn-fullscreen:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-fullscreen img {
  filter: invert(1);
}

/* Keep sequencer icon pure white without color shifts */
#toggleSequencer img {
  filter: none;
}

/* Auto-refresh dropdown menu styles */
.auto-refresh-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.btn-auto-refresh {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border-radius: 3px;
}

.btn-auto-refresh:hover {
  background: rgba(255, 255, 255, 0.1);
}

.auto-refresh-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 7rem;
  z-index: 1000;
  padding: var(--spacing-xs) 0;
}

.auto-refresh-option {
  width: 100%;
  padding: var(--spacing-xs) var(--spacing-md);
  border: none;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  font-size: 0.85rem;
  cursor: pointer;
  display: block;
}

.auto-refresh-option:hover {
  background-color: var(--bg-lighter);
}

/* NEW STYLES FROM NVR-ENHANCEMENTS.CSS */

/* Menu header styling (from nvr-enhancements.css) */
.menu-header {
    background: linear-gradient(to right, #1a1a2e, #232342) !important; /* Old Gradient background */
    padding-top: 10px; /* Added from old element style */
    padding-bottom: 10px; /* Added from old element style */
    padding-left: 5px; /* Added from old element style */
    padding-right: 30px !important; /* Ensure space for potential icons/buttons */
    border-bottom: 1px solid rgba(120, 120, 180, 0.3) !important; /* Lighter, more subtle border */
    margin-bottom: 10px !important; /* Old margin */
    cursor: pointer;
    user-select: none;
    position: relative; /* For positioning child elements like chevrons */
    transition: background 0.2s ease; /* Old transition */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);

    /* Added from old styles */
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-header:before { /* Added from old styles */
    content: "";
    display: block;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(94, 94, 153, 0.5), transparent);
    position: absolute;
    width: 80%;
    left: 10%;
    top: 0;
}

.menu-header:hover {
    background: linear-gradient(to right, #212146, #2a2a54) !important; /* Old Hover Gradient */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); /* Kept current enhanced shadow on hover */
}

/* Styles for icons within menu headers */
.menu-header-icon {
    width: 13px;
    height: 13px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.menu-header-chevron {
    right: 10px;
    transition: transform 0.2s ease;
}

.menu-header-action-button { /* for add/hide buttons */
    right: 35px;
    cursor: pointer;
}

/* Attention animation for Add Group button when no groups exist */
/* Multi-layered pulse with glow, scale, and background effects */
@keyframes attention-pulse {
    0%, 100% {
        transform: translateY(-50%) scale(1);
        filter: brightness(1.2) drop-shadow(0 0 2px rgba(200, 220, 255, 0.6));
    }
    25% {
        transform: translateY(-50%) scale(1.25);
        filter: brightness(1.8) drop-shadow(0 0 16px rgba(220, 240, 255, 1)) drop-shadow(0 0 24px rgba(180, 220, 255, 0.8));
    }
    50% {
        transform: translateY(-50%) scale(1.3);
        filter: brightness(2.0) drop-shadow(0 0 20px rgba(255, 255, 220, 1)) drop-shadow(0 0 32px rgba(255, 240, 180, 0.9)) drop-shadow(0 0 40px rgba(255, 220, 140, 0.7));
    }
    75% {
        transform: translateY(-50%) scale(1.25);
        filter: brightness(1.8) drop-shadow(0 0 16px rgba(220, 240, 255, 1)) drop-shadow(0 0 24px rgba(180, 220, 255, 0.8));
    }
}

@keyframes attention-glow-ring {
    0% {
        box-shadow: 0 0 5px 2px rgba(200, 220, 255, 0.6), 0 0 10px 5px rgba(180, 210, 255, 0.4);
        background: radial-gradient(circle, rgba(200, 220, 255, 0.4) 0%, rgba(160, 190, 255, 0.2) 40%, transparent 70%);
    }
    25% {
        box-shadow: 0 0 20px 10px rgba(220, 240, 255, 1), 0 0 35px 18px rgba(200, 230, 255, 0.8), 0 0 50px 25px rgba(180, 220, 255, 0.5);
        background: radial-gradient(circle, rgba(220, 240, 255, 0.6) 0%, rgba(180, 220, 255, 0.4) 40%, transparent 70%);
    }
    50% {
        box-shadow: 0 0 25px 12px rgba(255, 255, 240, 1), 0 0 45px 22px rgba(255, 250, 200, 1), 0 0 65px 32px rgba(255, 240, 160, 0.8), 0 0 85px 42px rgba(255, 230, 120, 0.5);
        background: radial-gradient(circle, rgba(255, 255, 220, 0.7) 0%, rgba(255, 240, 180, 0.5) 40%, transparent 70%);
    }
    75% {
        box-shadow: 0 0 20px 10px rgba(220, 240, 255, 1), 0 0 35px 18px rgba(200, 230, 255, 0.8), 0 0 50px 25px rgba(180, 220, 255, 0.5);
        background: radial-gradient(circle, rgba(220, 240, 255, 0.6) 0%, rgba(180, 220, 255, 0.4) 40%, transparent 70%);
    }
    100% {
        box-shadow: 0 0 5px 2px rgba(200, 220, 255, 0.6), 0 0 10px 5px rgba(180, 210, 255, 0.4);
        background: radial-gradient(circle, rgba(200, 220, 255, 0.4) 0%, rgba(160, 190, 255, 0.2) 40%, transparent 70%);
    }
}

@keyframes attention-ripple {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.8;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.4);
        opacity: 0.3;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

.menu-header-action-button.attention-pulse {
    animation: attention-pulse 2.5s ease-in-out infinite;
}

.menu-header-action-button.attention-pulse::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300%;
    height: 300%;
    border-radius: 50%;
    animation: attention-glow-ring 2.5s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

.menu-header-action-button.attention-pulse::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 150%;
    border-radius: 50%;
    border: 2px solid rgba(58, 140, 255, 0.6);
    animation: attention-ripple 2.5s ease-out infinite;
    pointer-events: none;
    z-index: -2;
}

/* Attention animation for inline images (e.g., camera search icon on welcome page) */
@keyframes attention-pulse-inline {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1.2) drop-shadow(0 0 2px rgba(200, 220, 255, 0.6));
    }
    25% {
        transform: scale(1.2);
        filter: brightness(1.8) drop-shadow(0 0 12px rgba(220, 240, 255, 1)) drop-shadow(0 0 20px rgba(180, 220, 255, 0.8));
    }
    50% {
        transform: scale(1.25);
        filter: brightness(2.0) drop-shadow(0 0 16px rgba(255, 255, 220, 1)) drop-shadow(0 0 28px rgba(255, 240, 180, 0.9)) drop-shadow(0 0 36px rgba(255, 220, 140, 0.7));
    }
    75% {
        transform: scale(1.2);
        filter: brightness(1.8) drop-shadow(0 0 12px rgba(220, 240, 255, 1)) drop-shadow(0 0 20px rgba(180, 220, 255, 0.8));
    }
}

@keyframes attention-glow-background-inline {
    0%, 100% {
        background: radial-gradient(circle at center, rgba(200, 220, 255, 0.4) 0%, rgba(180, 210, 255, 0.2) 30%, transparent 60%);
    }
    25% {
        background: radial-gradient(circle at center, rgba(220, 240, 255, 0.6) 0%, rgba(200, 230, 255, 0.4) 30%, rgba(180, 220, 255, 0.2) 50%, transparent 70%);
    }
    50% {
        background: radial-gradient(circle at center, rgba(255, 255, 220, 0.7) 0%, rgba(255, 240, 180, 0.5) 30%, rgba(255, 230, 160, 0.3) 50%, transparent 70%);
    }
    75% {
        background: radial-gradient(circle at center, rgba(220, 240, 255, 0.6) 0%, rgba(200, 230, 255, 0.4) 30%, rgba(180, 220, 255, 0.2) 50%, transparent 70%);
    }
}

@keyframes attention-ring-inline {
    0% {
        box-shadow: 0 0 8px 4px rgba(200, 220, 255, 0.6), 0 0 15px 8px rgba(180, 210, 255, 0.4);
    }
    25% {
        box-shadow: 0 0 18px 9px rgba(220, 240, 255, 1), 0 0 30px 15px rgba(200, 230, 255, 0.8), 0 0 45px 22px rgba(180, 220, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 22px 11px rgba(255, 255, 240, 1), 0 0 40px 20px rgba(255, 250, 200, 1), 0 0 60px 30px rgba(255, 240, 160, 0.8), 0 0 80px 40px rgba(255, 230, 120, 0.5);
    }
    75% {
        box-shadow: 0 0 18px 9px rgba(220, 240, 255, 1), 0 0 30px 15px rgba(200, 230, 255, 0.8), 0 0 45px 22px rgba(180, 220, 255, 0.5);
    }
    100% {
        box-shadow: 0 0 8px 4px rgba(200, 220, 255, 0.6), 0 0 15px 8px rgba(180, 210, 255, 0.4);
    }
}

.attention-pulse-inline {
    position: relative;
    animation: attention-pulse-inline 2.5s ease-in-out infinite;
}

.attention-pulse-inline::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 350%;
    height: 350%;
    border-radius: 50%;
    animation: attention-glow-background-inline 2.5s ease-in-out infinite, attention-ring-inline 2.5s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

/* Group Container specific styles from nvr-enhancements.css */

/* END OF NEW STYLES FROM NVR-ENHANCEMENTS.CSS */

/* Style for the dynamically added group name in the compact header */
.compact-header-group-name {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: #FFFFFF;
    font-weight: 500;
    padding: 5px 10px;
    background-color: #2a2a4a;
    border-radius: 3px;
    font-size: 15px;
    z-index: 10;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* MJPEG Error Overlay styles */
.mjpeg-error-overlay {
    position: absolute;
    top: 10px; /* Initial position, can be overridden by JS */
    left: 10px; /* Initial position */
    background-color: rgba(0,0,0,0.7);
    color: #ff5555;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    z-index: 100;
    pointer-events: none;
    opacity: 1; /* Initial state */
    transition: opacity 0.5s ease; /* For fade-out */
}

.action-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.action-btn:hover {
  background-color: var(--bg-lighter);
  color: var(--text-primary);
}

