/* Modern Bootstrap 5 Enhancements for Rapso */

/* CSS Variables para Rapso theming */
:root {
  /* Rapso Brand Colors */
  --bs-primary: #2563eb;
  --bs-primary-rgb: 37, 99, 235;
  --bs-primary-dark: #1d4ed8;
  --bs-primary-light: #3b82f6;
  --bs-secondary: #64748b;
  --bs-success: #10b981;
  --bs-info: #06b6d4;
  --bs-warning: #f59e0b;
  --bs-danger: #ef4444;

  /* Rapso Custom Colors */
  --rapso-blue: #2563eb;
  --rapso-blue-light: #dbeafe;
  --rapso-blue-dark: #1e40af;
  --rapso-purple: #7c3aed;
  --rapso-teal: #0891b2;
  --rapso-orange: #ea580c;
  --rapso-dark: #1e293b;
  --rapso-light: #f8fafc;
  --rapso-gray: #64748b;
  --rapso-gray-light: #e2e8f0;

  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-xxl: 3rem;

  /* Border Radius */
  --border-radius-sm: 0.25rem;
  --border-radius: 0.5rem;
  --border-radius-lg: 0.75rem;
  --border-radius-xl: 1rem;

  /* Shadows */
  --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);

  /* Transitions */
  --transition-base: all 0.3s ease;
  --transition-fast: all 0.15s ease;
}

/* Rapso Branding */
.rapso-body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, var(--rapso-light) 0%, var(--rapso-blue-light) 100%);
  min-height: 100vh;
}

/* Rapso Brand Header */
.rapso-brand-header {
  background: linear-gradient(135deg, var(--rapso-blue) 0%, var(--rapso-purple) 100%);
  color: white;
  padding: var(--space-lg) 0;
  position: relative;
  overflow: hidden;
}

.rapso-brand-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
  opacity: 0.3;
}

.rapso-brand-content {
  position: relative;
  z-index: 1;
}

/* Rapso Loading Animation */
@keyframes rapso-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

.rapso-logo {
  animation: rapso-pulse 2s infinite;
}

/* Rapso Cards */
.rapso-card {
  border: none;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow);
  transition: var(--transition-base);
  position: relative;
  overflow: hidden;
}

.rapso-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--rapso-blue), transparent);
  transition: left 0.5s;
}

.rapso-card:hover::before {
  left: 100%;
}

.rapso-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Enhanced Body */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  overscroll-behavior-y: contain;
}

/* Modern Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
}

/* Rapso Links */
a, .btn-link {
  color: var(--rapso-blue);
  text-decoration: none;
  transition: var(--transition-fast);
  position: relative;
}

a:hover, .btn-link:hover {
  color: var(--rapso-blue-dark);
  text-decoration: underline;
}

a:focus, .btn-link:focus {
  color: var(--rapso-purple);
  outline: 2px solid var(--rapso-blue-light);
  outline-offset: 2px;
}

