/* Global UX and dark mode enhancements */
:root {
  --focus-ring: #D4A017;
  --ok: #16a34a;
  --bad: #dc2626;
}

/* Beautiful modern rounded typography stack */
body, button, input, select, textarea, option, .font-headline, .font-body, .font-label {
  font-family: "Plus Jakarta Sans", "Outfit", "Inter", "Nunito", "Quicksand", "Segoe UI Variable Text", system-ui, -apple-system, sans-serif !important;
}

/* Sleek Rounded Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(30, 46, 138, 0.15);
  border-radius: 9999px;
}
html.dark ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(30, 46, 138, 0.3);
}
html.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

html.dark {
  color-scheme: dark;
}

html.dark body {
  background: var(--color-bg) !important;
  color: var(--color-fg) !important;
}

html.dark .bg-surface-container-lowest,
html.dark .bg-surface-container-low,
html.dark .bg-surface-container,
html.dark .bg-surface-container-high,
html.dark .bg-surface-container-highest,
html.dark .bg-white,
html.dark [class*="bg-surface-"] {
  background-color: var(--color-card) !important;
  color: var(--color-fg) !important;
}

html.dark [class*="text-on-surface"] {
  color: var(--color-fg) !important;
}

html.dark [class*="text-on-surface-variant"] {
  color: var(--color-muted) !important;
}

html.dark [class*="text-primary"] {
  color: var(--color-accent) !important;
}

html.dark [class*="text-secondary"] {
  color: var(--color-accent-2) !important;
}

html.dark [class*="bg-primary"],
html.dark [class*="from-primary"],
html.dark [class*="to-primary"] {
  color: #f3f7ff !important;
}

html.dark [class*="bg-gradient-to"] {
  border-color: #2a3d66 !important;
}

html.dark [class*="from-surface-container"],
html.dark [class*="to-surface-container"] {
  --tw-gradient-from: #101b37 !important;
  --tw-gradient-via: #15254a !important;
  --tw-gradient-to: #1c2e57 !important;
}

html.dark .bg-error-container {
  background-color: #4d1d23 !important;
  color: #ffd9dd !important;
}

html.dark .bg-secondary-fixed,
html.dark .bg-secondary-container {
  background-color: #634b00 !important;
  color: #ffe8a2 !important;
}

html.dark input,
html.dark textarea,
html.dark select {
  background-color: #0c1731 !important;
  color: #edf3ff !important;
  border: 1px solid #31466f !important;
}

html.dark input::placeholder,
html.dark textarea::placeholder {
  color: #8fa2c6 !important;
}

html.dark a {
  color: #9ec0ff;
}

html.dark a:hover {
  color: #c2d8ff;
}

html.dark .skeleton {
  background: linear-gradient(90deg, #17274a 25%, #22345b 37%, #17274a 63%);
}

:focus-visible {
  outline: 3px solid var(--focus-ring) !important;
  outline-offset: 2px;
}

.is-invalid {
  border: 2px solid var(--bad) !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

.is-valid {
  border: 2px solid var(--ok) !important;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.15);
}

.is-loading {
  opacity: 0.75;
  pointer-events: none;
}

.app-toast-wrap {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 200;
  display: grid;
  gap: 0.5rem;
}

.app-toast {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-weight: 600;
  color: #0f172a;
  background: #fde68a;
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.2);
  animation: toastIn 220ms ease-out;
}

.app-toast.error {
  background: #fecaca;
  color: #7f1d1d;
}

.app-toast.success {
  background: #bbf7d0;
  color: #14532d;
}

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

.table-sticky-head thead th {
  position: sticky;
  top: 0;
  z-index: 5;
}

.table-mobile-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.skeleton {
  border-radius: 0.5rem;
  background: linear-gradient(90deg, #e2e8f0 25%, #f8fafc 37%, #e2e8f0 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ==========================================
   PREMIUM UX AND ESTHETIC OVERRIDES (HIGH SPECIFICITY)
   ========================================== */

