/* amsler.css — migrado 1:1 del demo _tmp-demo-tools/amsler.html */

/* =====================================================
       Amsler: Estilos específicos
       ===================================================== */

    /* Fade-in animations */
    .fade-in { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
    .fade-in.visible { opacity: 1; transform: translateY(0); }

    /* ---- Hero compacto ---- */
    .amsler-hero {
      background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #0D7A9F 100%);
      padding: calc(var(--nav-h) + 2.5rem) 0 3rem;
      text-align: center;
      position: relative;
      overflow: hidden;
    }
    .amsler-hero::before {
      content: '';
      position: absolute;
      inset: 0;
      background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    }
    .amsler-hero__content { position: relative; z-index: 1; }
    .amsler-hero h1 { color: var(--white); font-size: clamp(1.8rem, 5vw, 2.8rem); margin-bottom: .75rem; }
    .amsler-hero p { color: rgba(255,255,255,.85); font-size: 1.05rem; max-width: 540px; margin: 0 auto 1.5rem; }
    .amsler-hero__badge {
      display: inline-flex;
      align-items: center;
      gap: .5rem;
      background: rgba(255,255,255,.15);
      border: 1px solid rgba(255,255,255,.25);
      color: var(--white);
      font-size: .8rem;
      font-weight: 500;
      padding: .4rem 1rem;
      border-radius: 99px;
    }
    .amsler-hero__badge svg { width: 14px; height: 14px; }

    /* ---- Historial previo ---- */
    .history-notice {
      background: var(--off-white);
      border: 1px solid var(--border);
      border-left: 4px solid var(--accent);
      border-radius: var(--radius);
      padding: 1rem 1.25rem;
      margin-bottom: 2rem;
      display: flex;
      align-items: flex-start;
      gap: 1rem;
    }
    .history-notice__icon { flex-shrink: 0; color: var(--accent); }
    .history-notice__icon svg { width: 22px; height: 22px; }
    .history-notice h4 { font-size: .95rem; color: var(--heading); margin-bottom: .2rem; }
    .history-notice p { font-size: .85rem; color: var(--text-light); margin: 0; }
    .history-notice__actions { margin-top: .75rem; display: flex; gap: .75rem; flex-wrap: wrap; }
    .history-notice__actions button {
      background: none;
      border: none;
      font-family: inherit;
      font-size: .8rem;
      font-weight: 600;
      cursor: pointer;
      padding: 0;
      transition: var(--transition);
    }
    .btn-link-accent { color: var(--accent); }
    .btn-link-accent:hover { color: var(--primary); }
    .btn-link-muted { color: var(--text-light); }
    .btn-link-muted:hover { color: var(--text); }

    /* ---- Sección intro ---- */
    .intro-grid {
      display: grid;
      gap: 3rem;
      align-items: center;
    }
    @media (min-width: 768px) { .intro-grid { grid-template-columns: 1fr 1fr; } }

    .amsler-illustration {
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .amsler-illustration svg {
      width: min(280px, 100%);
      height: auto;
      filter: drop-shadow(0 8px 24px rgba(10,94,125,.15));
    }

    /* ---- Disclaimer box ---- */
    .disclaimer-box {
      background: #FFF8E7;
      border: 1px solid #F5C842;
      border-radius: var(--radius);
      padding: 1.25rem 1.5rem;
      display: flex;
      gap: 1rem;
      align-items: flex-start;
      margin-top: 2rem;
    }
    .disclaimer-box svg { flex-shrink: 0; color: #D97706; margin-top: 2px; }
    .disclaimer-box p { font-size: .875rem; color: #92400E; margin: 0; line-height: 1.6; }
    .disclaimer-box strong { color: #78350F; }

    /* ---- Instrucciones ---- */
    .steps-list { list-style: none; display: flex; flex-direction: column; gap: 1.25rem; margin-top: 2rem; }
    .step-item {
      display: flex;
      gap: 1.25rem;
      align-items: flex-start;
    }
    .step-num {
      flex-shrink: 0;
      width: 40px;
      height: 40px;
      background: var(--primary);
      color: var(--white);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: .9rem;
    }
    .step-body h4 { font-size: .95rem; color: var(--heading); margin-bottom: .2rem; }
    .step-body p { font-size: .85rem; color: var(--text-light); margin: 0; }

    .start-btn-wrap { text-align: center; margin-top: 3rem; }

    /* ---- App: pantallas ---- */
    #amsler-app {
      display: none;
      position: fixed;
      inset: 0;
      background: white;
      z-index: 2000;
      overflow-y: auto;
    }
    #amsler-app.open { display: flex; flex-direction: column; }

    .app-screen { display: none; flex-direction: column; flex: 1; }
    .app-screen.active { display: flex; }

    /* App header */
    .app-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 1rem 1.25rem;
      border-bottom: 1px solid var(--border);
      background: var(--white);
      position: sticky;
      top: 0;
      z-index: 10;
    }
    .app-header h3 { font-size: 1rem; color: var(--heading); margin: 0; }
    .app-close {
      background: none;
      border: none;
      cursor: pointer;
      color: var(--text-light);
      padding: 6px;
      display: flex;
    }
    .app-close:hover { color: var(--heading); }
    .app-close svg { width: 22px; height: 22px; }

    /* Progress indicator */
    .progress-bar {
      height: 4px;
      background: var(--border);
      position: relative;
    }
    .progress-bar__fill {
      height: 100%;
      background: var(--accent);
      transition: width .4s ease;
    }
    .progress-label {
      text-align: center;
      font-size: .8rem;
      color: var(--text-light);
      padding: .5rem 0;
      border-bottom: 1px solid var(--border);
    }

    /* Test container */
    .test-container {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 1.5rem 1.25rem;
      gap: 1.25rem;
    }

    .test-instruction {
      background: var(--off-white);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1rem 1.25rem;
      text-align: center;
      max-width: 400px;
      width: 100%;
    }
    .test-instruction p { margin: 0; font-size: .9rem; color: var(--text); }
    .test-instruction strong { color: var(--primary); }

    /* Amsler grid wrapper */
    .amsler-grid-wrap {
      position: relative;
      border: 2px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
      box-shadow: var(--shadow-md);
      touch-action: none;
      background: white;
      cursor: crosshair;
    }

    #amsler-svg-right, #amsler-svg-left {
      display: block;
      width: 100%;
      max-width: 320px;
      height: auto;
    }

    .touch-hint {
      font-size: .78rem;
      color: var(--text-light);
      text-align: center;
    }

    /* Test action buttons */
    .test-actions {
      display: flex;
      flex-direction: column;
      gap: .75rem;
      width: 100%;
      max-width: 360px;
    }
    .test-actions .btn { justify-content: center; width: 100%; }
    .btn--success {
      background: #059669;
      color: white;
    }
    .btn--success:hover { background: #047857; color: white; transform: translateY(-2px); }
    .btn--warning {
      background: #D97706;
      color: white;
    }
    .btn--warning:hover { background: #B45309; color: white; transform: translateY(-2px); }

    /* Clear marks button */
    .clear-marks-btn {
      background: none;
      border: 1px solid var(--border);
      color: var(--text-light);
      font-family: inherit;
      font-size: .8rem;
      padding: .4rem .9rem;
      border-radius: var(--radius);
      cursor: pointer;
      transition: var(--transition);
    }
    .clear-marks-btn:hover { border-color: var(--danger); color: var(--danger); }

    /* ---- Result screen ---- */
    .result-container {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 2rem 1.25rem;
      max-width: 520px;
      margin: 0 auto;
      width: 100%;
    }

    .result-icon {
      width: 80px;
      height: 80px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 1.5rem;
    }
    .result-icon--ok { background: #D1FAE5; }
    .result-icon--ok svg { color: #059669; width: 40px; height: 40px; }
    .result-icon--alert { background: #FEF3C7; }
    .result-icon--alert svg { color: #D97706; width: 40px; height: 40px; }

    .result-title { font-size: 1.5rem; color: var(--heading); text-align: center; margin-bottom: .5rem; }
    .result-subtitle { text-align: center; color: var(--text-light); font-size: .95rem; margin-bottom: 2rem; }

    /* Mini amsler previews en resultado */
    .result-eyes-preview {
      display: flex;
      gap: 1.5rem;
      justify-content: center;
      margin-bottom: 2rem;
    }
    .result-eye-wrap { text-align: center; }
    .result-eye-wrap p { font-size: .78rem; color: var(--text-light); margin-top: .5rem; font-weight: 500; }
    .result-eye-svg {
      width: 100px;
      height: 100px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
    }

    .result-card {
      background: var(--off-white);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 1.5rem;
      width: 100%;
      margin-bottom: 1.5rem;
    }
    .result-card p { font-size: .9rem; color: var(--text); margin: 0; line-height: 1.7; }
    .result-card--ok { border-left: 4px solid #059669; }
    .result-card--alert { border-left: 4px solid #D97706; }

    .result-actions {
      display: flex;
      flex-direction: column;
      gap: .75rem;
      width: 100%;
    }
    .result-actions .btn { justify-content: center; }

    .result-secondary-actions {
      display: flex;
      gap: 1rem;
      justify-content: center;
      margin-top: 1rem;
      flex-wrap: wrap;
    }
    .result-secondary-actions button {
      background: none;
      border: none;
      font-family: inherit;
      font-size: .85rem;
      font-weight: 500;
      cursor: pointer;
      color: var(--accent);
      transition: var(--transition);
      display: flex;
      align-items: center;
      gap: .35rem;
    }
    .result-secondary-actions button:hover { color: var(--primary); }
    .result-secondary-actions button svg { width: 16px; height: 16px; }

    /* ---- Historial modal ---- */
    .modal-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(10,37,64,.6);
      z-index: 3000;
      align-items: flex-end;
      justify-content: center;
      padding: 1rem;
    }
    .modal-overlay.open { display: flex; }
    @media (min-width: 500px) { .modal-overlay { align-items: center; } }

    .modal-card {
      background: var(--white);
      border-radius: var(--radius-xl) var(--radius-xl) 0 0;
      padding: 1.5rem;
      width: 100%;
      max-width: 480px;
      max-height: 80vh;
      overflow-y: auto;
      animation: slideUp .3s ease;
    }
    @media (min-width: 500px) {
      .modal-card { border-radius: var(--radius-xl); }
    }
    @keyframes slideUp {
      from { transform: translateY(40px); opacity: 0; }
      to { transform: translateY(0); opacity: 1; }
    }
    .modal-card h3 { font-size: 1.1rem; margin-bottom: 1.25rem; color: var(--heading); }

    .history-list { list-style: none; display: flex; flex-direction: column; gap: .75rem; }
    .history-item {
      display: flex;
      align-items: center;
      gap: 1rem;
      padding: .75rem 1rem;
      border: 1px solid var(--border);
      border-radius: var(--radius);
    }
    .history-dot {
      width: 12px;
      height: 12px;
      border-radius: 50%;
      flex-shrink: 0;
    }
    .history-dot--ok { background: #059669; }
    .history-dot--alert { background: #D97706; }
    .history-item__info { flex: 1; }
    .history-item__date { font-size: .82rem; color: var(--text-light); }
    .history-item__result { font-size: .88rem; font-weight: 500; color: var(--heading); }

    .modal-close-btn {
      width: 100%;
      margin-top: 1rem;
    }

    /* ---- Sección info adicional (debajo del test) ---- */
    .info-cards {
      display: grid;
      gap: 1.5rem;
      margin-top: 3rem;
    }
    @media (min-width: 768px) { .info-cards { grid-template-columns: repeat(3, 1fr); } }

    .info-card {
      background: var(--white);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 1.75rem;
      text-align: center;
      transition: var(--transition);
    }
    .info-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
    .info-card__icon {
      width: 52px;
      height: 52px;
      border-radius: var(--radius);
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto 1rem;
    }
    .info-card__icon svg { width: 26px; height: 26px; }
    .info-card h4 { font-size: 1rem; margin-bottom: .5rem; }
    .info-card p { font-size: .875rem; color: var(--text-light); margin: 0; }

    /* ---- Reminder banner ---- */
    .reminder-banner {
      display: none;
      background: linear-gradient(135deg, var(--primary) 0%, #0D7A9F 100%);
      border-radius: var(--radius-lg);
      padding: 1.5rem 2rem;
      color: var(--white);
      align-items: center;
      gap: 1.5rem;
      margin-top: 2rem;
    }
    .reminder-banner.show { display: flex; }
    .reminder-banner__text h4 { color: var(--white); margin-bottom: .25rem; }
    .reminder-banner__text p { margin: 0; color: rgba(255,255,255,.8); font-size: .9rem; }
    .reminder-banner__icon { flex-shrink: 0; }
    .reminder-banner__icon svg { width: 40px; height: 40px; color: rgba(255,255,255,.7); }

    /* Utility */
    .mt-1 { margin-top: .5rem; }
    .mt-2 { margin-top: 1rem; }
    .mt-3 { margin-top: 1.5rem; }
    .visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }