/* 
   Mobile-first, premium Medical Roster UI 
   Aesthetics: Vibrant Dark Mode, Glassmorphism, Micro-animations 
*/

:root {
  --bg-base: #0f172a; /* Deep blue/slate dark */
  --bg-surface: #1e293b; /* Slightly lighter surface */
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --accent-color: #f43f5e;
  --accent-hover: #e11d48;
  --success-color: #10b981;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
  --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 15px rgba(59, 130, 246, 0.5);

  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;

  font-size: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Outfit", sans-serif;
  background-color: var(--bg-base);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Typography elements */
h1,
h2,
h3 {
  font-weight: 700;
}
a {
  text-decoration: none;
  color: inherit;
}

/* ======== HEADER ======== */
.glass-header {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 1.5rem;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 600px; /* Mobile focused max-width */
  margin: 0 auto;
}

.title-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-color);
}

.title-area h1 {
  font-size: 1.5rem;
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.title-area ion-icon {
  font-size: 1.8rem;
}

.user-avatar img {
  border-radius: 50%;
  width: 40px;
  height: 40px;
  border: 2px solid var(--primary-color);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

/* ======== MAIN CONTAINER ======== */
/* The app-container structure is now at the bottom in the V5 SPA layout section */

/* ======== DASHBOARD SUMMARY ======== */
.dashboard-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-soft);
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-card ion-icon {
  font-size: 2.2rem;
  background: rgba(59, 130, 246, 0.1);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}

.stat-card.active-shift ion-icon {
  color: var(--success-color);
  background: rgba(16, 185, 129, 0.1);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ======== FLATPICKR CUSTOM STYLES ======== */
.flatpickr-input, .flatpickr-input.active {
    background: transparent !important;
    color: var(--text-main) !important;
    border: none;
    box-shadow: none !important;
    text-align: center;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
}

/* ======== FILTERS ======== */
.filters {
  margin-bottom: 2rem;
}

.search-input {
  width: 100%;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
  transition:
    border-color 0.3s,
    box-shadow 0.3s;
}

.search-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.form-group input,
.form-group select,
.form-group textarea,
#assignForm textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border); /* Changed from --border-color to --glass-border as --border-color is not defined */
  background: var(--bg-surface); /* Changed from --bg-main to --bg-surface as --bg-main is not defined */
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.3s ease;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
#assignForm textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* ======== STAFF LIST ======== */
.section-title {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.staff-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.staff-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
}

/* Glassmorphism gradient effect on hover */
.staff-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.staff-card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow:
    var(--shadow-soft),
    0 5px 15px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.2);
}

.staff-card:hover::before {
  opacity: 1;
}

.staff-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.staff-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
}

/* Shift specific colors */
.shift-morning .staff-icon {
  background: linear-gradient(135deg, #fbbf24, #d97706);
}
.shift-afternoon .staff-icon {
  background: linear-gradient(135deg, #f43f5e, #be123c);
}
.shift-night .staff-icon {
  background: linear-gradient(135deg, #6366f1, #4338ca);
}

.staff-details h4 {
  font-size: 1.1rem;
  margin-bottom: 0.2rem;
}

.staff-details p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.staff-role-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  font-size: 0.75rem;
  margin-top: 5px;
}

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  opacity: 0.7;
  transition: opacity 0.3s;
}

.staff-card:hover .card-actions {
  opacity: 1;
}

.action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 50%;
  transition:
    color 0.2s,
    background 0.2s;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.action-btn.edit:hover {
  color: var(--primary-color);
}
.action-btn.delete:hover {
  color: var(--accent-color);
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

/* ======== FLOATING ACTION BUTTON ======== */
.fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), #2563eb);
  color: white;
  border: none;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 90;
}

.fab:hover {
  transform: scale(1.1) rotate(90deg);
}

.fab:active {
  transform: scale(0.9);
}

.fab-sm {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), #2563eb);
  color: white;
  border: none;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.fab-sm:hover {
  transform: scale(1.1);
}

/* ======== MODALS ======== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  padding: 1rem;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content.glassmorphism {
  background: rgba(30, 41, 59, 0.85); /* Slightly darker for modal */
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 450px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  transform: translateY(30px) scale(0.95);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

#sidebarOverlay.active {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(0, 0, 0, 0.7);
}

