/* =========================================================
   TU VISA online — tuvisa-premium.css
   Estilo Premium de Alta Fidelidad (Apple/Antigravity style)
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* --- DESIGN SYSTEM CONSTANTS --- */
:root {
  --font-primary: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', system-ui, -apple-system, sans-serif;

  /* Color Palette - Light Mode */
  --bg-main: #f5f5f7;
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-card-hover: rgba(255, 255, 255, 0.9);
  --border-color: rgba(0, 0, 0, 0.06);
  --border-focus: rgba(0, 36, 97, 0.4);
  
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --text-tertiary: #b5b5be;
  
  --apple-blue: #0071e3;
  --apple-blue-hover: #0077ed;
  --apple-red: #d31224;
  --apple-red-hover: #e51e30;
  
  --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.02);
  --premium-shadow: 0 20px 40px rgba(0, 36, 97, 0.04);
  --glow-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);

  /* Scrollbars properties */
  --scrollbar-thumb: rgba(0, 0, 0, 0.15);
  --scrollbar-track: rgba(0, 0, 0, 0.02);
}

/* Color Palette - Dark Mode */
html.dark {
  --bg-main: #111827;
  --bg-card: rgba(30, 41, 59, 0.74);
  --bg-card-hover: rgba(51, 65, 85, 0.88);
  --border-color: rgba(148, 163, 184, 0.28);
  --border-focus: rgba(147, 197, 253, 0.5);
  
  --text-primary: #f1f5f9;
  --text-secondary: #dbe7f5;
  --text-tertiary: #9fb2c9;
  
  --apple-blue: #60a5fa;
  --apple-blue-hover: #3ca0ff;
  --apple-red: #f87171;
  --apple-red-hover: #fb7185;
  
  --glass-shadow: 0 8px 28px rgba(2, 6, 23, 0.35);
  --premium-shadow: 0 24px 50px rgba(2, 6, 23, 0.42);
  --glow-shadow: 0 0 0 4px rgba(96, 165, 250, 0.22);
  
  --scrollbar-thumb: rgba(255, 255, 255, 0.2);
  --scrollbar-track: rgba(255, 255, 255, 0.02);
}

/* --- BASE STYLES & TYPOGRAPHY --- */
body {
  font-family: var(--font-primary);
  background-color: var(--bg-main) !important;
  color: var(--text-primary) !important;
  letter-spacing: -0.015em;
  transition: background-color 0.5s cubic-bezier(0.16, 1, 0.3, 1), color 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  letter-spacing: -0.025em;
  font-weight: 800;
}

/* Custom Scrollbar - Standardized */
.scroller, body {
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  scrollbar-width: thin;
}

/* Scrollbar - Webkit legacy fallback */
@supports not (scrollbar-color: auto) {
  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  ::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 999px;
  }
  ::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
  }
}

/* --- GLASSMORPHISM & CONTAINER DESIGN --- */
.premium-glass {
  background: var(--bg-card) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--glass-shadow) !important;
}

/* Cards optimization */
.card, .person-card, .service-card, .case-card {
  background: var(--bg-card) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 20px !important;
  box-shadow: var(--premium-shadow) !important;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
              background-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.card:hover, .person-card:hover, .service-card:hover {
  transform: translateY(-2px) scale(1.002);
  background: var(--bg-card-hover) !important;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.06);
  border-color: var(--border-focus) !important;
}

html.dark .card:hover, html.dark .person-card:hover {
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

/* --- FORM ELEMENTS (APPLE STYLE: SMALL & COMPACT) --- */
.inp, .field-input, input[type="text"], input[type="email"], input[type="date"], select, textarea {
  font-family: var(--font-primary);
  font-size: 13px !important; /* Elegant detailed typography */
  font-weight: 500 !important;
  letter-spacing: -0.01em;
  color: var(--text-primary) !important;
  background-color: rgba(255, 255, 255, 0.4) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 10px !important;
  padding: 10px 12px !important;
  outline: none !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

html.dark .inp, html.dark .field-input, html.dark input[type="text"], html.dark select, html.dark textarea {
  background-color: rgba(30, 41, 59, 0.7) !important;
}

.inp:focus, .field-input:focus, input[type="text"]:focus, select:focus, textarea:focus {
  background-color: rgba(255, 255, 255, 0.95) !important;
  border-color: var(--apple-blue) !important;
  box-shadow: var(--glow-shadow) !important;
}

html.dark .inp:focus, html.dark .field-input:focus, html.dark input[type="text"]:focus, html.dark select:focus {
  background-color: rgba(51, 65, 85, 0.82) !important;
}

.inp-label, .field-label {
  font-family: var(--font-display) !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  color: var(--text-secondary) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  margin-bottom: 5px !important;
}

/* Yes/No inputs */
.yesno-label {
  background: rgba(255, 255, 255, 0.3) !important;
  border: 1.5px solid var(--border-color) !important;
  border-radius: 12px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 10px 14px !important;
  transition: all 0.2s ease !important;
  color: var(--text-primary) !important;
}

html.dark .yesno-label {
  background: rgba(0, 0, 0, 0.2) !important;
}

.yesno-label:has(input:checked) {
  background-color: rgba(0, 113, 227, 0.08) !important;
  border-color: var(--apple-blue) !important;
  color: var(--apple-blue) !important;
}

html.dark .yesno-label:has(input:checked) {
  background-color: rgba(41, 151, 255, 0.12) !important;
}

/* --- BUTTONS & ACTIONS --- */
.btn-primary, .btn-login, .btn-fill, button[type="submit"].btn-primary {
  font-family: var(--font-display) !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
  color: #ffffff !important;
  background: linear-gradient(145deg, var(--apple-red) 0%, #a30d1b 100%) !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 11px 20px !important;
  box-shadow: 0 2px 8px rgba(211, 18, 36, 0.22), inset 0 1px 0 rgba(255,255,255,0.12) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  white-space: nowrap !important;
}

.btn-primary:hover, .btn-login:hover, .btn-fill:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(211, 18, 36, 0.35), inset 0 1px 0 rgba(255,255,255,0.12) !important;
  filter: brightness(1.06);
}

.btn-primary:active, .btn-login:active, .btn-fill:active {
  transform: translateY(0);
  filter: brightness(0.96);
}

/* Secondary / Outline Button */
.btn-sec, .btn-secondary {
  font-family: var(--font-display) !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
  color: var(--text-primary) !important;
  background: rgba(255, 255, 255, 0.55) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px !important;
  padding: 11px 20px !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
}

html.dark .btn-sec, html.dark .btn-secondary {
  background: rgba(255, 255, 255, 0.07) !important;
}

.btn-sec:hover, .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.85) !important;
  border-color: rgba(0, 36, 97, 0.2) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.06) !important;
}

html.dark .btn-sec:hover, html.dark .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12) !important;
}

/* Mobile dark-mode readability boost */
@media (max-width: 768px) {
  html.dark,
  html.dark body,
  html.dark p,
  html.dark span,
  html.dark label,
  html.dark li,
  html.dark td,
  html.dark th,
  html.dark small,
  html.dark .text-gray-400,
  html.dark .text-gray-500,
  html.dark .text-gray-600,
  html.dark .text-slate-400,
  html.dark .text-slate-500,
  html.dark .text-slate-600,
  html.dark .hint,
  html.dark .modal-desc,
  html.dark .viewer-file-meta {
    color: #e8f0ff !important;
  }
}

/* Dark mode tables readability */
html.dark table,
html.dark thead,
html.dark tbody,
html.dark tr,
html.dark th,
html.dark td {
  color: #eef4ff !important;
}

html.dark thead th {
  background: rgba(51, 65, 85, 0.72) !important;
  border-color: rgba(148, 163, 184, 0.32) !important;
}

html.dark tbody td {
  background: rgba(30, 41, 59, 0.58) !important;
  border-color: rgba(148, 163, 184, 0.22) !important;
}

/* Delete / Danger ghost button */
.btn-del {
  font-family: var(--font-display) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  color: #dc2626 !important;
  background: rgba(220, 38, 38, 0.06) !important;
  border: 1px solid rgba(220, 38, 38, 0.15) !important;
  border-radius: 10px !important;
  padding: 8px 12px !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}

