/* ==========================================================================
   FEDECOM LAB - MODERN MOBILE DESIGN SYSTEM
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');
@import url('https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css');

:root {
  --app-font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --app-font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Surfaces & Backgrounds */
  --app-bg: #f8fafc;
  --app-bg-gradient: radial-gradient(at 0% 0%, rgba(224, 242, 254, 0.5) 0px, transparent 50%),
                     radial-gradient(at 100% 100%, rgba(241, 245, 249, 0.8) 0px, transparent 50%),
                     #f8fafc;
  --app-surface: #ffffff;
  --app-surface-glass: rgba(255, 255, 255, 0.85);
  --app-surface-border: #e2e8f0;
  
  /* Primary & Brand */
  --app-primary: #0284c7;
  --app-primary-hover: #0369a1;
  --app-primary-glow: rgba(2, 132, 199, 0.25);
  
  /* Material specific colors */
  --app-ag: #0ea5e9;        /* AG - Plata (Icy Silver Cyan) */
  --app-ag-gradient: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  --app-sn: #d97706;        /* SN - Estaño (Amber Tin Bronze) */
  --app-sn-gradient: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  
  /* Statuses */
  --app-success: #10b981;
  --app-danger: #ef4444;
  --app-warning: #f59e0b;
  --app-info: #06b6d4;

  /* Elevation */
  --app-shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --app-shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --app-shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --app-shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.05);

  --app-radius-sm: 8px;
  --app-radius-md: 12px;
  --app-radius-lg: 16px;
  --app-radius-xl: 20px;
}

/* Base resets & typography */
body {
  font-family: var(--app-font-body) !important;
  background: var(--app-bg-gradient) !important;
  color: #1e293b !important;
  min-height: 100vh;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: 76px; /* Space for mobile bottom bar */
}

@media (min-width: 768px) {
  body {
    padding-bottom: 24px;
  }
}

h1, h2, h3, h4, h5, h6, .card-title, .navbar-brand {
  font-family: var(--app-font-heading) !important;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* --------------------------------------------------------------------------
   NAVBAR (STICKY GLASS)
   -------------------------------------------------------------------------- */
.app-navbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  background: rgba(255, 255, 255, 0.88) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--app-surface-border);
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.04);
  padding: 0.75rem 1rem;
  transition: all 0.3s ease;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.25rem;
  color: #0f172a !important;
  text-decoration: none;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #e0f2fe;
  color: #0369a1;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  border: 1px solid #bae6fd;
}

.navbar-nav .nav-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: #475569 !important;
  padding: 0.5rem 0.85rem !important;
  border-radius: var(--app-radius-md);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.15rem 0.2rem;
}

.navbar-nav .nav-link:hover {
  color: var(--app-primary) !important;
  background: rgba(2, 132, 199, 0.08);
}

.navbar-nav .nav-link.active-pill-ag {
  background: var(--app-ag-gradient);
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.navbar-nav .nav-link.active-pill-sn {
  background: var(--app-sn-gradient);
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

/* User pill dropdown in navbar */
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  transition: all 0.2s ease;
}

.user-pill:hover {
  background: #e2e8f0;
}

.status-dot-pulse {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 2s infinite;
}

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

/* --------------------------------------------------------------------------
   MOBILE BOTTOM NAVIGATION BAR (DOCK)
   -------------------------------------------------------------------------- */
.mobile-bottom-dock {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
  z-index: 1030;
  justify-content: space-around;
  align-items: center;
  padding: 0.25rem 0.5rem env(safe-area-inset-bottom);
}

@media (min-width: 768px) {
  .mobile-bottom-dock {
    display: none !important;
  }
}

.mobile-dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: #64748b;
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.3rem 0;
  border-radius: var(--app-radius-md);
  transition: all 0.2s ease;
}