/* ======== FAB (Floating Action Button) ======== */
.fab-sm {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.fab-sm:hover {
  transform: translateY(-2px);
  background: var(--primary-hover);
}

/* ======== LAYOUT (V5 SPA) ======== */
body {
    display: flex;
}

.app-container {
    display: flex;
    width: 100%;
}

.sidebar {
    width: 260px;
    background: #0f172a; /* Solid dark navy */
    display: flex;
    flex-direction: column;
    padding: 2rem 1.25rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand > div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    padding: 0.85rem 1.25rem;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #94a3b8;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-item ion-icon {
    font-size: 1.25rem;
}

.nav-item:hover {
    color: #e2e8f0;
}

.nav-item.active {
    background: #1e293b;
    color: #3b82f6;
}

.nav-item.active ion-icon {
    color: #3b82f6;
}

.main-content {
    flex: 1;
    margin-left: 250px; /* Offset for sidebar */
    padding: 2rem;
    max-width: 1200px;
    margin-right: auto;
    min-width: 0; /* Prevents flex blowout */
}

.view {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}
.view.active {
    display: block;
}

/* ======== MEDIA QUERIES ======== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    .mobile-menu-btn {
        display: block !important;
    }
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.close-sidebar-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .close-sidebar-btn {
        display: block;
    }
}

/* ======== AMBULANCE ICON FIX ======== */
.ambulance-icon {
    position: relative;
    display: inline-block;
}
.ambulance-icon::after {
    content: '+';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    color: white;
    font-size: 0.6rem;
    font-weight: bold;
    z-index: 10;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  font-size: 1.3rem;
  background: linear-gradient(135deg, #fff, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.close-btn:hover {
  color: white;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper ion-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  font-size: 1.2rem;
}

.input-wrapper input,
.input-wrapper select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  color: white;
  padding: 1rem 1rem 1rem 3rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: all 0.3s;
  min-width: 0;
}

.input-wrapper select {
  padding-right: 2.5rem;
}

.input-wrapper select option {
  background: var(--bg-surface);
  color: white;
}

.input-wrapper input:focus,
.input-wrapper select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
  background: rgba(0, 0, 0, 0.4);
}
.input-wrapper input:focus + ion-icon,
.input-wrapper select:focus + ion-icon,
.input-wrapper ion-icon:has(+ input:focus),
.input-wrapper ion-icon:has(+ select:focus) {
  color: var(--primary-color);
}

/* Fix for TomSelect padding overlapping with ion-icons */
.input-wrapper .ts-wrapper .ts-control {
  padding-left: 3rem !important;
}


.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-wrap: wrap;
}

.modal-actions .btn {
  flex: 1;
  min-width: 120px;
}

.btn {
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.3s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), #2563eb);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), #1d4ed8);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--text-muted);
  color: white;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.modal-content.warning {
  border-top: 4px solid var(--accent-color);
}

.highlight {
  color: var(--accent-color);
  font-weight: bold;
}

/* ======== TOAST NOTIFICATIONS ======== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-surface);
  border-left: 4px solid var(--primary-color);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(120%);
  transition:
    transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    opacity 0.3s;
  opacity: 0;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.success {
  border-left-color: var(--success-color);
}
.toast.error {
  border-left-color: var(--accent-color);
}

/* ======== SCHEDULE GRID (V2) ======== */
.schedule-container {
    overflow-x: auto;
    padding-bottom: 1rem;
}

.date-picker-input {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    outline: none;
}

/* Hide native browser calendar icon on date inputs (desktop only — on iOS it causes picker issues) */
@supports not (-webkit-touch-callout: none) {
    input[type="date"]::-webkit-calendar-picker-indicator {
        display: none;
    }
}