/* Rapso Enhanced Buttons */
.btn {
  font-weight: 500;
  border-radius: var(--border-radius);
  transition: var(--transition-base);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--rapso-blue) 0%, var(--rapso-blue-dark) 100%);
  border: none;
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--rapso-blue-dark) 0%, var(--rapso-blue) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:focus {
  background: linear-gradient(135deg, var(--rapso-blue-dark) 0%, var(--rapso-blue) 100%);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

/* Rapso Success Button */
.btn-success {
  background: linear-gradient(135deg, var(--bs-success) 0%, #059669 100%);
  border: none;
  color: white;
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, var(--bs-success) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Rapso Brand Button */
.btn-brand {
  background: linear-gradient(135deg, var(--rapso-purple) 0%, var(--rapso-blue) 100%);
  border: none;
  color: white;
  font-weight: 600;
  padding: var(--space-sm) var(--space-lg);
}

.btn-brand:hover {
  background: linear-gradient(135deg, var(--rapso-blue) 0%, var(--rapso-purple) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

/* Rapso Card Enhancements */
.card {
  border: none;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow);
  transition: var(--transition-base);
  background: white;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-header {
  background: linear-gradient(135deg, var(--rapso-blue-light) 0%, white 100%);
  border-bottom: 1px solid var(--rapso-gray-light);
  font-weight: 600;
  color: var(--rapso-dark);
}

/* Rapso Form Controls */
.form-control {
  border: 2px solid var(--rapso-gray-light);
  border-radius: var(--border-radius);
  transition: var(--transition-base);
  font-weight: 400;
}

.form-control:focus {
  border-color: var(--rapso-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background-color: var(--rapso-light);
}

.form-control:hover {
  border-color: var(--rapso-gray);
}

/* Rapso Status Indicators */
.status-online {
  color: var(--bs-success);
  background: rgba(16, 185, 129, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-offline {
  color: var(--bs-danger);
  background: rgba(239, 68, 68, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-pending {
  color: var(--bs-warning);
  background: rgba(245, 158, 11, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.btn-primary {
  background: linear-gradient(135deg, var(--rapso-blue) 0%, var(--rapso-purple) 100%);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--rapso-purple) 0%, var(--rapso-blue) 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-outline-primary {
  border: 2px solid var(--rapso-blue);
  color: var(--rapso-blue);
}

.btn-outline-primary:hover {
  background: var(--rapso-blue);
  border-color: var(--rapso-blue);
}

/* Enhanced Cards */
.card {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
  overflow: hidden;
}

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

.card-header {
  background: linear-gradient(135deg, var(--rapso-light) 0%, white 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-weight: 600;
}

/* Modern Navigation */
.navbar {
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
}

.nav-link {
  font-weight: 500;
  transition: var(--transition-fast);
  border-radius: var(--border-radius);
  margin: 0 var(--space-xs);
}

.nav-link:hover {
  background: rgba(13, 110, 253, 0.1);
  color: var(--rapso-blue);
}

/* Enhanced Forms */
.form-control, .form-select {
  border: 2px solid #e9ecef;
  border-radius: var(--border-radius);
  transition: var(--transition-fast);
  font-weight: 400;
}

.form-control:focus, .form-select:focus {
  border-color: var(--rapso-blue);
  box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.25);
}

.form-label {
  font-weight: 600;
  color: var(--rapso-dark);
  margin-bottom: var(--space-sm);
}

/* Modern Progress Bars */
.progress {
  height: 0.75rem;
  border-radius: var(--border-radius-xl);
  background-color: rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.progress-bar {
  transition: width 0.6s ease;
  background: linear-gradient(90deg, var(--rapso-blue) 0%, var(--rapso-purple) 100%);
}

/* Enhanced Badges */
.badge {
  font-weight: 500;
  padding: 0.5em 0.75em;
  border-radius: var(--border-radius-xl);
}

/* Modern Dropdowns */
.dropdown-menu {
  border: 0;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow);
  padding: var(--space-sm);
  margin-top: var(--space-sm);
}

.dropdown-item {
  border-radius: var(--border-radius);
  padding: var(--space-sm) var(--space-md);
  transition: var(--transition-fast);
  font-weight: 400;
}

.dropdown-item:hover {
  background: var(--rapso-light);
  color: var(--rapso-blue);
}

/* Status Indicators */
.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: var(--space-sm);
}

.status-online {
  background-color: var(--bs-success);
  animation: pulse-green 2s infinite;
}

.status-offline {
  background-color: var(--bs-secondary);
}

.status-warning {
  background-color: var(--bs-warning);
  animation: pulse-yellow 2s infinite;
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(25, 135, 84, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(25, 135, 84, 0); }
  100% { box-shadow: 0 0 0 0 rgba(25, 135, 84, 0); }
}

@keyframes pulse-yellow {
  0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(255, 193, 7, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}

/* Avatar System */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--rapso-blue) 0%, var(--rapso-purple) 100%);
  box-shadow: var(--shadow-sm);
}

.avatar-xs { width: 24px; height: 24px; font-size: 0.75rem; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.875rem; }
.avatar-md { width: 40px; height: 40px; font-size: 1rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1.25rem; }
.avatar-xl { width: 64px; height: 64px; font-size: 1.5rem; }

/* Enhanced Tables */
.table {
  margin-bottom: 0;
}

.table th {
  font-weight: 600;
  color: var(--rapso-dark);
  border-bottom: 2px solid var(--rapso-blue);
}

.table-hover tbody tr:hover {
  background-color: rgba(67, 97, 238, 0.05);
}

/* Modern Sidebar */
.sidebar {
  background: linear-gradient(180deg, var(--rapso-dark) 0%, #1a1b2a 100%);
  min-height: 100vh;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.sidebar .nav-link {
  color: rgba(255, 255, 255, 0.8);
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-xs) var(--space-md);
  border-radius: var(--border-radius);
  transition: var(--transition-fast);
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateX(4px);
}

/* Modern Main Content */
.main {
  background-color: var(--bs-body-bg);
  min-height: calc(100vh - 56px); /* Account for navbar height */
  overflow-y: auto;
}

/* Enhanced Sidebar Navigation */
.sidebar .nav-pills .nav-link {
  color: rgba(255, 255, 255, 0.7);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-xs);
  transition: all 0.2s ease;
}

.sidebar .nav-pills .nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateX(2px);
}

.sidebar .nav-pills .nav-link.active {
  background: var(--rapso-blue);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* Avatar sizes补充 */
.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
}

/* Sticky Header */
.navbar.sticky-top {
  z-index: 1030;
}

/* Offcanvas improvements */
.offcanvas {
  background: linear-gradient(180deg, var(--rapso-dark) 0%, #1a1b2a 100%);
}

.offcanvas-header {
  border-bottom: 1px solid var(--card-border-color);
}

/* Mobile responsive adjustments */
@media (max-width: 991.98px) {
  .main {
    min-height: calc(100vh - 76px);
  }

  .navbar-brand div span {
    font-size: 1.25rem;
  }

  .navbar-brand div small {
    font-size: 0.75rem;
  }
}

/* Modern Device Card Styles */
.modern-device-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 1rem;
  overflow: hidden;
}

.modern-device-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modern-device-card.expanded {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modern-device-card .progress {
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
}

.modern-device-card .progress-bar {
  border-radius: 10px;
  transition: width 0.6s ease;
}

.modern-device-card .badge {
  font-size: 0.75rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
}

.dark-theme .modern-device-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border-color);
}

.light-theme .modern-device-card {
  background-color: white;
  border: 1px solid rgba(0, 0, 0, 0.125);
}

/* Status indicator animations */
.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.status-online {
  background-color: #10b981;
  animation: pulse-green 2s infinite;
}

.status-offline {
  background-color: #6b7280;
}

.status-warning {
  background-color: #f59e0b;
  animation: pulse-yellow 2s infinite;
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-yellow {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* Modern Login Page Styles */
.bg-gradient {
  background: linear-gradient(135deg, var(--rapso-blue) 0%, var(--rapso-purple) 100%);
  min-height: 100vh;
}

/* Form enhancements for login */
.form-control:focus {
  border-color: var(--rapso-blue);
  box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.25);
}

.form-floating > .form-control:focus ~ label {
  color: var(--rapso-blue);
}

.form-control.border-2 {
  border-width: 2px;
  transition: all 0.2s ease;
}

.form-control.border-2:focus {
  border-color: var(--rapso-blue);
  transform: translateY(-1px);
}

/* Feature icons for login */
.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.feature-icon:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.2);
}

/* Avatar sizes补充 para login */
.avatar-xl {
  width: 80px;
  height: 80px;
  font-size: 2rem;
}

/* Loading states */
.loading-disabled {
  opacity: 0.7;
  pointer-events: none;
}

/* Alert improvements */
.alert {
  border: 0;
  border-radius: 1rem;
  backdrop-filter: blur(10px);
}

.alert-dismissible .btn-close {
  filter: brightness(0) invert(1);
}

/* Button improvements */
.btn {
  border-radius: 0.75rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.2);
}

.btn:disabled {
  transform: none;
  box-shadow: none;
}

.btn-lg {
  padding: 0.75rem 2rem;
  font-size: 1.125rem;
}

/* Link improvements */
.text-decoration-none {
  transition: all 0.2s ease;
}

.text-decoration-none:hover {
  color: var(--rapso-blue) !important;
  transform: translateY(-1px);
}

/* Toast Notifications */
.toast {
  border: 0;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.toast-header {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-weight: 600;
}

/* Enhanced Validation */
.valid.modified:not([type=checkbox]) {
  outline: 2px solid var(--bs-success);
  outline-offset: 2px;
}

.invalid {
  outline: 2px solid var(--bs-danger);
  outline-offset: 2px;
}

.validation-message {
  color: var(--bs-danger);
  font-size: 0.875rem;
  margin-top: var(--space-xs);
  font-weight: 500;
}

/* Enhanced Error UI */
#blazor-error-ui {
  background: linear-gradient(135deg, #fff8e1 0%, #fff3c4 100%);
  border: 1px solid #ffc107;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  color: var(--rapso-dark);
  font-weight: 500;
  padding: var(--space-lg);
}

#blazor-error-ui .dismiss {
  background: var(--bs-warning);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

#blazor-error-ui .dismiss:hover {
  background: var(--bs-danger);
  color: white;
}

/* Reconnection Modal */
#components-reconnect-modal {
  background: white;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  color: var(--rapso-dark);
}

/* Responsive Improvements */
@media (max-width: 768px) {
  .btn {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
  }

  .card {
    margin-bottom: var(--space-md);
  }

  .table-responsive {
    border-radius: var(--border-radius);
  }
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.spinner-border-sm {
  width: 1rem;
  height: 1rem;
  border-width: 0.125em;
}

/* Enhanced Focus States */
.btn:focus,
.form-control:focus,
.form-select:focus,
.nav-link:focus {
  outline: 2px solid var(--rapso-blue);
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .btn,
  .sidebar,
  .navbar {
    display: none !important;
  }

  .card {
    border: 1px solid #ddd !important;
    box-shadow: none !important;
  }
}

/* Accessibility Improvements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus visible for better accessibility */
.btn.focus-visible,
.nav-link.focus-visible {
  outline: 2px solid var(--rapso-blue);
  outline-offset: 2px;
}

/* ============================================
   MODERN SWITCHES AND SLIDERS (iOS/Android Style)
   ============================================ */

/* Enhanced Form Switches - iOS Style */
.form-check {
  margin-bottom: 1rem;
}

.form-check.form-switch {
  padding-left: 3rem;
  min-height: 2.5rem;
}

.form-check.form-switch .form-check-input {
  width: 3.5rem;
  height: 1.75rem;
  margin-left: -3.5rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280,0,0,.25%29'/%3e%3c/svg%3e");
  background-position: left center;
  border-radius: 2rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid #dee2e6;
  cursor: pointer;
}

.form-check.form-switch .form-check-input:checked {
  background-color: var(--rapso-blue);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%28255,255,255,1.0%29'/%3e%3c/svg%3e");
  background-position: right center;
  border-color: var(--rapso-blue);
  transform: scale(1.05);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.form-check.form-switch .form-check-input:hover:not(:checked) {
  border-color: var(--rapso-blue);
  background-color: rgba(37, 99, 235, 0.1);
  transform: scale(1.02);
}

.form-check.form-switch .form-check-input:hover:checked {
  transform: scale(1.08);
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.15);
}

.form-check.form-switch .form-check-input:focus {
  border-color: var(--rapso-blue);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25);
}

.form-check.form-switch .form-check-input:disabled {
  background-color: #e9ecef;
  border-color: #dee2e6;
  cursor: not-allowed;
  opacity: 0.6;
}

.form-check.form-switch .form-check-input:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Enhanced Switch Labels */
.form-check.form-switch .form-check-label {
  font-weight: 500;
  color: var(--rapso-dark);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  min-height: 1.75rem;
}

.form-check.form-switch .form-check-label:hover {
  color: var(--rapso-blue);
}

/* ============================================
   MODERN BUTTON SPACING AND LAYOUT
   ============================================ */

/* Button Groups with Proper Spacing */
.btn-group {
  gap: 0.5rem;
}

.btn-group .btn {
  border-radius: var(--border-radius);
}

/* Enhanced Button Spacing */
.d-flex .btn {
  margin: 0.25rem;
}

.d-flex .btn:first-child {
  margin-left: 0;
}

.d-flex .btn:last-child {
  margin-right: 0;
}

/* Compact Button Layout for Cards */
.card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 1rem 0;
  border-top: 1px solid var(--rapso-gray-light);
}

.card-actions .btn {
  flex: 1;
  min-width: 100px;
}

/* Responsive Button Grid */
.button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

/* Tight Button Layout */
.button-tight {
  display: flex;
  gap: 0.25rem;
}

.button-tight .btn {
  margin: 0;
  border-radius: 0;
}

.button-tight .btn:first-child {
  border-top-left-radius: var(--border-radius);
  border-bottom-left-radius: var(--border-radius);
}

.button-tight .btn:last-child {
  border-top-right-radius: var(--border-radius);
  border-bottom-right-radius: var(--border-radius);
}

/* ============================================
   IMPROVED FORM CONTROLS
   ============================================ */

/* Enhanced Input Groups */
.input-group {
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
}

.input-group:focus-within {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
  transform: translateY(-1px);
}

.input-group .form-control {
  border: none;
  border-right: 1px solid var(--rapso-gray-light);
}

.input-group .form-control:focus {
  box-shadow: none;
  border-right-color: var(--rapso-blue);
}

.input-group .btn {
  border: none;
  box-shadow: none;
}

.input-group-text {
  border: none;
  background: var(--rapso-light);
  color: var(--rapso-dark);
  font-weight: 500;
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* Better Focus States */
.form-check-input:focus,
.btn:focus,
.form-control:focus {
  outline: 2px solid var(--rapso-blue);
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .form-check.form-switch .form-check-input {
    border-width: 3px;
  }

  .form-check.form-switch .form-check-input:checked {
    box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.3);
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .form-check.form-switch .form-check-input,
  .btn,
  .form-control {
    transition: none;
  }
}

/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */

/* Touch-friendly Switches on Mobile */
@media (max-width: 768px) {
  .form-check.form-switch .form-check-input {
    width: 4rem;
    height: 2rem;
    margin-left: -4rem;
  }

  .form-check.form-switch {
    padding-left: 3.5rem;
    min-height: 3rem;
  }

  .form-check.form-switch .form-check-label {
    font-size: 1rem;
    padding-top: 0.25rem;
  }

  /* Stacked Buttons on Mobile */
  .button-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .card-actions {
    flex-direction: column;
  }

  .card-actions .btn {
    width: 100%;
  }
}