/* ═══════════════════════════════════════════════════════════════════
   VALIDADOC — Premium Glassmorphism Styles (FONDO CLARO)
   ═══════════════════════════════════════════════════════════════════
   Paleta:
     • Verde oliva: #5B7B4A / #3D5A30 / #7A9E66
     • Dorado:      #C9A96E
     • Texto:       #2C2F2C / #5A5F5A / #7A7F7A
     • Fondo card:  rgba(255,255,255,0.85)
   ═══════════════════════════════════════════════════════════════ */

/* ── Card principal ───────────────────────────────────────────── */
.fojas-card {
  position: relative;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(91, 123, 74, 0.18);
  border-radius: 18px;
  padding: 2.5rem 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  font-family: Georgia, 'Times New Roman', serif;
  color: #2C2F2C;
}

.fojas-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(91, 123, 74, 0.04) 0%, transparent 50%, rgba(201, 169, 110, 0.03) 100%);
  pointer-events: none;
  border-radius: inherit;
}

/* ── Header ───────────────────────────────────────────────────── */
.fojas-header {
  text-align: center;
  margin-bottom: 1.8rem;
}

.fojas-seal {
  width: 56px; height: 56px;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, #5B7B4A, #3D5A30);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(91, 123, 74, 0.25);
}

.fojas-seal svg { width: 28px; height: 28px; }

.fojas-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: #2C2F2C;
  line-height: 1.25;
  margin: 0 0 0.4rem;
}

.fojas-subtitle {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.9rem;
  font-weight: 400;
  color: #5A5F5A;
  line-height: 1.5;
  margin: 0 auto;
  max-width: 540px;
}

/* ── Divisor ──────────────────────────────────────────────────── */
.fojas-divider {
  width: 50px; height: 2.5px;
  background: linear-gradient(90deg, transparent, #C9A96E, transparent);
  margin: 0 auto 1.5rem;
  border-radius: 2px;
}

/* ── Barra de progreso ────────────────────────────────────────── */
.fojas-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  overflow: hidden;
  z-index: 5;
  border-radius: 18px 18px 0 0;
}

.fojas-progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, transparent, #5B7B4A, #7A9E66, #5B7B4A, transparent);
  transition: none;
}

.fojas-progress--active .fojas-progress-bar {
  width: 100%;
  animation: vdProgress 1.5s ease-in-out infinite;
}

@keyframes vdProgress {
  0%   { width: 0; margin-left: 0; }
  50%  { width: 65%; margin-left: 17%; }
  100% { width: 0; margin-left: 100%; }
}

/* ── Formulario ───────────────────────────────────────────────── */
.fojas-form {
  position: relative;
  margin-bottom: 1rem;
}

.fojas-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: stretch;
}

.fojas-input-group {
  flex: 1 1 100%;
  position: relative;
}

@media (min-width: 600px) {
  .fojas-input-group { flex: 1 1 auto; }
  .fojas-input-group--field { flex: 1 1 55%; }
  .fojas-input-group--button { flex: 0 0 auto; }
}

.fojas-label {
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: #3D5A30;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}

.fojas-input {
  width: 100%;
  padding: 0.82rem 1rem;
  background: #FFFFFF;
  border: 1.5px solid #D4D8D0;
  border-radius: 10px;
  color: #2C2F2C;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.92rem;
  font-weight: 400;
  outline: none;
  transition: border 0.25s, box-shadow 0.25s;
  box-sizing: border-box;
}

.fojas-input::placeholder {
  color: #9A9F9A;
}

.fojas-input:focus {
  border-color: #5B7B4A;
  box-shadow: 0 0 0 3px rgba(91, 123, 74, 0.12);
}

.fojas-input--error {
  border-color: #C0392B !important;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1) !important;
}

.fojas-input--success {
  border-color: #27AE60 !important;
  box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1) !important;
}

.fojas-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235A5F5A' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  background-color: #fff;
}

.fojas-select option {
  background: #fff;
  color: #2C2F2C;
}

/* ── Botón ────────────────────────────────────────────────────── */
.fojas-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.82rem 1.8rem;
  background: linear-gradient(135deg, #5B7B4A 0%, #3D5A30 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.25s, box-shadow 0.25s;
  box-shadow: 0 4px 14px rgba(91, 123, 74, 0.3);
  min-height: 46px;
  width: 100%;
  letter-spacing: 0.02em;
}

@media (min-width: 600px) {
  .fojas-btn { width: auto; }
}

.fojas-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(91, 123, 74, 0.35);
  background: linear-gradient(135deg, #6B8B5A 0%, #4D6A40 100%);
}

.fojas-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.fojas-btn--loading {
  pointer-events: none;
}

/* ── Spinner ──────────────────────────────────────────────────── */
.fojas-spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fojasSpin 0.7s linear infinite;
}

.fojas-btn--loading .fojas-spinner {
  display: inline-block;
}

.fojas-btn--loading .fojas-btn-text {
  display: none;
}

/* ── Resultado ────────────────────────────────────────────────── */
.fojas-result {
  margin-top: 1.25rem;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s ease;
}