/* 1. Sleek Rounded Inputs, Selects, and Textareas */
body input[type="text"],
body input[type="password"],
body input[type="number"],
body input[type="email"],
body input[type="date"],
body input[type="search"],
body select,
body textarea {
  background-color: var(--color-input-bg) !important;
  color: var(--color-fg) !important;
  border: 1px solid var(--color-input-border) !important;
  border-radius: 1rem !important; /* 16px - Soft rounded */
  padding: 0.75rem 1.125rem !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.01) !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

body input:hover,
body select:hover,
body textarea:hover {
  border-color: var(--color-accent) !important;
  background-color: var(--color-table-hover) !important;
}

body input:focus,
body select:focus,
body textarea:focus {
  background-color: var(--color-input-bg) !important;
  border-color: var(--color-accent) !important;
  outline: none !important;
  box-shadow: 0 0 0 4px var(--color-border), inset 0 2px 4px rgba(0, 0, 0, 0.01) !important;
}

/* 2. Sleek Rounded Pill Buttons */
body button[type="submit"],
body a.bg-primary,
body button.bg-primary,
body button.bg-secondary,
body a.bg-secondary,
body .btn-pill,
body .btn-rounded {
  border-radius: 9999px !important; /* Pill shape - Soft & friendly */
  padding-left: 1.5rem !important;
  padding-right: 1.5rem !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em !important;
}

body button[type="submit"]:hover,
body a.bg-primary:hover,
body button.bg-primary:hover,
body button.bg-secondary:hover {
  transform: translateY(-1.5px) !important;
  filter: brightness(1.06) !important;
  box-shadow: 0 6px 15px -3px rgba(30, 46, 138, 0.15) !important;
}

body button[type="submit"]:active,
body a.bg-primary:active,
body button.bg-primary:active,
body button.bg-secondary:active {
  transform: translateY(0) !important;
  scale: 0.97 !important;
}

/* 3. Cards Soft Elevations and Borders */
.card-shadow, .premium-card {
  box-shadow: 0 10px 30px -10px rgba(30, 46, 138, 0.04), 0 1px 3px rgba(30, 46, 138, 0.01) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: 1.5rem !important; /* 24px - Rounded borders */
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  background-color: var(--color-card) !important;
}

.card-shadow:hover, .premium-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 40px -15px rgba(30, 46, 138, 0.08), 0 2px 6px rgba(30, 46, 138, 0.02) !important;
}

html.dark .card-shadow, html.dark .premium-card {
  box-shadow: none !important;
}

/* Premium Modal Style (Soft overlays, blur, rounded 28px) */
.premium-modal {
  border-radius: 1.75rem !important; /* 28px */
  border: 1px solid var(--color-border) !important;
  box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.08) !important;
  background-color: var(--color-card) !important;
  backdrop-filter: blur(8px) !important;
}

html.dark .premium-modal {
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.5) !important;
}


/* 4. Beautiful Rounded Tables */
.table-mobile-scroll,
.overflow-x-auto,
.table-container {
  border-radius: 1.25rem !important; /* 20px - Rounded edges */
  overflow: hidden !important;
  border: 1px solid var(--color-border) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.015) !important;
}

body table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: 100% !important;
}

body th {
  background-color: var(--color-table-header) !important;
  color: var(--color-muted) !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  font-size: 0.75rem !important;
  border-bottom: 1px solid var(--color-border) !important;
  padding: 1rem 1.25rem !important;
}

body td {
  padding: 1rem 1.25rem !important;
  border-bottom: 1px solid var(--color-border) !important;
  font-size: 0.875rem !important;
  color: var(--color-fg) !important;
}

body tr:last-child td {
  border-bottom: none !important;
}

body tr td {
  transition: background-color 0.2s ease, box-shadow 0.2s ease !important;
}

body tr:hover td {
  background-color: var(--color-table-hover) !important;
}

body tr:hover td:first-child {
  box-shadow: inset 4px 0 0 0 var(--color-accent) !important;
}

/* 5. Sleek Pill Navigation Links */
nav a {
  border-radius: 9999px !important; /* Sleek pill shape - Modern, non-boxy */
  padding-left: 1.25rem !important;
  padding-right: 1.25rem !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
nav a:hover {
  transform: translateX(4px) !important;
}
nav a.bg-primary {
  background: linear-gradient(135deg, #1E2E8A 0%, #2b3eb5 100%) !important;
  box-shadow: 0 4px 14px rgba(30, 46, 138, 0.22) !important;
}

/* 6. Refined Toast notification */
.app-toast {
  border-radius: 1.25rem !important;
  padding: 1rem 1.5rem !important;
  box-shadow: 0 20px 30px -5px rgba(0, 0, 0, 0.08), 0 10px 15px -5px rgba(0, 0, 0, 0.03) !important;
  backdrop-filter: blur(8px) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* 7. Icon Weight Reduction (Outlined - Softer, less blocky) */
body .material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24 !important; /* Thinner weight for elegance */
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
body .material-symbols-outlined.icon-filled,
body .icon-filled .material-symbols-outlined,
body [class*="icon-filled"] .material-symbols-outlined,
body button.bg-secondary .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24 !important;
}

/* Fix Tailwind CSS max-width overrides caused by custom spacing configuration */
.max-w-xs {
  max-width: 20rem !important;
}
.max-w-sm {
  max-width: 24rem !important;
}
.max-w-md {
  max-width: 28rem !important;
}
.max-w-lg {
  max-width: 32rem !important;
}
.max-w-xl {
  max-width: 36rem !important;
}

/* Prevent preset buttons from shifting size, padding, or shape when active */
.btn-preset {
  border-radius: 0.75rem !important; /* Keep rounded-xl */
  padding: 0.375rem 0.5rem !important; /* Preserve py-1.5 px-2 */
  font-size: 11px !important;
  font-weight: 600 !important;
  transform: none !important;
  box-shadow: none !important;
}
.btn-preset:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* --- Horarios Docentes Grid Semanal --- */
.horarios-visual-grid {
  display: grid;
  grid-template-columns: 80px repeat(6, 1fr);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  background-color: var(--color-card);
  overflow: hidden;
}

.horarios-grid-header {
  display: contents;
}

.horarios-header-cell {
  background-color: var(--color-table-header);
  color: var(--color-accent);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  padding: 12px 6px;
  border-bottom: 2px solid var(--color-border);
  border-right: 1px solid var(--color-border);
}

.horarios-header-cell:last-child {
  border-right: none;
}

.horarios-time-column-header {
  background-color: var(--color-table-header);
  border-bottom: 2px solid var(--color-border);
  border-right: 1px solid var(--color-border);
}

.horarios-grid-body {
  display: contents;
}

.horarios-row-time {
  grid-column: 1;
  font-size: 10px;
  font-weight: 700;
  color: var(--color-muted);
  text-align: center;
  padding: 8px 4px;
  border-right: 2px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.horarios-cell {
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  min-height: 50px;
  position: relative;
}

.horarios-cell:nth-child(7n) {
  border-right: none;
}

/* Bloques de Horarios */
.horario-block {
  border-radius: 0.75rem;
  padding: 8px 12px;
  margin: 2px;
  font-size: 11px;
  transition: all 0.2s ease;
  cursor: pointer;
  border-left: 4px solid currentColor;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.horario-block:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
  filter: brightness(0.98);
}

/* Time Picker Ruleta style */
.ruleta-picker-container {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  background-color: var(--color-table-header);
  padding: 16px;
  border-radius: 1rem;
  border: 1px solid var(--color-border);
}

.ruleta-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 60px;
}

.ruleta-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--color-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.ruleta-scroll {
  height: 120px;
  overflow-y: scroll;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none;  /* IE/Edge */
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  background-color: var(--color-card);
  width: 100%;
  text-align: center;
  snap-type: y mandatory;
}

.ruleta-scroll::-webkit-scrollbar {
  display: none; /* Safari/Chrome */
}

.ruleta-item {
  height: 40px;
  line-height: 40px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-muted);
  cursor: pointer;
  snap-align: center;
  transition: all 0.1s ease;
}

.ruleta-item.selected {
  color: var(--color-accent);
  font-size: 20px;
  font-weight: 700;
  background-color: var(--color-table-hover);
}