.btn-del:hover {
  background: #dc2626 !important;
  color: #fff !important;
  border-color: #dc2626 !important;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3) !important;
  transform: translateY(-1px) !important;
}

html.dark .btn-del {
  color: #f87171 !important;
  background: rgba(248, 113, 113, 0.08) !important;
  border-color: rgba(248, 113, 113, 0.2) !important;
}

/* --- STEPPERS AND WIDGETS --- */
.step-pill {
  border-radius: 20px !important;
  border: 1px solid var(--border-color) !important;
  background: var(--bg-card) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  color: var(--text-secondary) !important;
  padding: 8px 14px !important;
  transition: all 0.3s ease !important;
}

.step-pill:hover, .step-pill.active {
  border-color: var(--apple-blue) !important;
  color: var(--apple-blue) !important;
  background: rgba(0, 113, 227, 0.05) !important;
}

.step-pill.saved {
  border-color: #22c55e !important;
  color: #16a34a !important;
  background: rgba(34, 197, 94, 0.08) !important;
}

/* Mini LED badges */
.step-dot {
  width: 6px !important;
  height: 6px !important;
  border-radius: 50% !important;
}

/* File Upload dragzone */
.drop-zone {
  border: 1.5px dashed var(--border-color) !important;
  background: rgba(255, 255, 255, 0.2) !important;
  border-radius: 16px !important;
  transition: all 0.3s ease !important;
}

html.dark .drop-zone {
  background: rgba(0, 0, 0, 0.1) !important;
}

.drop-zone:hover {
  border-color: var(--apple-blue) !important;
  background: rgba(0, 113, 227, 0.04) !important;
}

/* --- HEADER FLOATING --- */
.header-scrolled, .form-header {
  background: rgba(255, 255, 255, 0.8) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border-bottom: 1px solid var(--border-color) !important;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03) !important;
}

html.dark .header-scrolled, html.dark .form-header {
  background: rgba(0, 0, 0, 0.8) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* --- SYSTEM METRICS (DASHBOARD WIDGETS) --- */
.metric-card {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 16px !important;
  padding: 16px 20px !important;
  box-shadow: var(--glass-shadow) !important;
}

.progress-track {
  height: 5px !important;
  background: rgba(0, 0, 0, 0.05) !important;
  border-radius: 999px !important;
}

html.dark .progress-track {
  background: rgba(255, 255, 255, 0.1) !important;
}

.progress-fill {
  background: linear-gradient(90deg, #002461, var(--apple-red)) !important;
}

/* --- ANIMATIONS & INTERACTIONS --- */
.avatar {
  width: 42px !important;
  height: 42px !important;
  border-radius: 12px !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  font-family: var(--font-display) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  letter-spacing: -0.02em !important;
}

.avatar.male {
  background: linear-gradient(135deg, #e0f0ff, #bfd8ff) !important;
  color: #0052a8 !important;
}

.avatar.female {
  background: linear-gradient(135deg, #fde8f3, #fbc8e4) !important;
  color: #9c1d5d !important;
}

/* Person header */
.person-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.2s ease;
  border-radius: 20px 20px 0 0;
}

.person-header:hover {
  background: rgba(0,0,0,0.02);
}

html.dark .person-header:hover {
  background: rgba(255,255,255,0.03);
}

/* Chevron toggle */
.chevron {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  font-size: 12px !important;
}

.chevron.open {
  transform: rotate(180deg);
}

@keyframes pulse-led {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-led {
  animation: pulse-led 2s infinite ease-in-out;
}

/* ---- Nova Gestión pill button ---- */
.btn-person-add {
  font-family: var(--font-display) !important;
  font-size: 10.5px !important;
  font-weight: 800 !important;
  letter-spacing: 0.02em !important;
  text-transform: uppercase !important;
  padding: 6px 14px !important;
  border-radius: 20px !important;
  border: 1.5px solid !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
}

.btn-person-add.male {
  color: #0071e3 !important;
  border-color: rgba(0,113,227,0.3) !important;
  background: rgba(0,113,227,0.05) !important;
}

.btn-person-add.male:hover {
  background: #0071e3 !important;
  color: #fff !important;
  border-color: #0071e3 !important;
  box-shadow: 0 4px 14px rgba(0,113,227,0.25) !important;
}

.btn-person-add.female {
  color: #db2777 !important;
  border-color: rgba(219,39,119,0.3) !important;
  background: rgba(219,39,119,0.05) !important;
}

.btn-person-add.female:hover {
  background: #db2777 !important;
  color: #fff !important;
  border-color: #db2777 !important;
  box-shadow: 0 4px 14px rgba(219,39,119,0.25) !important;
}

/* Country Selector Styles */
#country-selector-container button {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
#country-selector-container button:hover i {
  transform: rotate(180deg);
}
#country-dropdown {
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}
#country-dropdown div {
  transition: all 0.1s ease;
}
#country-dropdown div:hover {
  background-color: #f1f5f9 !important;
  transform: translateX(4px);
}
#country-dropdown .bg-blue-50 {
  background-color: #eff6ff !important;
}