.mobile-dock-item i {
  font-size: 1.25rem;
  line-height: 1;
  margin-bottom: 2px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-dock-item:active i {
  transform: scale(0.85);
}

.mobile-dock-item.active,
.mobile-dock-item:hover {
  color: var(--app-primary);
}

.mobile-dock-item.item-ag.active {
  color: #0284c7;
}

.mobile-dock-item.item-sn.active {
  color: #d97706;
}

/* Center Highlight Button for Mobile (Quick Action) */
.mobile-dock-center {
  background: var(--app-ag-gradient);
  color: #ffffff !important;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
  margin-top: -24px;
  border: 3px solid #ffffff;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-dock-center:active {
  transform: scale(0.92);
}

.mobile-dock-center i {
  font-size: 1.35rem;
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   OFFCANVAS DRAWER MENU (MOBILE)
   -------------------------------------------------------------------------- */
.mobile-drawer {
  background: #ffffff;
  border-top-left-radius: var(--app-radius-xl);
  border-bottom-left-radius: var(--app-radius-xl);
  width: 300px !important;
  box-shadow: var(--app-shadow-xl);
}

.drawer-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--app-surface-border);
  background: #f8fafc;
}

.drawer-user-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.drawer-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--app-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.drawer-body {
  padding: 1rem;
}

.drawer-category {
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.08em;
  margin: 1.2rem 0 0.5rem 0.5rem;
}

.drawer-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  color: #334155;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: var(--app-radius-md);
  transition: all 0.2s ease;
  margin-bottom: 0.25rem;
}

.drawer-link:hover,
.drawer-link:active {
  background: #f1f5f9;
  color: var(--app-primary);
  transform: translateX(4px);
}

.drawer-link i {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   MODERN CARDS & CONTAINERS
   -------------------------------------------------------------------------- */
.card {
  background: var(--app-surface) !important;
  border: 1px solid var(--app-surface-border) !important;
  border-radius: var(--app-radius-lg) !important;
  box-shadow: var(--app-shadow-md) !important;
  overflow: hidden;
  margin-bottom: 1.5rem;
  transition: box-shadow 0.3s ease;
}

.card:hover {
  box-shadow: var(--app-shadow-lg) !important;
}

.card-header {
  background: #ffffff !important;
  border-bottom: 1px solid var(--app-surface-border) !important;
  padding: 1rem 1.25rem !important;
  font-weight: 700;
  font-size: 1.1rem;
  color: #0f172a;
}

.card-body {
  padding: 1.25rem !important;
}

@media (max-width: 576px) {
  .card-body {
    padding: 1rem !important;
  }
  .card-header {
    padding: 0.85rem 1rem !important;
  }
}

/* --------------------------------------------------------------------------
   TOUCH-FRIENDLY INPUTS & CONTROLS
   -------------------------------------------------------------------------- */
.form-control,
.form-select {
  font-family: var(--app-font-body) !important;
  height: 48px !important;
  min-height: 48px;
  font-size: 1rem !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: var(--app-radius-md) !important;
  padding: 0.65rem 1rem !important;
  color: #0f172a !important;
  background-color: #ffffff !important;
  transition: all 0.2s ease-in-out !important;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--app-primary) !important;
  box-shadow: 0 0 0 4px var(--app-primary-glow) !important;
  outline: none !important;
}

.form-label {
  font-weight: 600 !important;
  color: #475569 !important;
  font-size: 0.85rem !important;
  margin-bottom: 0.4rem !important;
}

/* MDB Fix: ensure floating labels don't clip */
.form-outline .form-control {
  margin-bottom: 0 !important;
}

/* --------------------------------------------------------------------------
   MODERN BUTTONS
   -------------------------------------------------------------------------- */
.btn {
  font-family: var(--app-font-body) !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em;
  padding: 0.65rem 1.25rem !important;
  min-height: 44px;
  border-radius: var(--app-radius-md) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.4rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.btn:active {
  transform: scale(0.97) !important;
}

.btn-primary {
  background: var(--app-primary) !important;
  border-color: var(--app-primary) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px var(--app-primary-glow) !important;
}

.btn-primary:hover {
  background: var(--app-primary-hover) !important;
  border-color: var(--app-primary-hover) !important;
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.35) !important;
}

