/* Enhanced Theme Variables & Base Styles */
:root {
  /* Light Mode Variables - Professional Clean Design */
  --bg-body: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  --bg-glass: rgba(255, 255, 255, 0.9);
  --bg-glass-heavy: rgba(255, 255, 255, 0.95);
  --bg-glass-hover: rgba(255, 255, 255, 0.98);
  --bg-overlay: rgba(0, 0, 0, 0.05);
  --bg-overlay-medium: rgba(0, 0, 0, 0.1);
  --bg-tertiary: rgba(241, 245, 249, 0.9);
  --bg-card: #ffffff;
  --card-bg: #ffffff; /* Alias for --bg-card for backward compatibility */
  --border-glass: rgba(79, 172, 254, 0.2);
  --text-primary: #2d3748;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --shadow-glass: 0 10px 40px rgba(0, 0, 0, 0.1);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.08);
  --card-border: 1px solid rgba(226, 232, 240, 0.8);
  --accent-color: #4299e1;
  --accent-secondary: #667eea;
  --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --accent-gradient-hover: linear-gradient(135deg, #5a6fd8 0%, #6b4190 100%);
  --success-color: #48bb78;
  --warning-color: #ed8936;
  --error-color: #f56565;
  --info-color: #4299e1;
  --modal-overlay: rgba(45, 55, 72, 0.6);
  --navbar-bg: rgba(255, 255, 255, 0.95);
  --input-bg: #ffffff;
  --input-border: #e2e8f0;
  --hover-bg: rgba(66, 153, 225, 0.1);
}

:root.dark-mode {
  /* Dark Mode Variables - Premium Dark Glass Design */
  --bg-body: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
  --bg-glass: rgba(26, 32, 44, 0.8);
  --bg-glass-heavy: rgba(23, 25, 35, 0.95);
  --bg-glass-hover: rgba(45, 55, 72, 0.9);
  --bg-overlay: rgba(0, 0, 0, 0.3);
  --bg-overlay-medium: rgba(0, 0, 0, 0.4);
  --bg-tertiary: rgba(30, 41, 59, 0.9);
  --bg-card: #1a202c;
  --card-bg: #1a202c; /* Alias for --bg-card for backward compatibility */
  --border-glass: rgba(81, 97, 125, 0.3);
  --text-primary: #f7fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #a0aec0;
  --shadow-glass: 0 20px 60px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 8px 30px rgba(0, 0, 0, 0.3);
  --card-border: 1px solid rgba(74, 85, 104, 0.3);
  --accent-color: #63b3ed;
  --accent-secondary: #9f7aea;
  --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --accent-gradient-hover: linear-gradient(135deg, #7c89f0 0%, #8b5ca8 100%);
  --success-color: #68d391;
  --warning-color: #f6ad55;
  --error-color: #fc8181;
  --info-color: #63b3ed;
  --modal-overlay: rgba(0, 0, 0, 0.8);
  --navbar-bg: rgba(26, 32, 44, 0.95);
  --input-bg: #2d3748;
  --input-border: #4a5568;
  --hover-bg: rgba(99, 179, 237, 0.15);
}

body {
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-body) !important;
  color: var(--text-primary) !important;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* COMPREHENSIVE DARK MODE STYLING */
:root.dark-mode body {
  background: var(--bg-body) !important;
}

:root.dark-mode .navbar {
  background: rgba(23, 25, 35, 0.95) !important;
  color: var(--text-primary) !important;
}

:root.dark-mode .nav-link {
  color: var(--text-secondary) !important;
}

:root.dark-mode .nav-link:hover {
  color: var(--text-primary) !important;
}

:root.dark-mode .card {
  background: var(--bg-card) !important;
  border: var(--card-border) !important;
  color: var(--text-primary) !important;
}

:root.dark-mode .btn {
  background: var(--bg-glass) !important;
  color: var(--text-primary) !important;
  border: var(--border-glass) !important;
}

:root.dark-mode .form-control {
  background: var(--bg-glass) !important;
  color: var(--text-primary) !important;
  border: var(--border-glass) !important;
}

/* Force light styling for forms - apply .form-light class to form or container */
.form-light input,
.form-light select,
.form-light textarea,
.form-light .form-control,
.form-light .form-select,
:root.dark-mode .form-light input,
:root.dark-mode .form-light select,
:root.dark-mode .form-light textarea,
:root.dark-mode .form-light .form-control,
:root.dark-mode .form-light .form-select {
  background-color: #ffffff !important;
  color: #212529 !important;
  border-color: #ced4da !important;
  backdrop-filter: none !important;
}

.form-light input::placeholder,
.form-light textarea::placeholder,
:root.dark-mode .form-light input::placeholder,
:root.dark-mode .form-light textarea::placeholder {
  color: #6c757d !important;
}

.form-light select option,
:root.dark-mode .form-light select option {
  background-color: #ffffff !important;
  color: #212529 !important;
}

.form-light label,
:root.dark-mode .form-light label {
  color: #212529 !important;
}

:root.dark-mode .table {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

:root.dark-mode .table th,
:root.dark-mode .table td {
  border-color: var(--border-glass) !important;
  color: var(--text-primary) !important;
}

/* Editable Table Styling */
.editable-table {
  background: var(--bg-glass) !important;
  color: var(--text-primary) !important;
  border-collapse: collapse;
}

.editable-table th {
  background: var(--bg-glass-heavy) !important;
  color: var(--text-primary) !important;
  border: var(--card-border) !important;
}

.editable-table td {
  background: var(--bg-glass) !important;
  color: var(--text-primary) !important;
  border: var(--card-border) !important;
}

.editable-table tr:hover td {
  background: var(--bg-glass-hover) !important;
}

.editable-table .edit-value {
  background: var(--input-bg) !important;
  border: var(--input-border) !important;
  color: var(--text-primary) !important;
}

.bulk-actions-bar {
  background: var(--bg-glass) !important;
  border: var(--card-border) !important;
  color: var(--text-primary) !important;
}

:root.dark-mode .container-fluid {
  background: transparent !important;
}

:root.dark-mode h1, :root.dark-mode h2, :root.dark-mode h3, 
:root.dark-mode h4, :root.dark-mode h5, :root.dark-mode h6 {
  color: var(--text-primary) !important;
}

:root.dark-mode p, :root.dark-mode span, :root.dark-mode div {
  color: var(--text-secondary) !important;
}

:root.dark-mode .alert {
  background: var(--bg-glass) !important;
  border: var(--border-glass) !important;
  color: var(--text-primary) !important;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Enhanced Navigation */
.navbar {
    background: var(--navbar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: var(--card-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-wrap: wrap;
    gap: 1rem;
    box-shadow: var(--shadow-card);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    letter-spacing: -0.5px;
    transition: all 0.3s ease;
}

.nav-brand:hover {
    background: var(--accent-gradient-hover);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transform: translateY(-1px);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent-color);
    background: var(--hover-bg);
    transform: translateY(-1px);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--accent-color);
    border-radius: 1px;
}

/* Enhanced Unified CMMS Styling */
.cmms-header {
    background: var(--bg-glass);
    backdrop-filter: blur(15px);
    padding: 2rem;
    text-align: center;
    border-bottom: var(--card-border);
    margin-bottom: 2rem;
    border-radius: 0 0 20px 20px;
    box-shadow: var(--shadow-glass);
}

.cmms-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.cmms-header p {
  opacity: 0.9;
  font-size: 1.1rem;
}

/* Enhanced Cards with Professional Glassmorphism */
.cmms-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: var(--card-border);
    margin-bottom: 2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.cmms-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.cmms-card:hover::before {
    opacity: 1;
}

/* Stats and Metrics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-glass);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: var(--card-border);
    box-shadow: var(--shadow-glass);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    background: var(--bg-glass-hover);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1rem 0;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
}

.status-operational,
.status-good {
  color: #38ef7d;
}

.status-maintenance,
.status-warning {
  color: #fbbf24;
}

.status-down,
.status-critical {
  color: #ff6b6b;
}

.status-overdue {
  color: #ff4757;
}

.status-due {
  color: #ffa726;
}

/* Enhanced Tables with Glassmorphism */
.cmms-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
    background: var(--bg-glass);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: var(--card-border);
    box-shadow: var(--shadow-glass);
}

.cmms-table th,
.cmms-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-primary);
}

.cmms-table th {
    background: var(--bg-glass-heavy);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

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

.cmms-table tr:hover td {
    background: rgba(255, 255, 255, 0.05);
}

/* Filter and Search with Enhanced Glassmorphism */
.filter-bar {
    background: var(--bg-glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    border: var(--card-border);
    box-shadow: var(--shadow-glass);
    transition: all 0.3s ease;
}

.filter-bar:hover {
    background: var(--bg-glass-hover);
    border-color: rgba(255, 255, 255, 0.3);
}

.filter-bar label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.filter-bar select,
.filter-bar input {
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    background: var(--bg-glass-heavy);
    color: var(--text-primary);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.filter-bar select:focus,
.filter-bar input:focus {
    background: var(--bg-body);
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    transform: translateY(-1px);
}

.filter-bar select option {
    background: var(--bg-body);
    color: var(--text-primary);
}

.filter-bar input::placeholder {
    color: var(--text-muted);
}

/* Enhanced Buttons with Glassmorphism */
.cmms-btn {
    background: var(--accent-gradient);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin: 0.25rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.cmms-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
    border-color: rgba(255, 255, 255, 0.4);
    filter: brightness(1.1);
    color: white;
}

.cmms-btn-success {
  background: linear-gradient(135deg, #38ef7d, #11998e);
}

.cmms-btn-warning {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.cmms-btn-danger {
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
}

.cmms-btn-secondary {
  background: linear-gradient(135deg, #6c757d, #495057);
  box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
}

.cmms-btn-secondary:hover {
  box-shadow: 0 8px 25px rgba(108, 117, 125, 0.5);
}

/* Light mode styling for secondary buttons - white background with dark text */
:root:not(.dark-mode) .cmms-btn-secondary {
  background: linear-gradient(135deg, #ffffff, #f8f9fa);
  color: #212529 !important;
  border: 1px solid #dee2e6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

:root:not(.dark-mode) .cmms-btn-secondary:hover {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

:root:not(.dark-mode) .cmms-btn-secondary i {
  color: #495057;
}

/* Form Sections */
.parts-section,
.instructions-section {
  margin-top: 2rem;
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
}

.parts-section h3,
.instructions-section h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.instructions-section {
  background: rgba(255, 193, 7, 0.1);
  border-color: rgba(255, 193, 7, 0.3);
}

/* Stock Display */
.stock-display {
  display: block;
  padding: 0.8rem;
  background: var(--bg-glass);
  border-radius: 8px;
  color: var(--text-secondary);
  text-align: center;
}

.stock-display.stock-ok {
  background: rgba(40, 167, 69, 0.2);
  color: #28a745;
}

.stock-display.stock-low {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
}

.stock-display.stock-out {
  background: rgba(220, 53, 69, 0.2);
  color: #dc3545;
}

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

/* Item Cards with Priority Styling */
.item-card {
    background: var(--bg-glass);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    border: var(--card-border);
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.item-card:hover {
    transform: translateY(-3px);
    background: var(--bg-glass-hover);
    box-shadow: var(--shadow-glass);
}

.item-card.critical {
  border-left: 4px solid #ff4757;
  background: rgba(255, 71, 87, 0.1);
}

.item-card.high {
  border-left: 4px solid #ffa726;
  background: rgba(255, 167, 38, 0.1);
}

.item-card.medium {
  border-left: 4px solid #38ef7d;
  background: rgba(56, 239, 125, 0.1);
}

.item-card.low {
  border-left: 4px solid #74b9ff;
  background: rgba(116, 185, 255, 0.1);
}

.item-card.overdue {
  border-left: 4px solid #ff4757;
  background: rgba(255, 71, 87, 0.15);
  animation: pulse-warning 2s infinite;
}

.item-card.due {
  border-left: 44px solid #ffa726;
  background: rgba(255, 167, 38, 0.15);
}

@keyframes pulse-warning {
  0%,
  100% {
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3);
  }

  50% {
    box-shadow: 0 6px 25px rgba(255, 71, 87, 0.6);
  }
}

/* Progress Bars */
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
  margin: 0.5rem 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #38ef7d, #11998e);
  transition: width 0.3s ease;
}

/* Badges */
.cmms-badge {
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(5px);
}

.badge-operational {
    background: rgba(56, 239, 125, 0.15);
    color: #38ef7d;
    border: 1px solid rgba(56, 239, 125, 0.3);
}

.badge-maintenance {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-down {
    background: rgba(255, 71, 87, 0.15);
    color: #ff4757;
    border: 1px solid rgba(255, 71, 87, 0.3);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .cmms-header {
    padding: 1.5rem;
  }

  .cmms-header h1 {
    font-size: 2rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar > * {
    width: 100%;
  }

  .cmms-card {
    padding: 1rem;
  }

  .stat-card {
    padding: 1rem;
  }
}

/* Loading States */
.loading {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* Animations */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

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

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

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

.cmms-card,
.item-card,
.stat-card {
  animation: fadeIn 0.5s ease;
}

/* Bootstrap Theme Overrides - Glass Inputs */
.form-control,
.form-select {
    background-color: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    backdrop-filter: blur(5px);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bg-glass-hover);
    border-color: var(--accent-color);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.25rem rgba(52, 152, 219, 0.25);
}

.form-control::placeholder {
    color: var(--text-muted);
}

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

.form-text {
    color: var(--text-muted);
    font-size: 0.875rem;
    display: block;
    margin-top: 0.3rem;
}

.form-text.text-warning {
    color: #ffc107;
}

/* Fix Bootstrap Card Backgrounds - Light/Dark Mode Responsive */
.card {
  background-color: var(--bg-card);
  border: var(--card-border);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
}

.card-header {
  background-color: var(--bg-glass) !important;
  border-bottom: var(--card-border);
  color: var(--text-primary);
}

.card-body {
  color: var(--text-primary);
}

.card-title {
  color: var(--text-primary);
}

.card-text {
  color: var(--text-secondary);
}

/* Modal Theme */
.modal-content {
    background-color: var(--bg-glass-heavy);
    border: var(--card-border);
    color: var(--text-primary);
    backdrop-filter: blur(15px);
}

.modal-header {
    border-bottom: 1px solid var(--border-glass);
}

.modal-footer {
    border-top: 1px solid var(--border-glass);
}

/* Light modal variant - forces readable light background regardless of theme */
.modal-light .modal-content,
:root.dark-mode .modal-light .modal-content {
    background-color: #ffffff !important;
    color: #212529 !important;
    backdrop-filter: none !important;
}

.modal-light .modal-header,
:root.dark-mode .modal-light .modal-header {
    background-color: #f8f9fa !important;
    border-bottom: 1px solid #dee2e6 !important;
    color: #212529 !important;
}

.modal-light .modal-header .modal-title,
:root.dark-mode .modal-light .modal-header .modal-title {
    color: #212529 !important;
}

.modal-light .modal-header .btn-close,
:root.dark-mode .modal-light .modal-header .btn-close {
    filter: none !important;
}

.modal-light .modal-body,
:root.dark-mode .modal-light .modal-body {
    background-color: #ffffff !important;
    color: #212529 !important;
}

.modal-light label,
.modal-light .form-label,
:root.dark-mode .modal-light label,
:root.dark-mode .modal-light .form-label {
    color: #212529 !important;
}

.modal-light .form-control,
.modal-light .form-select,
.modal-light input,
.modal-light select,
.modal-light textarea,
:root.dark-mode .modal-light .form-control,
:root.dark-mode .modal-light .form-select,
:root.dark-mode .modal-light input,
:root.dark-mode .modal-light select,
:root.dark-mode .modal-light textarea {
    background-color: #ffffff !important;
    color: #212529 !important;
    border-color: #ced4da !important;
    backdrop-filter: none !important;
}

.modal-light .form-control::placeholder,
.modal-light input::placeholder,
.modal-light textarea::placeholder,
:root.dark-mode .modal-light .form-control::placeholder,
:root.dark-mode .modal-light input::placeholder,
:root.dark-mode .modal-light textarea::placeholder {
    color: #6c757d !important;
}

.modal-light .form-text,
:root.dark-mode .modal-light .form-text {
    color: #6c757d !important;
}

.modal-light .modal-footer,
:root.dark-mode .modal-light .modal-footer {
    background-color: #f8f9fa !important;
    border-top: 1px solid #dee2e6 !important;
}

/* Ensure select options are readable */
.modal-light select option,
:root.dark-mode .modal-light select option {
    background-color: #ffffff !important;
    color: #212529 !important;
}

.btn-close {
    filter: invert(0.5); /* Neutral */
}

:root.dark-mode .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Table Overrides - Light/Dark Mode Responsive */
.table {
  color: var(--text-primary);
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-primary);
}

.table > :not(caption) > * > * {
  background-color: transparent;
  color: var(--text-primary);
  border-bottom-color: var(--border-glass);
}

.table th {
  color: var(--text-primary);
}

.table td {
  color: var(--text-secondary);
}

/* Dropdown Menu */
.dropdown-menu {
    background-color: var(--bg-glass-heavy);
    border: var(--card-border);
    backdrop-filter: blur(15px);
    box-shadow: var(--shadow-glass);
}

.dropdown-item {
    color: var(--text-primary);
}

.dropdown-item:hover {
    background-color: var(--bg-glass-hover);
    color: var(--text-primary);
}

/* 🚀 ENHANCED AI ASSISTANT WIDGET - PROMINENT & BEAUTIFUL */
.ai-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.6), 0 0 0 0 rgba(102, 126, 234, 0.5);
    font-size: 32px;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ai-widget-pulse 8s infinite, ai-widget-float 10s ease-in-out infinite;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.ai-fab:hover {
    transform: scale(1.15);
    box-shadow: 0 15px 50px rgba(102, 126, 234, 0.8), 0 0 30px rgba(118, 75, 162, 0.6);
    background: linear-gradient(135deg, #7c89f0 0%, #8b5ca8 100%);
    border-color: rgba(255, 255, 255, 0.5);
    animation: ai-fab-hover-bounce 0.6s ease-in-out;
}

@keyframes ai-fab-hover-bounce {
    0%, 100% { transform: scale(1.15) translateY(0); }
    50% { transform: scale(1.15) translateY(-8px); }
}

.ai-fab:active {
    transform: scale(1.05);
}

/* AI Widget Animations */
@keyframes ai-widget-pulse {
    0%, 100% { 
        box-shadow: 0 10px 40px rgba(102, 126, 234, 0.6), 0 0 0 0 rgba(102, 126, 234, 0.5);
    }
    50% { 
        box-shadow: 0 10px 40px rgba(102, 126, 234, 0.6), 0 0 0 20px rgba(102, 126, 234, 0.1);
    }
}

@keyframes ai-widget-float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

/* AI Widget with Quick Actions */
.ai-widget-expanded {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-glass-heavy);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: var(--card-border);
    border-radius: 25px;
    padding: 20px;
    box-shadow: var(--shadow-glass);
    z-index: 9998;
    min-width: 300px;
    display: none;
    animation: slideUpFadeIn 0.4s ease;
}

.ai-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.ai-quick-action {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}

.ai-quick-action:hover {
    background: var(--bg-glass-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
    color: var(--accent-color);
    text-decoration: none;
}

.ai-quick-action i {
    font-size: 1.1rem;
    color: var(--accent-color);
}

/* Enhanced Chat Interface */
.ai-chat-toggle {
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
}

.ai-chat-toggle:hover {
    background: var(--accent-gradient-hover);
    transform: translateY(-1px);
}

.ai-chat-window {
    position: fixed;
    bottom: 150px;
    right: 30px;
    width: 420px;
    height: 600px;
    background: var(--bg-glass-heavy);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid var(--border-glass);
    border-radius: 25px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUpEnhanced 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

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

@keyframes slideUpEnhanced {
  from {
    transform: translateY(30px) scale(0.9);
    opacity: 0;
  }

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

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

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

.ai-chat-header {
    padding: 20px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
}

.ai-chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 2s infinite;
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.1rem;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.ai-chat-messages {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: var(--bg-body);
    position: relative;
}

.ai-chat-messages::before {
    content: '';
    position: sticky;
    top: 0;
    height: 20px;
    background: linear-gradient(to bottom, var(--bg-body), transparent);
    z-index: 1;
    margin-bottom: -20px;
}

/* Enhanced message styling */
.message {
    max-width: 85%;
    padding: 15px 20px;
    border-radius: 20px;
    font-size: 0.95rem;
    line-height: 1.6;
    word-wrap: break-word;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
    position: relative;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-ai {
    background: var(--bg-glass);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 8px;
    border: 1px solid var(--border-glass);
    margin-right: 20%;
}

.message-user {
    background: var(--accent-gradient);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 8px;
    margin-left: 20%;
}

.message-ai::before {
    content: '🤖';
    position: absolute;
    left: -35px;
    top: 15px;
    font-size: 1.2rem;
    background: var(--bg-glass);
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-glass);
}

.message-user::after {
    content: '👤';
    position: absolute;
    right: -35px;
    top: 15px;
    font-size: 1.2rem;
    background: var(--accent-color);
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.ai-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.ai-message-assistant {
    background: var(--bg-glass);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    border: 1px solid var(--border-glass);
}

.ai-message-user {
    background: var(--accent-gradient);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.ai-chat-input-area {
    padding: 15px;
    background: var(--bg-glass);
    border-top: 1px solid var(--border-glass);
}

.typing-indicator {
  font-style: italic;
  opacity: 0.7;
}

/* Enhanced Mobile Responsiveness and Touch Interactions */
@media (max-width: 768px) {
  .ai-chat-window {
    width: calc(100vw - 20px);
    height: calc(100vh - 120px);
    bottom: 10px;
    right: 10px;
    max-height: 70vh;
    border-radius: 20px;
  }

  .ai-fab {
    bottom: 25px;
    right: 25px;
    width: 80px;
    height: 80px;
    font-size: 28px;
    /* Enhanced touch target */
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.3);
    touch-action: manipulation;
  }
  
  .ai-widget-expanded {
    width: calc(100vw - 40px);
    right: 20px;
    bottom: 120px;
  }
  
  .ai-quick-actions {
    flex-direction: column;
  }
  
  .ai-quick-action {
    padding: 16px 20px; /* Larger touch targets */
    min-height: 48px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
  }

  .message-ai::before,
  .message-user::after {
    display: none; /* Hide avatars on mobile for space */
  }
  
  .message {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  /* Enhanced touch interactions for all buttons */
  .cmms-btn, .btn {
    min-height: 44px; /* Apple's recommended minimum touch target */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
  }
  
  /* Enhanced form controls for touch */
  .form-control, .form-select {
    min-height: 44px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  /* Improved navigation for touch */
  .nav-link {
    padding: 12px 16px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .ai-chat-window {
    width: calc(100vw - 10px);
    height: calc(100vh - 100px);
    bottom: 5px;
    right: 5px;
    max-height: 65vh;
    border-radius: 12px;
  }

  .ai-fab {
    bottom: 15px;
    right: 15px;
    width: 52px;
    height: 52px;
  }

  .ai-chat-messages {
    padding: 15px;
    gap: 10px;
  }

  .ai-chat-input-area {
    padding: 12px;
  }

  .ai-message {
    font-size: 0.9rem;
    padding: 10px 14px;
  }
}

/* Keyboard compensation for mobile */
@media (max-width: 768px) {
  .ai-chat-window.keyboard-active {
    height: calc(50vh - 20px);
    max-height: 50vh;
  }
}

/* Demo Mode Styles */
.demo-signup-cta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

.demo-badge {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

.demo-features-list,
.premium-features-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.demo-features-list li,
.premium-features-list li {
  padding: 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.demo-features-list i {
  width: 16px;
}

.premium-features-list i {
  width: 16px;
}

.demo-banner {
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.1),
    rgba(118, 75, 162, 0.1)
  );
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 2rem;
  text-align: center;
  backdrop-filter: blur(10px);
}

.demo-banner h4 {
  margin-bottom: 0.5rem;
  color: #667eea;
}

.demo-banner p {
  margin-bottom: 1rem;
  opacity: 0.9;
}

/* 🔧 AI TEAM: BULLETPROOF DARK MODE FOR DEMO ENVIRONMENT */
html.dark-mode, 
:root.dark-mode, 
body.dark-mode, 
[data-theme="dark"], 
[data-bs-theme="dark"] {
  /* Force dark mode variables */
  --bg-body: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%) !important;
  --bg-glass: rgba(26, 32, 44, 0.8) !important;
  --bg-glass-heavy: rgba(23, 25, 35, 0.95) !important;
  --bg-card: #1a202c !important;
  --text-primary: #f7fafc !important;
  --text-secondary: #e2e8f0 !important;
  background: var(--bg-body) !important;
  color: var(--text-primary) !important;
}

/* Force dark mode on all elements */
html.dark-mode *, 
:root.dark-mode *, 
body.dark-mode *, 
[data-theme="dark"] *, 
[data-bs-theme="dark"] * {
  color: inherit !important;
}

/* ADDITIONAL DARK MODE OVERRIDES FOR PRODUCTION */
:root.dark-mode .dropdown-menu, 
html.dark-mode .dropdown-menu, 
body.dark-mode .dropdown-menu, 
[data-theme="dark"] .dropdown-menu {
  background: var(--bg-glass) !important;
  border: var(--border-glass) !important;
}

:root.dark-mode .dropdown-item {
  color: var(--text-secondary) !important;
}

:root.dark-mode .dropdown-item:hover {
  background: var(--bg-glass-hover) !important;
  color: var(--text-primary) !important;
}

:root.dark-mode .modal-content {
  background: var(--bg-card) !important;
  border: var(--card-border) !important;
  color: var(--text-primary) !important;
}

:root.dark-mode .modal-header {
  border-bottom: var(--card-border) !important;
  color: var(--text-primary) !important;
}

:root.dark-mode .modal-footer {
  border-top: var(--card-border) !important;
}

:root.dark-mode .badge {
  background: var(--bg-glass) !important;
  color: var(--text-primary) !important;
  border: var(--border-glass) !important;
}

/* List Group - Light/Dark Mode Responsive */
.list-group-item {
  background: var(--bg-card);
  border: var(--card-border);
  color: var(--text-secondary);
}

:root.dark-mode .list-group-item {
  background: var(--bg-card) !important;
  border: var(--border-glass) !important;
  color: var(--text-secondary) !important;
}

:root.dark-mode .nav-tabs .nav-link {
  color: var(--text-secondary) !important;
  border: var(--border-glass) !important;
}

:root.dark-mode .nav-tabs .nav-link.active {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--bg-card) !important;
}

:root.dark-mode .breadcrumb {
  background: var(--bg-glass) !important;
}

:root.dark-mode .breadcrumb-item a {
  color: var(--accent-color) !important;
}

:root.dark-mode .pagination .page-link {
  background: var(--bg-glass) !important;
  border: var(--border-glass) !important;
  color: var(--text-secondary) !important;
}

:root.dark-mode .pagination .page-link:hover {
  background: var(--bg-glass-hover) !important;
  color: var(--text-primary) !important;
}

:root.dark-mode .progress {
  background: var(--bg-glass) !important;
}

:root.dark-mode .text-muted {
  color: var(--text-muted) !important;
}

:root.dark-mode .btn-primary {
  background: var(--accent-gradient) !important;
  border: none !important;
  color: white !important;
}

:root.dark-mode .btn-primary:hover {
  background: var(--accent-gradient-hover) !important;
}

:root.dark-mode .btn-secondary {
  background: var(--bg-glass) !important;
  border: var(--border-glass) !important;
  color: var(--text-primary) !important;
}

:root.dark-mode .btn-outline-primary {
  border: 1px solid var(--accent-color) !important;
  color: var(--accent-color) !important;
  background: transparent !important;
}

:root.dark-mode .btn-outline-primary:hover {
  background: var(--accent-color) !important;
  color: white !important;
}

:root.dark-mode select.form-control {
  background: var(--bg-glass) !important;
  color: var(--text-primary) !important;
  border: var(--border-glass) !important;
}

:root.dark-mode textarea.form-control {
  background: var(--bg-glass) !important;
  color: var(--text-primary) !important;
  border: var(--border-glass) !important;
}

:root.dark-mode .form-check-input {
  background: var(--bg-glass) !important;
  border: var(--border-glass) !important;
}

:root.dark-mode .form-check-label {
  color: var(--text-secondary) !important;
}

:root.dark-mode .navbar-brand {
  color: var(--text-primary) !important;
}

:root.dark-mode .navbar-toggler {
  border: var(--border-glass) !important;
}

:root.dark-mode .navbar-toggler-icon {
  filter: brightness(0) invert(1);
}

:root.dark-mode .sidebar {
  background: var(--bg-card) !important;
  border: var(--card-border) !important;
}

:root.dark-mode .sidebar .nav-link {
  color: var(--text-secondary) !important;
}

:root.dark-mode .sidebar .nav-link:hover {
  background: var(--hover-bg) !important;
  color: var(--text-primary) !important;
}

/* Force override any Bootstrap or other framework styles */
:root.dark-mode * {
  color: inherit !important;
}

:root.dark-mode a {
  color: var(--accent-color) !important;
}

:root.dark-mode a:hover {
  color: var(--accent-secondary) !important;
}

/* Mobile responsiveness for demo elements */
@media (max-width: 768px) {
  .demo-signup-cta {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin-left: 0;
  }

  .demo-badge {
    text-align: center;
    align-self: center;
  }

  .navbar {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links {
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* 🎨 ENHANCED VISUAL DESIGN IMPROVEMENTS */

/* Smooth scrolling for the entire page */
html {
  scroll-behavior: smooth;
}

/* Enhanced page transitions */
body {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modern glassmorphism enhancements */
.cmms-card {
  position: relative;
  overflow: hidden;
}

.cmms-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: rotate(-45deg);
  transition: all 0.6s ease;
  opacity: 0;
}

.cmms-card:hover::after {
  left: 50%;
  opacity: 1;
}

/* Enhanced loading states */
.loading-shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-glass) 0%,
    var(--bg-glass-hover) 50%,
    var(--bg-glass) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
  border-radius: 8px;
  height: 20px;
  margin: 5px 0;
}

.loading-shimmer.wide {
  width: 100%;
}

.loading-shimmer.medium {
  width: 70%;
}

.loading-shimmer.narrow {
  width: 40%;
}

/* Modern button hover effects */
.cmms-btn {
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.cmms-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
  z-index: -1;
}

.cmms-btn:hover::before {
  left: 100%;
}

/* Enhanced table animations */
.cmms-table tbody tr {
  transition: all 0.3s ease;
  transform: translateZ(0); /* GPU acceleration */
}

.cmms-table tbody tr:hover {
  transform: translateY(-2px) translateZ(0);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.2);
}

/* Modern form enhancements */
.form-control, .form-select {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.form-control:focus, .form-select:focus {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

/* Enhanced status indicators */
.status-indicator {
  position: relative;
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-indicator.operational {
  background: linear-gradient(135deg, rgba(56, 239, 125, 0.2), rgba(17, 153, 142, 0.1));
  color: #38ef7d;
  border: 1px solid rgba(56, 239, 125, 0.3);
  animation: pulse-success 2s infinite;
}

.status-indicator.warning {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.1));
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
  animation: pulse-warning 2s infinite;
}

.status-indicator.critical {
  background: linear-gradient(135deg, rgba(255, 71, 87, 0.2), rgba(238, 90, 82, 0.1));
  color: #ff4757;
  border: 1px solid rgba(255, 71, 87, 0.3);
  animation: pulse-danger 2s infinite;
}

@keyframes pulse-success {
  0%, 100% { box-shadow: 0 0 0 0 rgba(56, 239, 125, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(56, 239, 125, 0); }
}

@keyframes pulse-warning {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(251, 191, 36, 0); }
}

@keyframes pulse-danger {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(255, 71, 87, 0); }
}

/* Enhanced notification system */
.notification-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(20px);
  border: var(--card-border);
  border-radius: 15px;
  padding: 15px 20px;
  box-shadow: var(--shadow-glass);
  z-index: 10000;
  min-width: 300px;
  max-width: 400px;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.notification-toast.show {
  transform: translateX(0);
}

.notification-toast.success {
  border-left: 4px solid #38ef7d;
}

.notification-toast.warning {
  border-left: 4px solid #fbbf24;
}

.notification-toast.error {
  border-left: 4px solid #ff4757;
}

.notification-toast.info {
  border-left: 4px solid #4299e1;
}

/* Modern context menu styles */
.context-menu {
  position: absolute;
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(20px);
  border: var(--card-border);
  border-radius: 12px;
  padding: 8px 0;
  box-shadow: var(--shadow-glass);
  z-index: 10000;
  min-width: 180px;
  animation: contextMenuAppear 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.context-menu-item {
  padding: 12px 16px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.context-menu-item:hover {
  background: var(--bg-glass-hover);
  color: var(--accent-color);
}

.context-menu-item i {
  width: 16px;
  text-align: center;
}

@keyframes contextMenuAppear {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Enhanced progress indicators */
.progress-ring {
  width: 60px;
  height: 60px;
  transform: rotate(-90deg);
}

.progress-ring circle {
  fill: none;
  stroke: var(--border-glass);
  stroke-width: 4;
  stroke-dasharray: 188.4;
  stroke-dashoffset: 188.4;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-ring circle.progress {
  stroke: var(--accent-color);
  stroke-linecap: round;
}

/* Modern tooltip system */
.tooltip-modern {
  position: absolute;
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(20px);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-glass);
  z-index: 10000;
  opacity: 0;
  transform: translateY(5px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.tooltip-modern.show {
  opacity: 1;
  transform: translateY(0);
}

.tooltip-modern::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 4px solid var(--bg-glass-heavy);
}

/* ============================================
   🎨 CONSISTENT MODAL STYLING SYSTEM
   Ensures all modals are readable in light/dark mode
   ============================================ */

/* Glass Panel - Theme-aware styling */
.glass-panel {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-glass) !important;
  border-radius: 16px;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  color: var(--text-primary) !important;
}

.glass-panel h2,
.glass-panel h3,
.glass-panel h4,
.glass-panel h5,
.glass-panel h6 {
  color: var(--text-primary) !important;
}

.glass-panel p {
  color: var(--text-secondary) !important;
}

.glass-panel input,
.glass-panel select,
.glass-panel textarea,
.glass-panel .form-control,
.glass-panel .form-select {
  background: var(--input-bg) !important;
  border: 1px solid var(--input-border) !important;
  color: var(--text-primary) !important;
}

.glass-panel input::placeholder,
.glass-panel textarea::placeholder {
  color: var(--text-muted) !important;
}

/* Planner Dashboard Modal Styling - Ensure form readability */
.planner-dashboard .modal-content {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-glass) !important;
  color: var(--text-primary) !important;
  border-radius: 16px;
}

.planner-dashboard .modal-header {
  background: var(--bg-glass) !important;
  border-bottom: 1px solid var(--border-glass) !important;
  color: var(--text-primary) !important;
  border-radius: 16px 16px 0 0;
}

.planner-dashboard .modal-header h5,
.planner-dashboard .modal-header .modal-title {
  color: var(--text-primary) !important;
}

.planner-dashboard .modal-body {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

.planner-dashboard .modal-body h4,
.planner-dashboard .modal-body h5,
.planner-dashboard .modal-body label {
  color: var(--text-primary) !important;
}

.planner-dashboard .modal-body p {
  color: var(--text-secondary) !important;
}

.planner-dashboard .modal-footer {
  background: var(--bg-glass) !important;
  border-top: 1px solid var(--border-glass) !important;
  border-radius: 0 0 16px 16px;
}

/* Planner modal form inputs - ensure readable in all modes */
.planner-dashboard .modal input,
.planner-dashboard .modal select,
.planner-dashboard .modal textarea,
.planner-dashboard .modal .form-control,
.planner-dashboard .modal .form-select {
  background: var(--input-bg) !important;
  border: 1px solid var(--input-border) !important;
  color: var(--text-primary) !important;
  padding: 0.75rem;
  border-radius: 8px;
}

.planner-dashboard .modal input::placeholder,
.planner-dashboard .modal textarea::placeholder {
  color: var(--text-muted) !important;
}

.planner-dashboard .modal select option {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

/* Scanner Modal Styling - Theme aware */
.modal .modal-content.glass-panel,
.modal > div[style*="background: var(--card-bg)"],
.modal > div[style*="background: var(--bg-card)"] {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

/* Force readable text in scanner modals */
#barcodeScanModal .modal-content,
#barcodeScanModal .glass-panel,
#workOrderBarcodeScanModal .modal-content {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

#barcodeScanModal h2,
#barcodeScanModal h4,
#barcodeScanModal p,
#workOrderBarcodeScanModal h2,
#workOrderBarcodeScanModal h4,
#workOrderBarcodeScanModal p {
  color: var(--text-primary) !important;
}

#barcodeScanModal input,
#barcodeScanModal .form-control,
#workOrderBarcodeScanModal input,
#workOrderBarcodeScanModal .form-control {
  background: var(--input-bg) !important;
  border: 1px solid var(--input-border) !important;
  color: var(--text-primary) !important;
}

/* Fix border-top styling that uses rgba for light mode */
.planner-dashboard div[style*="border-top: 1px solid rgba(255,255,255,0.2)"] {
  border-top-color: var(--border-glass) !important;
}

/* Universal Modal - Theme-aware variant (applies to modals without modal-light class) */
.modal:not(.modal-light) .modal-content:not(.form-light) {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
}

.modal:not(.modal-light) .modal-header:not(.form-light) {
  border-bottom: 1px solid var(--border-glass);
  color: var(--text-primary);
}

.modal:not(.modal-light) .modal-footer:not(.form-light) {
  border-top: 1px solid var(--border-glass);
}

/* Ensure modals with glass-panel in dark mode are properly styled */
:root.dark-mode .glass-panel {
  background: var(--bg-card) !important;
  border-color: var(--border-glass) !important;
}

:root.dark-mode .glass-panel h2,
:root.dark-mode .glass-panel h4,
:root.dark-mode .glass-panel p {
  color: var(--text-primary) !important;
}

/* Light mode scanner modal fix - prevent black backgrounds */
:root:not(.dark-mode) #barcodeScanModal .glass-panel,
:root:not(.dark-mode) #barcodeScanModal .modal-content {
  background: #ffffff !important;
  color: #2d3748 !important;
}

:root:not(.dark-mode) #barcodeScanModal h2,
:root:not(.dark-mode) #barcodeScanModal h4,
:root:not(.dark-mode) #barcodeScanModal p {
  color: #2d3748 !important;
}

:root:not(.dark-mode) #barcodeScanModal input,
:root:not(.dark-mode) #barcodeScanModal .form-control {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #2d3748 !important;
}
