/* Optimotive Updater Web App - Matching Desktop Client Design */

/* CSS Variables for Brand Colors - Matching Website */
:root {
  --brand-primary: #2F2258;          /* Primary purple from website */
  --brand-secondary: #D8D7E3;        /* Secondary light purple-gray */
  --brand-accent: #871A67;           /* Main accent magenta from website */
  --brand-pink: #DB056F;             /* Bright magenta from website */
  --brand-foreground: #FFFFFF;
  --background-light: #FAFAFA;
  --card-background: #FFFFFF;
  --text-primary: #2C3E50;
  --text-secondary: #6C757D;
  --border-light: #E9ECEF;
  --sidebar-gradient: linear-gradient(180deg, #2F2258 0%, #871A67 300px, #871A67 100%);
  --button-solid: #871A67;
  --button-hover: #8f1a4c;
  --button-active: #a93365;
  --card-header-gradient: linear-gradient(90deg, #2F2258 0%, #871A67 100%);
  --accent-gradient: linear-gradient(90deg, #2F2258 0%, #D8D7E3 100%);
}

/* Dark Mode Support */
[data-bs-theme="dark"] {
  --bs-body-bg: #212529;
  --bs-body-color: #dee2e6;
  --bs-secondary-bg: #6c757d;
  --bs-secondary: #6c757d;
  --bs-btn-bg: transparent;
  --bs-btn-border-color: #6c757d;
  --bs-btn-hover-bg: #5a6268;
  --bs-btn-hover-border-color: #545b62;
  --bs-btn-active-bg: #545b62;
  --bs-btn-active-border-color: #4e555b;
}

/* Fix for secondary buttons in dark mode */
[data-bs-theme="dark"] .btn-secondary {
  background-color: #6c757d !important;
  border-color: #6c757d !important;
  color: #fff !important;
}

[data-bs-theme="dark"] .btn-secondary:hover {
  background-color: #5a6268 !important;
  border-color: #545b62 !important;
  color: #fff !important;
}

[data-bs-theme="dark"] .btn-secondary:focus,
[data-bs-theme="dark"] .btn-secondary:active {
  background-color: #545b62 !important;
  border-color: #4e555b !important;
  color: #fff !important;
}

/* Square Button */
.square-btn {
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
  min-width: 32px !important;
  border-radius: 4px !important;
}

/* Base Styles */
html {
  font-size: 14px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--background-light);
  color: var(--text-primary);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  overflow-x: hidden;
}

/* Layout Structure */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-content {
  display: flex;
  flex: 1;
}

/* Top Header */
.top-header {
  background: var(--card-background);
  border-bottom: 2px solid var(--border-light);
  padding: calc(var(--space-1) * 1.5) var(--space-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.header-left .header-logo {
  max-height: 50px;
  height: auto;
  width: auto;
  max-width: 250px;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.header-left a:hover .header-logo {
  opacity: 0.8;
}

.header-right {
  display: flex;
  align-items: center;
}

/* User Profile Menu */
.user-profile {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  position: relative;
}

.user-name {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 14px;
}

.user-menu {
  position: relative;
}

.user-menu-toggle {
  background: transparent;
  border: none;
  color: var(--brand-primary);
  font-size: 18px;
  cursor: pointer;
  padding: var(--space-1);
  border-radius: 6px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: var(--space-0-5);
}

.user-menu-toggle:hover {
  background: var(--background-light);
  color: var(--brand-accent);
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--card-background);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  z-index: 1000;
  display: none;
  overflow: hidden;
}

.user-dropdown.show {
  display: block;
}

.user-dropdown a {
  display: block;
  padding: var(--space-2) var(--space-2);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.3s ease;
}

.user-dropdown a:hover {
  background: var(--background-light);
  color: var(--brand-primary);
}

.user-dropdown hr {
  margin: var(--space-1) 0;
  border: none;
  border-top: 1px solid var(--border-light);
}

.user-dropdown i {
  width: 16px;
  margin-right: 8px;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--sidebar-gradient);
  color: var(--brand-foreground);
  padding: 0;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  transition: width 0.3s ease, margin-left 0.3s ease;
  overflow: hidden;
}

/* Sidebar Toggle Container */
.sidebar-toggle {
  padding: var(--space-1) calc(var(--space-1) * 1.5);
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* Hamburger Menu Button in Sidebar */
.sidebar .hamburger-menu {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  padding: var(--space-1) var(--space-1);
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  width: auto;
}

.sidebar .hamburger-menu:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Adjust padding in collapsed sidebar */
.sidebar.collapsed .sidebar-toggle,
html.sidebar-collapsed .sidebar .sidebar-toggle {
  padding: var(--space-1);
  text-align: center;
}

.sidebar.collapsed .hamburger-menu,
html.sidebar-collapsed .sidebar .hamburger-menu {
  width: 100%;
}

/* Collapsed sidebar styles - show icons only */
.sidebar.collapsed,
html.sidebar-collapsed .sidebar {
  width: 60px;
}

/* Hide text in collapsed sidebar */
.sidebar.collapsed .sidebar-nav a,
html.sidebar-collapsed .sidebar .sidebar-nav a {
  text-align: center;
  padding: var(--space-2) var(--space-1);
  justify-content: center;
}

.sidebar.collapsed .sidebar-nav a i,
html.sidebar-collapsed .sidebar .sidebar-nav a i {
  margin-right: 0;
  font-size: 18px;
}

/* Hide text content in collapsed sidebar */
.sidebar.collapsed .sidebar-nav a span,
.sidebar.collapsed .nav-section-header,
html.sidebar-collapsed .sidebar .sidebar-nav a span,
html.sidebar-collapsed .sidebar .nav-section-header {
  display: none;
}

/* Expanded main content when sidebar is collapsed */
.main-content.expanded,
html.sidebar-collapsed .main-content {
  margin-left: 60px;
  width: calc(100% - 60px);
}

.sidebar-header {
  padding: var(--space-4) var(--space-3);
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--brand-foreground);
}

.sidebar-header p {
  margin: var(--space-1) 0 0 0;
  font-size: 14px;
  opacity: 0.9;
}

.sidebar-logo {
  max-width: 200px;
  max-height: 60px;
  height: auto;
  width: auto;
  margin-bottom: 10px;
  background-color: white;
  padding: var(--space-1) calc(var(--space-1) * 1.5);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Sidebar Navigation */
.sidebar-nav {
  list-style: none;
  padding: var(--space-1) 0 var(--space-3) 0;
  margin: 0;
}

.sidebar-nav li {
  margin: var(--space-0-5) 0;
}

/* Section Headers */
.nav-section-header {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: var(--space-3) var(--space-3) var(--space-1) var(--space-3);
  margin: var(--space-2) 0 var(--space-1) 0;
  border: none;
  background: none !important;
}

.nav-section-header:first-child {
  margin-top: 0;
}

.sidebar-nav a {
  display: block;
  padding: var(--space-2) var(--space-3);
  color: var(--brand-foreground);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  margin: 0 4px;
  transition: all 0.3s ease;
}

.sidebar-nav a:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateX(5px);
  text-decoration: none !important;
}

.sidebar-nav a.active {
  background-color: rgba(255, 255, 255, 0.3);
  font-weight: 600;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: var(--space-5);
  background-color: var(--background-light);
}

.content-header {
  margin-bottom: 40px;
}

.content-header h1 {
  color: var(--brand-primary);
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 10px 0;
}

.content-header .subtitle {
  color: var(--text-secondary);
  font-size: 18px;
  margin: 0;
}

/* Cards */
.card {
  background: var(--card-background);
  border: none;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(74, 44, 90, 0.15);
}

.card-header {
  background: var(--card-header-gradient);
  color: var(--brand-foreground);
  border: none;
  padding: var(--space-3) var(--space-3);
  font-size: 18px;
  font-weight: 600;
  border-bottom: none;
}

.card-body {
  padding: 30px;
}

.card-title {
  color: var(--brand-primary);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 15px;
}

.card-text {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* Buttons */
.btn-primary {
  background-color: var(--button-solid);
  border: none;
  color: var(--brand-foreground);
  padding: 16px 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 5px;
  min-width: 140px;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-primary:hover {
  background-color: var(--button-hover);
  color: var(--brand-foreground);
  text-decoration: none;
}

.btn-primary:active {
  background-color: var(--button-active);
}

.btn-secondary {
  background-color: #6c757d; /* Changed from transparent to match button-system.css */
  border: 2px solid #6c757d; /* Updated border to match background */
  color: white; /* Changed to white for better contrast */
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-secondary:hover:not(:disabled) {
  background-color: #5a6268; /* Updated to match button-system.css */
  border-color: #545b62;
  color: white;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Alerts */
.alert {
  border: none;
  border-radius: 12px;
  padding: 20px;
  font-size: 14px;
}

.alert-info {
  background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
  color: #1565C0;
  border-left: 4px solid #2196F3;
}

.alert-warning {
  background: linear-gradient(135deg, #FFF8E1 0%, #FFE0B2 100%);
  color: #E65100;
  border-left: 4px solid #FF9800;
}

.alert-heading {
  font-weight: 600;
  margin-bottom: 10px;
}

/* Tables */
.table {
  background: var(--card-background);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.table-dark {
  background: var(--brand-primary);
}

.table th {
  font-weight: 600;
  color: var(--brand-foreground);
  border: none;
  padding: var(--space-2) var(--space-3);
  background: var(--brand-primary);
}

/* Seamless card to table flow */
.card .table-responsive {
  margin: 0;
}

.card .table {
  margin-bottom: 0;
  border-radius: 0;
}

.table td {
  border-color: var(--border-light);
  padding: 20px;
  vertical-align: middle;
}

/* Login Modal */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.login-modal {
  background: var(--card-background);
  border-radius: 20px;
  padding: var(--space-5);
  width: 90%;
  max-width: 450px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.login-header {
  margin-bottom: 30px;
}

.login-header h2 {
  color: var(--brand-primary);
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 10px 0;
}

.login-header p {
  color: var(--text-secondary);
  margin: 0;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
}

.form-control {
  width: 100%;
  padding: 16px;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(135, 26, 103, 0.1);
}

.login-actions {
  margin-top: 30px;
}

.login-actions .btn {
  margin: 0 10px;
}

/* Dark Mode Toggle Button */
.dark-mode-toggle {
  background: transparent;
  border: 2px solid var(--border-light);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-right: 15px;
  font-size: 18px;
}

.dark-mode-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: var(--brand-accent);
  color: var(--brand-accent);
}

/* Override Bootstrap Button Styles with Design System */
/* btn-primary styles moved to button-system-v2.css */

/* btn-primary:hover styles moved to button-system-v2.css */

/* Only use solid style for primary CTAs */
.btn-primary-solid {
  background-color: var(--brand-purple) !important;
  border-color: var(--brand-purple) !important;
  color: white !important;
}

.btn-primary-solid:hover {
  background-color: var(--brand-purple-dark) !important;
  border-color: var(--brand-purple-dark) !important;
  color: white !important;
}

/* btn-secondary styles moved to button-system-v2.css */

/* btn-secondary:hover styles moved to button-system-v2.css */

/* btn-danger styles moved to button-system-v2.css */

/* btn-danger:hover styles moved to button-system-v2.css */

/* btn-success styles moved to button-system-v2.css */

/* btn-success:hover styles moved to button-system-v2.css */

/* btn-warning styles moved to button-system-v2.css */

/* btn-warning:hover styles moved to button-system-v2.css */

/* Override Bootstrap Form Controls */
.form-control,
.form-select {
  background-color: var(--input-bg) !important;
  border-color: var(--input-border) !important;
  color: var(--text-primary) !important;
}

.form-control:focus,
.form-select:focus {
  background-color: var(--input-bg) !important;
  border-color: var(--input-focus-border) !important;
  box-shadow: 0 0 0 3px var(--brand-purple-faint) !important;
}

/* Additional Dark Mode Overrides */
html.dark-mode body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

html.dark-mode .top-header {
  background: var(--header-bg);
  border-bottom-color: var(--border-light);
}

html.dark-mode .sidebar {
  background: var(--sidebar-bg);
  border-right-color: var(--border-light);
}

html.dark-mode .sidebar-nav a {
  color: var(--text-primary);
}

html.dark-mode .sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none !important;
}

html.dark-mode .sidebar-nav a.active {
  background: var(--brand-primary);
  color: white;
}

html.dark-mode .card {
  background: var(--card-background);
  border-color: var(--border-light);
}

html.dark-mode .form-control {
  background: var(--background-secondary);
  border-color: var(--border-light);
  color: var(--text-primary);
}

html.dark-mode .form-control:focus {
  background: var(--background-secondary);
  border-color: var(--brand-accent);
  color: var(--text-primary);
}

html.dark-mode .table {
  color: var(--text-primary);
  background-color: #0d1117 !important;
}

html.dark-mode .table thead th {
  background-color: #161b22 !important;
  border-color: #30363d !important;
}

html.dark-mode .table td,
html.dark-mode .table th {
  border-color: #30363d !important;
}

html.dark-mode .table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: #0d1117 !important;
}

html.dark-mode .table-striped > tbody > tr:nth-of-type(even) > * {
  background-color: #161b22 !important;
}

html.dark-mode .app-footer {
  background: var(--header-bg);
  border-top-color: var(--border-light);
  color: var(--text-secondary);
}

html.dark-mode .dark-mode-toggle {
  border-color: var(--text-secondary);
  color: #ffd700;
}

html.dark-mode .dark-mode-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #ffd700;
}

html.dark-mode .dropdown-menu {
  background: var(--card-background);
  border-color: var(--border-light);
}

html.dark-mode .dropdown-item {
  color: var(--text-primary);
}

html.dark-mode .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

html.dark-mode .modal-content {
  background-color: #1a1a1a !important;
  border-color: var(--border-light);
  color: var(--text-primary) !important;
}

html.dark-mode .modal-header {
  background-color: #1a1a1a !important;
  border-bottom-color: var(--border-light);
  color: var(--text-primary) !important;
}

html.dark-mode .modal-body {
  background-color: #1a1a1a !important;
  color: var(--text-primary) !important;
}

html.dark-mode .modal-footer {
  background-color: #1a1a1a !important;
  border-top-color: var(--border-light);
  color: var(--text-primary) !important;
}

/* Fix form controls in dark mode modals */
html.dark-mode .modal .form-control,
html.dark-mode .modal .form-select {
  background-color: #2a2a2a !important;
  color: #e5e5e5 !important;
  border-color: #444 !important;
}

html.dark-mode .modal .form-control:focus,
html.dark-mode .modal .form-select:focus {
  background-color: #2a2a2a !important;
  color: #e5e5e5 !important;
  border-color: #871a67 !important;
  box-shadow: 0 0 0 0.2rem rgba(135, 26, 103, 0.25) !important;
}

/* Fix labels in dark mode modals */
html.dark-mode .modal label {
  color: var(--text-primary) !important;
}

/* Fix modal backdrop in dark mode */
html.dark-mode .modal-backdrop {
  background-color: #000;
  opacity: 0.75 !important;
}

/* Fix file input styling in dark mode */
html.dark-mode .modal input[type="file"] {
  color: var(--text-primary) !important;
}

html.dark-mode .modal input[type="file"]::file-selector-button {
  background-color: #2a2a2a !important;
  color: var(--text-primary) !important;
  border: 1px solid #444 !important;
}

html.dark-mode .close,
html.dark-mode .btn-close {
  color: var(--text-primary);
  filter: invert(1);
}

/* Dark mode support for buttons */
html.dark-mode .btn-primary {
  background-color: var(--brand-accent);
  border-color: var(--brand-accent);
}

html.dark-mode .btn-secondary {
  background-color: #6c757d;
  border-color: #6c757d;
  color: white;
}

html.dark-mode .btn-outline-primary {
  color: var(--brand-accent);
  border-color: var(--brand-accent);
}

html.dark-mode .btn-outline-primary:hover {
  background-color: var(--brand-accent);
  color: white;
}

/* Dark mode for badges and alerts */
html.dark-mode .badge {
  filter: brightness(0.8);
}

html.dark-mode .alert {
  background-color: var(--card-background);
  border-color: var(--border-light);
  color: var(--text-primary);
}

/* Fix link colors in buttons for dark mode */
html.dark-mode .btn a,
html.dark-mode a.btn {
  color: inherit !important;
}

/* Fix Bootstrap text utility classes in dark mode */
html.dark-mode .text-muted {
  color: #9a9a9a !important;
}

html.dark-mode .text-secondary {
  color: #b0b0b0 !important;
}

html.dark-mode .text-light {
  color: #e0e0e0 !important;
}

html.dark-mode .text-dark {
  color: #c9d1d9 !important;
}

/* Form controls handled by design system */

/* Fix disabled form controls */
html.dark-mode .form-control:disabled,
html.dark-mode .form-select:disabled {
  background-color: #161b22 !important;
  opacity: 0.6;
}

/* Fix Bootstrap cards properly */
html.dark-mode .card {
  background-color: #161b22 !important;
  border-color: #30363d !important;
}

html.dark-mode .card-header {
  background-color: #0d1117 !important;
  border-bottom-color: #30363d !important;
  color: #c9d1d9 !important;
}

html.dark-mode .card-body {
  color: #c9d1d9 !important;
}

html.dark-mode .card-footer {
  background-color: #0d1117 !important;
  border-top-color: #30363d !important;
}

/* Fix list groups */
html.dark-mode .list-group-item {
  background-color: #161b22 !important;
  border-color: #30363d !important;
  color: #c9d1d9 !important;
}

html.dark-mode .list-group-item:hover {
  background-color: #1f2937 !important;
}

/* Fix dropdowns */
html.dark-mode .dropdown-menu {
  background-color: #161b22 !important;
  border-color: #30363d !important;
}

html.dark-mode .dropdown-item {
  color: #c9d1d9 !important;
}

html.dark-mode .dropdown-item:hover,
html.dark-mode .dropdown-item:focus {
  background-color: #1f2937 !important;
  color: #f0f6fc !important;
}

html.dark-mode .dropdown-divider {
  border-top-color: #30363d !important;
}

/* Fix pagination */
html.dark-mode .page-link {
  background-color: #161b22 !important;
  border-color: #30363d !important;
  color: #a78bfa !important;
}

html.dark-mode .page-link:hover {
  background-color: #1f2937 !important;
  border-color: #30363d !important;
  color: #c4b5fd !important;
}

html.dark-mode .page-item.active .page-link {
  background-color: #7c3aed !important;
  border-color: #7c3aed !important;
  color: #ffffff !important;
}

/* Button focus states */
.btn:focus {
  outline: none !important;
  box-shadow: 0 0 0 3px var(--brand-purple-faint) !important;
}

/* Fix BMW Lookup page button overlay issue */
.btn-group {
  position: relative;
  z-index: 1;
  margin-bottom: 1rem; /* Add spacing between buttons and card */
}

/* Fix License Management Quick Actions dropdown text visibility */
.dropdown-menu {
  background-color: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
}

.dropdown-item {
  color: var(--text-primary) !important;
}

.dropdown-item:hover {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

html.dark-mode .dropdown-menu {
  background-color: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

html.dark-mode .dropdown-item {
  color: var(--text-primary) !important;
}

html.dark-mode .dropdown-item:hover {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
}

/* Fix button sizing on Dashboard - make all action buttons consistent */
.btn-action-wide {
  min-width: 150px !important;
  padding: 0.375rem 1rem !important;
}

/* Fix home page dark mode sections */
html.dark-mode .features-section {
  background-color: var(--bg-primary) !important;
}

html.dark-mode .home-hero {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%) !important;
}

/* Fix footer transparency in dark mode */
html.dark-mode .app-footer {
  background-color: var(--bg-secondary) !important;
  opacity: 1 !important;
}

/* Fix light mode issues */
/* Button styles are now handled by button-system-v2.css */

/* Fix home page features section in light mode */
.features-section {
  background-color: var(--bg-secondary) !important;
}

/* Fix footer in light mode */
.app-footer {
  background-color: var(--bg-secondary) !important;
  border-top: 1px solid var(--border-color) !important;
}

/* Fix card hover effects in light mode */
.feature-card {
  background-color: var(--bg-primary) !important;
  border: 1px solid var(--border-color) !important;
}

.feature-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

/* Fix navbar */
html.dark-mode .navbar-light {
  background-color: #0d1117 !important;
}

html.dark-mode .navbar-light .navbar-brand,
html.dark-mode .navbar-light .navbar-nav .nav-link {
  color: #c9d1d9 !important;
}

html.dark-mode .navbar-light .navbar-nav .nav-link:hover {
  color: #f0f6fc !important;
}

/* Fix breadcrumbs */
html.dark-mode .breadcrumb {
  background-color: #161b22 !important;
}

html.dark-mode .breadcrumb-item + .breadcrumb-item::before {
  color: #8b949e !important;
}

html.dark-mode .breadcrumb-item a {
  color: #a78bfa !important;
}

/* Fix progress bars */
html.dark-mode .progress {
  background-color: #161b22 !important;
}

/* Fix tooltips */
html.dark-mode .tooltip-inner {
  background-color: #1f2937 !important;
  color: #c9d1d9 !important;
}

/* Fix hamburger menu contrast */
html.dark-mode .hamburger-menu {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

html.dark-mode .hamburger-menu:hover {
  background-color: rgba(255, 255, 255, 0.2) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}

/* Additional fixes for tables and buttons */
/* Fix button z-index in tables */
.table-responsive .btn,
.table .btn {
  position: relative;
  z-index: 10;
}

/* Ensure features section has proper dark background */
html.dark-mode #features,
html.dark-mode .features-section {
  background-color: var(--bg-primary) !important;
}

/* Ensure footer is opaque in dark mode */
html.dark-mode footer,
html.dark-mode .footer {
  background-color: var(--bg-secondary) !important;
  opacity: 1 !important;
}

/* Fix any remaining light backgrounds in dark mode */
html.dark-mode .bg-light {
  background-color: var(--bg-secondary) !important;
}

html.dark-mode .bg-white {
  background-color: var(--bg-primary) !important;
}

/* Ensure dropdown menus work with Bootstrap 5 dark mode */
[data-bs-theme="dark"] .dropdown-menu {
  background-color: var(--bs-gray-900);
  border-color: var(--bs-gray-700);
}

[data-bs-theme="dark"] .dropdown-item {
  color: var(--bs-gray-100);
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
  background-color: var(--bs-gray-800);
  color: var(--bs-white);
}

/* Ensure ALL tables have dark backgrounds */
html.dark-mode table,
html.dark-mode .table,
html.dark-mode table.table {
  background-color: #0d1117 !important;
  color: #c9d1d9 !important;
}

html.dark-mode table th,
html.dark-mode .table th,
html.dark-mode table td,
html.dark-mode .table td {
  background-color: inherit !important;
  color: #c9d1d9 !important;
  border-color: #30363d !important;
}

/* Fix table header backgrounds */
html.dark-mode table thead,
html.dark-mode .table thead,
html.dark-mode table thead th,
html.dark-mode .table thead th {
  background-color: #161b22 !important;
  color: #f0f6fc !important;
  border-color: #30363d !important;
}

/* Fix table hover states */
html.dark-mode .table-hover tbody tr:hover {
  background-color: #1c2128 !important;
  color: #c9d1d9 !important;
}

/* Fix striped tables */
html.dark-mode .table-striped tbody tr:nth-of-type(odd) {
  background-color: #0d1117 !important;
}

html.dark-mode .table-striped tbody tr:nth-of-type(even) {
  background-color: #161b22 !important;
}

/* Fix home page hero section background */
html.dark-mode .hero-section,
html.dark-mode .home-hero {
  background-color: #0d1117 !important;
  background-blend-mode: multiply;
}

html.dark-mode .hero-section::before {
  background-color: rgba(0, 0, 0, 0.8) !important;
}

/* Fix hero buttons for better contrast */
html.dark-mode .hero-button-primary,
html.dark-mode .btn-hero-primary {
  background-color: #9333ea !important;
  border-color: #9333ea !important;
  color: #ffffff !important;
}

html.dark-mode .hero-button-secondary,
html.dark-mode .btn-hero-secondary {
  background-color: #6b7280 !important;
  border-color: #6b7280 !important;  
  color: #ffffff !important;
}

/* Remove old warning button overrides - handled by design system */

/* Fix yellow text colors */
html.dark-mode .text-warning {
  color: #c9a575 !important;
}

/* Fix status backgrounds on H2Server page */
html.dark-mode .bg-warning {
  background-color: #3d2f1f !important;
  color: #c9a575 !important;
}

html.dark-mode .bg-success {
  background-color: #1a3d2e !important;
  color: #a3d5a3 !important;
}

html.dark-mode .bg-danger {
  background-color: #4d1a1a !important;
  color: #d5a3a3 !important;
}

/* Fix status cards */
html.dark-mode .status-card-warning,
html.dark-mode .alert-warning {
  background-color: #2d2319 !important;
  border-color: #4a3a2a !important;
  color: #c9a575 !important;
}

/* Fix buttons inside tables for visibility */
html.dark-mode table .btn,
html.dark-mode .table .btn {
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

html.dark-mode table .btn-primary,
html.dark-mode .table .btn-primary {
  background-color: #7c3aed !important;
  border-color: #7c3aed !important;
  color: #ffffff !important;
}

html.dark-mode table .btn-secondary,
html.dark-mode .table .btn-secondary {
  background-color: #4b5563 !important;
  border-color: #4b5563 !important;
  color: #ffffff !important;
}

html.dark-mode table .btn-danger,
html.dark-mode .table .btn-danger {
  background-color: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
}

html.dark-mode table .btn-success,
html.dark-mode .table .btn-success {
  background-color: #059669 !important;
  border-color: #059669 !important;
  color: #ffffff !important;
}

/* Fix link buttons in tables */
html.dark-mode table a.btn,
html.dark-mode .table a.btn,
html.dark-mode table .btn-link,
html.dark-mode .table .btn-link {
  color: #a78bfa !important;
}

html.dark-mode table a.btn:hover,
html.dark-mode .table a.btn:hover {
  color: #c4b5fd !important;
  text-decoration: none !important;
}

html.dark-mode table .btn-link:hover,
html.dark-mode .table .btn-link:hover {
  color: #c4b5fd !important;
  text-decoration: underline;
}

html.dark-mode .alert-success {
  background-color: #1a4d2e;
  border-color: #2d6a3d;
  color: #a3d5a3;
}

html.dark-mode .alert-danger {
  background-color: #4d1a1a;
  border-color: #6a2d2d;
  color: #d5a3a3;
}

html.dark-mode .alert-warning {
  background-color: #3d2f1f;
  border-color: #4a3a2a;
  color: #c9a575;
}

html.dark-mode .alert-info {
  background-color: #1a3d4d;
  border-color: #2d536a;
  color: #a3c3d5;
}

/* Dark mode for navigation pills/tabs */
html.dark-mode .nav-pills .nav-link {
  color: var(--text-primary);
}

html.dark-mode .nav-pills .nav-link.active {
  background-color: var(--brand-accent);
  color: white;
}

html.dark-mode .nav-tabs .nav-link {
  color: var(--text-primary);
  border-color: transparent;
}

html.dark-mode .nav-tabs .nav-link.active {
  background-color: var(--card-background);
  border-color: var(--border-light) var(--border-light) var(--card-background);
  color: var(--text-primary);
}

/* Dark mode for login modal */
html.dark-mode .login-modal {
  background: var(--card-background);
  border-color: var(--border-light);
}

html.dark-mode .login-header {
  background: var(--header-bg);
  color: var(--text-primary);
}

/* Dark mode for code blocks */
html.dark-mode pre,
html.dark-mode code {
  background-color: #0d0d0d;
  color: #e0e0e0;
  border-color: var(--border-light);
}

/* Critical dark mode fixes */
html.dark-mode .main-content {
  background-color: var(--background-primary) !important;
}

/* Ensure body and all containers have dark background */
html.dark-mode,
html.dark-mode body,
html.dark-mode .container,
html.dark-mode .container-fluid,
html.dark-mode .main-content,
html.dark-mode .content-wrapper {
  background-color: #0d1117 !important;
  color: #c9d1d9 !important;
}

html.dark-mode h1,
html.dark-mode h2, 
html.dark-mode h3,
html.dark-mode h4,
html.dark-mode h5,
html.dark-mode h6 {
  color: var(--heading-color) !important;
}

html.dark-mode a {
  color: var(--link-color);
}

html.dark-mode a:hover {
  color: var(--brand-accent);
  text-decoration: underline;
}

/* Fix button borders in dark mode */
html.dark-mode .btn {
  border: 1px solid var(--border-light);
}

html.dark-mode .btn:hover {
  border-color: var(--border-medium);
}

html.dark-mode .btn-primary {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #ffffff !important; /* White text for accessibility */
}

html.dark-mode .btn-primary:hover {
  background-color: var(--brand-accent);
  border-color: var(--brand-accent);
  color: #0d1117 !important; /* Dark text on light purple */
}

/* Fix tables in dark mode */
html.dark-mode .table-bordered,
html.dark-mode .table-bordered td,
html.dark-mode .table-bordered th {
  border-color: var(--border-light);
}

html.dark-mode .table-hover tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

/* Fix status badges */
html.dark-mode .badge-success {
  background-color: #3fb950;
  color: #0d1117;
}

html.dark-mode .badge-danger {
  background-color: #f85149;
  color: #0d1117;
}

html.dark-mode .badge-warning {
  background-color: #744210;
  color: #f0c674;
}

html.dark-mode .badge-info {
  background-color: #5b21b6;
  color: #e9d5ff;
}

/* Ensure buttons remain visible in automatic dark mode */
@media (prefers-color-scheme: dark) {
  /* Ensure secondary buttons remain visible in dark mode */
  .btn-secondary {
    background-color: #6c757d !important; /* Force gray background */
    color: white !important;
    border-color: #6c757d !important;
  }
  
  .btn-secondary:hover:not(:disabled) {
    background-color: #5a6268 !important;
    border-color: #545b62 !important;
    color: white !important;
  }
  
  .btn-secondary:active:not(:disabled) {
    background-color: #545b62 !important;
    border-color: #4e555b !important;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  /* On mobile, sidebar starts collapsed to icons only */
  .sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    height: calc(100vh - 60px);
    width: 60px;
    z-index: 1000;
    transition: width 0.3s ease;
  }
  
  .sidebar.collapsed {
    width: 60px;
  }
  
  .sidebar:not(.collapsed) {
    width: 280px;
  }
  
  .main-content {
    padding: 20px;
    margin-left: 60px;
    width: calc(100% - 60px);
    transition: margin-left 0.3s ease, width 0.3s ease;
  }
  
  .main-content.expanded {
    margin-left: 60px;
    width: calc(100% - 60px);
  }
  
  .sidebar-nav a:hover {
    transform: none;
  }
  
  /* Show hamburger menu on mobile */
  .hamburger-menu {
    display: block;
  }
}

@media (min-width: 769px) {
  /* On desktop, hamburger menu is always visible */
  .hamburger-menu {
    display: block;
  }
}

/* Utilities */
.text-center {
  text-align: center;
}

.mt-4 {
  margin-top: 1.5rem;
}

.mt-5 {
  margin-top: 3rem;
}

.mb-0 {
  margin-bottom: 0;
}

.d-none {
  display: none;
}

.d-block {
  display: block;
}

/* Bootstrap Color Overrides */
.bg-primary {
  background: var(--brand-primary) !important;
}

.text-primary {
  color: var(--brand-primary) !important;
}

.border-primary {
  border-color: var(--brand-primary) !important;
}

.alert-success {
  background-color: rgba(74, 44, 90, 0.1);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.alert-info {
  background-color: rgba(168, 85, 247, 0.1);
  border-color: var(--brand-accent);
  color: var(--brand-primary);
}

.badge {
  background-color: #8A92A6;
  color: var(--brand-foreground);
  border: none;
  font-weight: 500;
  font-size: 11px;
  padding: 4px 8px;
}

.badge.bg-secondary {
  background-color: #8A92A6 !important;
  color: var(--brand-foreground) !important;
  border: none;
}

/* Focus states for accessibility */
.btn:focus, .btn:active:focus, .form-control:focus {
  box-shadow: 0 0 0 3px rgba(74, 44, 90, 0.25);
}

/* Pagination Styling */
.pagination .page-link {
  color: var(--brand-primary);
  border-color: var(--border-light);
  padding: var(--space-1) calc(var(--space-1) * 1.5);
}

.pagination .page-link:hover {
  color: var(--brand-foreground);
  background-color: var(--button-hover);
  border-color: var(--button-hover);
}

.pagination .page-item.active .page-link {
  background-color: var(--button-solid);
  border-color: var(--button-solid);
  color: var(--brand-foreground);
}

.pagination .page-item.disabled .page-link {
  color: var(--text-secondary);
  background-color: var(--background-light);
  border-color: var(--border-light);
}

.card-footer {
  background-color: var(--background-light);
  border-top: 1px solid var(--border-light);
  padding: 16px 24px;
}

/* Footer Styles */
.app-footer {
  background-color: var(--background-light);
  border-top: 1px solid var(--border-light);
  padding: 1rem 0;
  margin-top: auto;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.footer-left {
  flex: 1;
}

.footer-right {
  flex-shrink: 0;
}

/* Adjust main content to account for footer */
.app-content {
  padding-bottom: 60px;
}

/* License status in footer */
.footer-right .license-status {
  margin: 0;
  padding: 0;
}

/* Additional Dark Mode Fixes for Remaining Issues */

/* Fix dropdown items in dark mode using Bootstrap 5 attribute */
[data-bs-theme="dark"] .dropdown-item {
    color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--bs-body-color) !important;
}

/* Fix light backgrounds in dark mode */
[data-bs-theme="dark"] .bg-light {
    background-color: var(--bs-dark) !important;
}

[data-bs-theme="dark"] #features {
    background-color: var(--bs-dark) !important;
}

[data-bs-theme="dark"] footer,
[data-bs-theme="dark"] .app-footer {
    background-color: var(--bs-gray-900) !important;
    color: var(--bs-body-color) !important;
}

/* Ensure button z-index in specific contexts */
.card-body .btn,
.table-responsive .btn {
    position: relative;
    z-index: 1;
}

/* Fix BMW Lookup button overlay specifically */
.table-responsive {
    position: relative;
}

.table-responsive .btn {
    position: relative;
    z-index: 10;
}

/* Button hover states are now handled by button-system-v2.css */

/* Dark mode button hover states are now handled by button-system-v2.css */
}

/* Light mode button hover states are now handled by button-system-v2.css */