.btn-secondary {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border-color: #cbd5e1 !important;
}

.btn-secondary:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

.btn-success {
  background: #10b981 !important;
  border-color: #10b981 !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25) !important;
}

.btn-danger {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25) !important;
}

/* Full width buttons on phone */
@media (max-width: 576px) {
  .btn-mobile-full {
    width: 100% !important;
    margin-bottom: 0.5rem;
  }
}

/* --------------------------------------------------------------------------
   LAB STATUS METRICS (BURETA, CUPOS, GRUPO)
   -------------------------------------------------------------------------- */
.lab-metric-card {
  background: #ffffff;
  border: 1px solid var(--app-surface-border);
  border-radius: var(--app-radius-lg);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  box-shadow: var(--app-shadow-sm);
  margin-bottom: 1rem;
}

.lab-metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--app-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.icon-ag { background: #e0f2fe; color: #0284c7; }
.icon-sn { background: #fef3c7; color: #d97706; }
.icon-bureta { background: #fee2e2; color: #ef4444; }
.icon-fecha { background: #f1f5f9; color: #64748b; }

.lab-metric-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 2px;
}

.lab-metric-val {
  font-family: var(--app-font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
}

/* --------------------------------------------------------------------------
   RESPONSIVE TABLES (LIVEWIRE)
   -------------------------------------------------------------------------- */
.table-responsive {
  border-radius: var(--app-radius-md);
  border: 1px solid var(--app-surface-border);
  background: #ffffff;
  box-shadow: var(--app-shadow-sm);
  -webkit-overflow-scrolling: touch;
}

.table {
  margin-bottom: 0 !important;
  font-size: 0.9rem;
}

.table th {
  background: #f8fafc !important;
  color: #475569 !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  font-size: 0.75rem !important;
  letter-spacing: 0.05em !important;
  border-bottom: 1.5px solid var(--app-surface-border) !important;
  padding: 0.85rem 1rem !important;
  white-space: nowrap;
}

.table td {
  padding: 0.85rem 1rem !important;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(248, 250, 252, 0.6) !important;
}

.table-hover tbody tr:hover {
  background-color: rgba(224, 242, 254, 0.3) !important;
}

/* Modern pill badges */
.badge-soft-primary { background: #e0f2fe; color: #0284c7; }
.badge-soft-success { background: #d1fae5; color: #065f46; }
.badge-soft-warning { background: #fef3c7; color: #92400e; }
.badge-soft-danger  { background: #fee2e2; color: #991b1b; }
.badge-soft-secondary { background: #f1f5f9; color: #475569; }

.badge-pill-modern {
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* --------------------------------------------------------------------------
   SCHEDULE SLOTS MATRIX (PLATA & ESTAÑO)
   -------------------------------------------------------------------------- */
.schedule-scroll-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--app-radius-md);
  border: 1px solid var(--app-surface-border);
  background: #ffffff;
  padding: 1rem;
  box-shadow: var(--app-shadow-sm);
}

.schedule-scroll-inner {
  min-width: 980px;
}

.slot-grid-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 0;
  border-bottom: 2px solid #e2e8f0;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.04em;
}

.slot-grid-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.15s ease;
}

.slot-grid-row:hover {
  background-color: #f8fafc;
}

.slot-hour-col {
  width: 140px;
  min-width: 140px;
  flex-shrink: 0;
}

.slot-btn-col {
  width: 52px;
  min-width: 52px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}

.slot-btn {
  width: 48px !important;
  height: 42px !important;
  min-height: 42px !important;
  padding: 0 !important;
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  border-radius: 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.slot-legend-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-radius: var(--app-radius-md);
  border: 1px solid var(--app-surface-border);
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
}

.legend-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.legend-badge-avail {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.legend-badge-disabled {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.legend-badge-reserved {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.mobile-scroll-hint {
  display: none;
  font-size: 0.75rem;
  color: #64748b;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

@media (max-width: 991px) {
  .mobile-scroll-hint {
    display: inline-flex;
  }
}