/* iOS Safari: ensure date inputs don't overflow their containers */
@supports (-webkit-touch-callout: none) {
    input[type="date"] {
        min-width: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
}

.schedule-grid {
    display: flex;
    align-items: flex-start;
    height: -webkit-max-content;
    height: max-content;
    gap: 1rem;
    overflow-x: auto;
    /* proximity instead of mandatory — mandatory blocks vertical page scroll on iOS */
    scroll-snap-type: x proximity;
    /* Prevent horizontal swipe from propagating to the page body on iOS */
    overscroll-behavior-x: contain;
    padding-bottom: 0.5rem;
}

.schedule-day {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    flex: 0 0 calc(100% - 20px); /* Slightly less than 100% so the next day peeks in */
    max-width: 100%;
    align-self: flex-start; /* Evita que se estire al 100% de alto del flex parent */
    height: -webkit-fit-content;
    height: fit-content;
    scroll-snap-align: start;
    padding: 1rem;
    box-shadow: var(--shadow-soft);
}

.schedule-day h3 {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.1rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

.mobile-slot {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 0.8rem;
    margin-bottom: 0.8rem;
    transition: all 0.2s;
}

.mobile-slot:hover {
    border-color: rgba(255,255,255,0.2);
}

.mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.assigned-staff {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.assigned-item {
    background: rgba(0,0,0,0.2);
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.add-slot-btn {
    background: rgba(59, 130, 246, 0.08);
    color: var(--primary-color);
    border: 1px dashed rgba(59, 130, 246, 0.4);
    width: 100%;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.5rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    letter-spacing: 0.03em;
}

.add-slot-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
}

/* Slot with exactly one doctor assigned (day or night) */
.mobile-slot.has-one {
    border-left: 3px solid var(--success-color);
    background: rgba(16, 185, 129, 0.05);
}

/* Slot with two doctors (e.g. 24h coverage with day + night doctor) */
.mobile-slot.has-multiple {
    border-left: 3px solid #f59e0b;
    background: rgba(245, 158, 11, 0.07);
}

.covered-counter {
    display: inline-flex;
    align-items: center;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
    border: 1px solid rgba(16, 185, 129, 0.25);
    margin-left: 0.5rem;
    vertical-align: middle;
}

.remove-assign-btn {
    background: transparent;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    font-size: 1rem;
}

/* ======== RESPONSIVE ======== */
@media (max-width: 480px) {
  .dashboard-summary {
    grid-template-columns: 1fr;
  }
  .fab {
    bottom: 1.5rem;
    right: 1.5rem;
  }
  .modal-content.glassmorphism {
    width: 90%;
    padding: 1.5rem;
  }
}

/* ======== TOM SELECT – DARK THEME OVERRIDES ======== */
.ts-wrapper {
    width: 100%;
}

/* The control box (the visible "input" area) */
.ts-wrapper .ts-control {
    background: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: var(--radius-md) !important;
    color: white !important;
    font-family: inherit !important;
    font-size: 1rem !important;
    padding: 0.85rem 1rem !important;   /* no icon, so no 3rem left */
    box-shadow: none !important;
    min-height: unset !important;
    cursor: text;
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.ts-wrapper.focus .ts-control,
.ts-wrapper .ts-control:focus-within {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3) !important;
    background: rgba(0, 0, 0, 0.4) !important;
}

/* Placeholder text */
.ts-control .ts-placeholder,
.ts-control input::placeholder {
    color: var(--text-muted) !important;
    opacity: 1 !important;
}

/* Typed search input inside the control */
.ts-control input {
    color: white !important;
    background: transparent !important;
    font-family: inherit !important;
    font-size: 1rem !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: 60px !important;
    line-height: 1.4 !important;
}

/* Multi-select items (chips) */
.ts-control .item {
    background: rgba(59, 130, 246, 0.2) !important;
    border: 1px solid rgba(59, 130, 246, 0.4) !important;
    border-radius: 6px !important;
    color: white !important;
    font-size: 0.85rem !important;
    padding: 2px 8px !important;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 !important;
}

/* Remove × inside chip */
.ts-control .item .remove {
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    border: none !important;
    padding: 0 0 0 4px !important;
    transition: color 0.2s;
}
.ts-control .item .remove:hover {
    color: var(--accent-color) !important;
    background: transparent !important;
}

/* Dropdown panel */
.ts-dropdown {
    background: var(--bg-surface) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5) !important;
    margin-top: 4px !important;
    color: white !important;
    font-family: inherit !important;
    overflow: hidden;
}

.ts-dropdown .ts-dropdown-content {
    max-height: 220px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

/* Each option row */
.ts-dropdown .option {
    color: var(--text-main) !important;
    padding: 0.65rem 1rem !important;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.95rem;
}

.ts-dropdown .option:hover,
.ts-dropdown .option.active {
    background: rgba(59, 130, 246, 0.18) !important;
    color: white !important;
}

/* Already-selected option row (multi mode) */
.ts-dropdown .option.selected {
    background: rgba(59, 130, 246, 0.07) !important;
    color: var(--text-muted) !important;
}

/* No results text */
.ts-dropdown .no-results {
    color: var(--text-muted) !important;
    padding: 0.75rem 1rem !important;
    font-style: italic;
    font-size: 0.9rem;
}

/* =========================================
   Print Styles (for Reports)
   ========================================= */
@media print {
    body {
        background: white !important;
        color: black !important;
    }

    .sidebar, 
    .mobile-header,
    .no-print,
    #backToTopBtn,
    .modal-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .app-container {
        display: block !important;
    }

    #reportPrintArea {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }

    .pdf-export-container {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Force background colors to print */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    @page {
        size: auto;
        margin: 15mm;
    }

    /* Prevent mobile slots from breaking across pages */
    #reportContentArea > div > div {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
}

/* ======== SETTINGS TAB STYLES ======== */
.settings-tab-btn {
    white-space: nowrap;
    outline: none;
    transition: all 0.2s ease;
}
.settings-tab-btn:hover {
    color: var(--text-main) !important;
}
.settings-tab-btn.active {
    color: var(--primary-color) !important;
    border-bottom: 2px solid var(--primary-color) !important;
}