/* ---- Missing Dashboard Buttons ---- */
.btn-open {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 10px 20px;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  white-space: nowrap;
}
.btn-open:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.btn-action {
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.btn-action.primary {
  background: var(--apple-blue, #0071e3);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,113,227,0.15);
}
.btn-action.primary:hover {
  background: #005bb5;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,113,227,0.25);
}
.btn-action.danger {
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.15);
}
.btn-action.danger:hover {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2);
}

html.dark .btn-action.primary {
  background: #3b82f6;
  box-shadow: 0 2px 8px rgba(59,130,246,0.2);
}
html.dark .btn-action.primary:hover {
  background: #2563eb;
}
html.dark .btn-action.danger {
  background: rgba(248, 113, 113, 0.1);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.2);
}
html.dark .btn-action.danger:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}

/* --- ENHANCED PRO DARK MODE (GLOBAL OVERRIDES FOR FORMS) --- */
html.dark body {
  background: radial-gradient(circle at 50% 0%, #0f172a 0%, #020617 100%) !important;
  color: #f8fafc !important;
}

html.dark .card,
html.dark .person-card,
html.dark .service-card,
html.dark .case-card,
html.dark .modal-panel,
html.dark .nav-bar,
html.dark .branch-card,
html.dark .period-card,
html.dark .viewer-file-card,
html.dark .file-attachment-card {
  background: rgba(15, 23, 42, 0.45) !important;
  backdrop-filter: blur(32px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(32px) saturate(200%) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
  color: #f8fafc !important;
}

html.dark .mini-card,
html.dark th,
html.dark .inp[readonly],
html.dark .choices__inner,
html.dark .drop-zone,
html.dark .viewer-download-box,
html.dark .viewer-img,
html.dark .viewer-pdf,
html.dark .btn-add-file,
html.dark .btn-clear-file,
html.dark .btn-download-merged {
  background: rgba(30, 41, 59, 0.45) !important;
  backdrop-filter: blur(16px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}

html.dark .step-pill,
html.dark .btn-sec,
html.dark .yesno-label {
  background: rgba(30, 41, 59, 0.5) !important;
  backdrop-filter: blur(16px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #e2e8f0 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
}

html.dark .inp,
html.dark select,
html.dark textarea,
html.dark input[type="text"],
html.dark input[type="date"],
html.dark input[type="email"] {
  background: rgba(15, 23, 42, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #f8fafc !important;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2) !important;
}

html.dark .inp:focus,
html.dark select:focus,
html.dark textarea:focus {
  background: rgba(30, 41, 59, 0.8) !important;
  border-color: rgba(59, 130, 246, 0.5) !important;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2), inset 0 2px 4px rgba(0,0,0,0.2) !important;
}

html.dark .form-header,
html.dark .header-scrolled {
  background: rgba(2, 6, 23, 0.75) !important;
  backdrop-filter: blur(24px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(200%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5) !important;
}

html.dark .info-box {
  background: rgba(30, 58, 138, 0.12) !important;
  backdrop-filter: blur(12px) saturate(180%) !important;
  border: 1px solid rgba(59, 130, 246, 0.25) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05) !important;
}