.fojas-result--visible {
  opacity: 1;
  transform: translateY(0);
}

.fojas-result-card {
  background: #FFFFFF;
  border: 1px solid #E8EBE4;
  border-radius: 10px;
  padding: 1.2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.fojas-result-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid #EDEFE9;
}

.fojas-result-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.fojas-result-icon--success {
  background: rgba(39, 174, 96, 0.12);
  color: #27AE60;
}

.fojas-result-icon--error {
  background: rgba(192, 57, 43, 0.12);
  color: #C0392B;
}

.fojas-result-icon--warning {
  background: rgba(241, 196, 15, 0.12);
  color: #F1C40F;
}

.fojas-result-title {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
}

.fojas-result-title--success { color: #27AE60; }
.fojas-result-title--error   { color: #C0392B; }
.fojas-result-title--warning { color: #E67E22; }

.fojas-result-body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #4A4F4A;
}

.fojas-result-body .text_negative {
  color: #C0392B;
  font-weight: 600;
}

.fojas-result-body .text_positive {
  color: #27AE60;
  font-weight: 600;
}

.fojas-error-box {
  background: rgba(192, 57, 43, 0.06);
  border: 1px solid rgba(192, 57, 43, 0.15);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  margin-top: 0.75rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.85rem;
  color: #C0392B;
  line-height: 1.5;
}

/* ── Animaciones ──────────────────────────────────────────────── */
@keyframes fojasFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fojasSpin {
  to { transform: rotate(360deg); }
}

@keyframes fojasPulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(91, 123, 74, 0.25); }
  50%      { box-shadow: 0 4px 24px rgba(91, 123, 74, 0.4); }
}

@keyframes fojasShake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-4px); }
  40%      { transform: translateX(4px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(3px); }
}

.fojas-shake {
  animation: fojasShake 0.4s ease-out;
}

/* ── Contenedor principal ─────────────────────────────────────── */
#fojas-app,
.vd-mount {
  display: none;
  width: 100%;
  max-width: 820px;
  margin: 2rem auto;
  padding: 0;
}

#fojas-app.ready,
.vd-mount.ready {
  display: block;
  animation: fojasFadeIn 0.5s ease-out;
}

/* ── Feedback ─────────────────────────────────────────────────── */
.fojas-feedback {
  font-size: 0.8rem;
  margin-top: 0.35rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #C0392B;
}

/* ── Dropdown de comunas ─────────────────────────────────────── */
.vd-comuna-wrap {
  position: relative;
}

.vd-comuna-drop {
  display: none;
  position: fixed;
  max-height: 280px;
  overflow-y: auto;
  background: #FFFFFF;
  border: 1px solid #D4D8D0;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  z-index: 99999;
}

.vd-c-item {
  padding: 0.6rem 1rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.85rem;
  color: #2C2F2C;
  cursor: pointer;
  border-bottom: 1px solid #F0F2EE;
  transition: background 0.12s;
}

.vd-c-item:last-child {
  border-bottom: none;
}

.vd-c-item:hover {
  background: rgba(91, 123, 74, 0.08);
}

.vd-c-item-a {
  background: rgba(91, 123, 74, 0.12);
  color: #3D5A30;
  font-weight: 500;
}

.vd-c-item-more {
  color: #9A9F9A;
  font-size: 0.78rem;
  font-style: italic;
  cursor: default;
}

.vd-c-item-more:hover {
  background: transparent;
}

/* ── Buscador de comunas con dropdown ────────────────────────── */
.vd-comuna-wrapper {
  position: relative;
}

.vd-comuna-dropdown {
  display: none;
  position: fixed;
  max-height: 260px;
  width: auto;
  min-width: 300px;
  overflow-y: auto;
  background: #FFFFFF;
  border: 1px solid #D4D8D0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 999999;
}

.vd-comuna-item {
  padding: 0.65rem 1rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.88rem;
  color: #2C2F2C;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid #F0F2EE;
}

.vd-comuna-item:last-child {
  border-bottom: none;
}

.vd-comuna-item:hover,
.vd-comuna-item--active {
  background: rgba(91, 123, 74, 0.1);
  color: #3D5A30;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  .fojas-card {
    padding: 1.5rem 1rem;
    border-radius: 14px;
  }

  .fojas-title {
    font-size: 1.25rem;
  }

  .fojas-subtitle {
    font-size: 0.82rem;
  }

  .fojas-btn {
    font-size: 0.84rem;
    padding: 0.75rem 1.2rem;
  }

  .fojas-input {
    padding: 0.75rem 0.9rem;
    font-size: 0.88rem;
  }
}

@media (max-width: 400px) {
  .fojas-card {
    padding: 1.2rem 0.8rem;
  }

  .fojas-title {
    font-size: 1.1rem;
  }
}

/* ── Accesibilidad ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Print ────────────────────────────────────────────────────── */
@media print {
  .fojas-card {
    box-shadow: none;
    backdrop-filter: none;
    border: 1px solid #ccc;
    background: #fff;
  }

  .fojas-title,
  .fojas-result-body {
    color: #333 !important;
  }
}
