/* VARIABLES DE DISEÑO PROFESIONAL */
:root {
    --primary: #0046ad;
    --secondary: #00b894;
    --accent: #ff7675;
    --dark: #1e272e;
    --light: #f1f2f6;
    --white: #ffffff;
    --shadow: 0 10px 30px rgba(0,0,0,0.08);
}

/* RESET & BASE */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
    scroll-behavior: smooth;
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* SKIP LINK (Accesibilidad) */
.skip-link {
    position: absolute;
    top: -100%;
    left: 10px;
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: 0 0 8px 8px;
    z-index: 9999;
    font-weight: 700;
    text-decoration: none;
}
.skip-link:focus {
    top: 0;
}

/* SCREEN READER ONLY */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* FOCUS VISIBLE (Accesibilidad teclado) */
*:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

/* IMAGES RESPONSIVE */
img { max-width: 100%; height: auto; }

/* NAVBAR */
.navbar { background: var(--white); padding: 15px 0; position: sticky; top: 0; z-index: 1000; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.navbar .container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.6rem; font-weight: 700; color: var(--primary); text-decoration: none; }
.logo span { color: var(--secondary); }
.nav-links a { text-decoration: none; color: var(--dark); margin-left: 25px; font-weight: 600; font-size: 0.95rem; }
.nav-btn { background: var(--primary); color: white !important; padding: 10px 20px; border-radius: 8px; }

/* HAMBURGER BUTTON */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
}
.hamburger span {
    display: block;
    width: 26px;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
    transition: all 0.3s ease;
}
.hamburger.is-open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.hamburger.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.is-open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* DRAWER OVERLAY */
.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1100;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.25s ease;
}
.drawer-overlay.is-open { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* DRAWER LATERAL */
.nav-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100%;
    background: var(--white);
    z-index: 1200;
    padding: 30px 24px;
    box-shadow: -8px 0 30px rgba(0,0,0,0.15);
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 0;
}
.nav-drawer.is-open { transform: translateX(0); }
.drawer-close {
    align-self: flex-end;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #94a3b8;
    line-height: 1;
    margin-bottom: 20px;
    transition: color 0.2s;
}
.drawer-close:hover { color: var(--primary); }
.drawer-link {
    display: block;
    padding: 16px 12px;
    text-decoration: none;
    color: var(--dark);
    font-weight: 600;
    font-size: 1.05rem;
    border-bottom: 1px solid #f1f5f9;
    transition: color 0.2s, background 0.2s;
    border-radius: 8px;
    margin-bottom: 4px;
}
.drawer-link:hover { color: var(--primary); background: #f0f4ff; }
.drawer-link-cta {
    margin-top: 20px;
    background: var(--primary);
    color: white !important;
    text-align: center;
    border-radius: 12px;
    border: none;
    padding: 16px;
}
.drawer-link-cta:hover { background: #003a8c; }

/* FAB — Botón flotante Apoyar (solo móvil) */
.fab-apoyar {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 20px;
    background: linear-gradient(135deg, var(--primary), #003a8c);
    color: white;
    text-decoration: none;
    padding: 14px 20px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 6px 20px rgba(0,70,173,0.4);
    z-index: 999;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
}
.fab-apoyar:hover { transform: translateY(-3px); box-shadow: 0 10px 25px rgba(0,70,173,0.5); }

/* HERO SECTION */
.hero { background: linear-gradient(135deg, var(--primary) 0%, #002d72 100%); color: white; padding: 120px 0 150px; text-align: center; border-radius: 0 0 80px 80px; }
.hero-content { max-width: 850px; margin: 0 auto; }
.hero h1 { font-size: 3.5rem; line-height: 1.1; margin-bottom: 20px; }
.hero p { font-size: 1.3rem; opacity: 0.9; margin-bottom: 40px; }
.badge { background: var(--accent); padding: 6px 18px; border-radius: 50px; font-weight: 700; font-size: 0.8rem; letter-spacing: 1px; }
.hero-btns { display: flex; justify-content: center; gap: 20px; }
.btn-main { background: var(--secondary); color: white; padding: 18px 40px; border-radius: 12px; text-decoration: none; font-weight: 700; box-shadow: 0 10px 20px rgba(0,184,148,0.3); transition: 0.3s; }
.btn-outline { border: 2px solid white; color: white; padding: 16px 40px; border-radius: 12px; text-decoration: none; font-weight: 700; transition: 0.3s; }
.btn-main:hover { transform: translateY(-3px); box-shadow: 0 15px 25px rgba(0,184,148,0.4); }

/* AD SPACE */
.ad-container { background: #e2e8f0; height: 100px; margin: 30px auto; border-radius: 10px; display: flex; align-items: center; justify-content: center; border: 1px dashed #94a3b8; color: #64748b; font-size: 0.8rem; }

/* SEARCH BOX */
.search-box { background: var(--white); padding: 50px; border-radius: 30px; margin-top: -100px; box-shadow: var(--shadow); text-align: center; }
.search-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr auto; gap: 16px; margin-top: 30px; align-items: end; }
.input-group { text-align: left; }
.input-group label { display: block; font-weight: 700; margin-bottom: 10px; color: var(--primary); font-size: 0.9rem; }
input, select {
    width: 100%;
    padding: 16px;
    border: 2px solid #edf2f7;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    background: white;
    color: var(--dark);
    transition: border-color 0.2s;
}
input:focus, select:focus { outline: none; border-color: var(--primary); }
select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%230046ad' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px; }
.btn-search { background: var(--primary); color: white; border: none; padding: 0 50px; border-radius: 12px; cursor: pointer; font-weight: 700; height: 58px; transition: 0.3s; }

/* RESULTS AREA */
.results-area { margin-top: 40px; }
.hosp-card { background: white; padding: 30px; border-radius: 20px; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; border-left: 10px solid var(--secondary); box-shadow: 0 5px 15px rgba(0,0,0,0.03); }
.hosp-info h3 { margin-bottom: 8px; color: var(--primary); font-size: 1.5rem; }
.hosp-info p { color: #64748b; margin: 4px 0; }
.hosp-btns { display: flex; gap: 15px; }
.btn-hosp { padding: 14px 25px; border-radius: 10px; text-decoration: none; font-weight: 700; font-size: 0.9rem; }
.btn-call { background: #e6ffed; color: var(--secondary); }
.btn-map { background: #f0f4ff; color: var(--primary); }

/* PROFILE SECTION (TU PERFIL) */
.author-profile { margin: 80px auto; }
.profile-grid { background: var(--white); padding: 50px; border-radius: 40px; box-shadow: var(--shadow); display: grid; grid-template-columns: 2fr 1fr; gap: 60px; align-items: center; }
.profile-badge { background: var(--primary); color: white; padding: 6px 15px; border-radius: 6px; font-size: 0.8rem; font-weight: 700; display: inline-block; margin-bottom: 20px; }
.profile-quote { font-size: 1.4rem; font-style: italic; color: #475569; border-left: 5px solid var(--secondary); padding-left: 25px; margin: 25px 0; }
.tech-stack { display: flex; flex-wrap: wrap; gap: 12px; }
.tech-stack span { background: #f1f5f9; color: var(--primary); padding: 10px 20px; border-radius: 50px; font-weight: 700; font-size: 0.85rem; }
.profile-stats { display: flex; flex-direction: column; gap: 30px; border-left: 2px solid #f1f5f9; padding-left: 60px; }
.stat-box strong { font-size: 2.5rem; color: var(--primary); display: block; line-height: 1; }
.stat-box span { color: #94a3b8; font-weight: 600; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 1px; }
.profile-social { display: flex; gap: 15px; margin-top: 20px; }
.btn-social { padding: 10px 20px; border-radius: 8px; text-decoration: none; color: white; font-weight: 600; font-size: 0.9rem; transition: 0.3s; display: inline-flex; align-items: center; gap: 8px; }
.btn-social.fb { background: #1877f2; }
.btn-social.li { background: #0a66c2; }
.btn-social:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }

/* INFO SECTION */
.info-section { padding: 60px 0; }
.section-title { text-align: center; margin-bottom: 50px; }
.section-title h2 { font-size: 2.2rem; color: var(--primary); }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 30px; }
.info-card { background: white; padding: 40px; border-radius: 25px; transition: 0.3s; border-bottom: 6px solid transparent; }
.info-card:hover { transform: translateY(-10px); border-color: var(--secondary); }
.info-card i { font-size: 2.5rem; color: var(--secondary); margin-bottom: 25px; }
.info-card h3 { margin-bottom: 15px; color: var(--primary); font-size: 1.4rem; }

/* DONATION CARD */
.donation-section { margin-bottom: 80px; }
.donation-card { background: var(--white); padding: 60px; border-radius: 40px; text-align: center; border: 4px dashed var(--secondary); }
.donation-card h3 { font-size: 2rem; margin-bottom: 20px; }
.phone-number { font-size: 2.5rem; font-weight: 700; color: var(--secondary); display: block; margin: 20px 0; }

/* PEP PERU REGISTRO */
.pep-section { margin: 60px auto; }
.pep-card { background: linear-gradient(135deg, #0046ad 0%, #001f4d 100%); color: white; padding: 50px; border-radius: 30px; text-align: center; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.pep-badge { background: #ff7675; color: white; padding: 6px 15px; border-radius: 5px; font-weight: 700; font-size: 0.8rem; letter-spacing: 1px; display: inline-block; margin-bottom: 20px; }
.pep-card h2 { font-size: 2.2rem; margin-bottom: 20px; }
.pep-card p { font-size: 1.1rem; opacity: 0.9; margin-bottom: 30px; max-width: 800px; margin-left: auto; margin-right: auto; line-height: 1.8; }
.btn-pep { display: inline-block; background: #00b894; color: white; padding: 18px 40px; border-radius: 12px; text-decoration: none; font-weight: 700; font-size: 1.1rem; transition: transform 0.3s, box-shadow 0.3s; box-shadow: 0 10px 20px rgba(0, 184, 148, 0.3); }
.btn-pep:hover { transform: translateY(-3px); box-shadow: 0 15px 25px rgba(0, 184, 148, 0.4); }

/* BOTONES DE COMPARTIR RESULTADOS */
.share-buttons { text-align: center; padding: 20px; margin-top: 30px; border-top: 1px solid #e2e8f0; display: flex; flex-direction: column; align-items: center; gap: 15px; }
.share-buttons p { font-weight: 600; color: var(--dark); font-size: 1.1rem; }
.share-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.btn-share { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: 50px; text-decoration: none; font-weight: 700; font-size: 0.95rem; color: white; transition: 0.3s; }
.btn-share.wa { background: #25D366; }
.btn-share.tg { background: #0088cc; }
.btn-share.fb { background: #1877f2; }
.btn-share.li { background: #0a66c2; }
.btn-share:hover { transform: translateY(-2px); opacity: 0.9; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }

/* FOOTER */
.main-footer { background: var(--dark); color: white; padding: 60px 0; text-align: center; border-radius: 60px 60px 0 0; }
.footer-socials { margin: 25px 0; display: flex; justify-content: center; gap: 20px; }
.footer-socials a { color: white; font-size: 1.8rem; opacity: 0.8; transition: 0.3s; }
.footer-socials a:hover { opacity: 1; transform: translateY(-3px); color: var(--secondary); }

/* GEO LOCATION BUTTON */
.geo-wrapper {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.btn-geo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: white;
    border: none;
    padding: 14px 30px;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.3);
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
}
.btn-geo:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 184, 148, 0.45);
}
.btn-geo:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}
.btn-geo i {
    font-size: 1.1rem;
}
.geo-hint {
    font-size: 0.82rem;
    color: #94a3b8;
    font-weight: 500;
}

/* BADGE MÁS CERCANO */
.badge-cercano {
    display: inline-block;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 50px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 8px;
    animation: pulseBadge 2s infinite;
}
@keyframes pulseBadge {
    0%, 100% { box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(243, 156, 18, 0); }
}

/* CARD MÁS CERCANA DESTACADA */
.hosp-card.card-cercano {
    border-left-color: #f39c12;
    background: linear-gradient(135deg, #fffdf5 0%, #ffffff 100%);
    box-shadow: 0 8px 25px rgba(243, 156, 18, 0.15);
}

/* SPINNER GEOLOCALIZACIÓN */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.geo-spin {
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* STATUS MESSAGES */
.status-msg {
    padding: 16px 24px;
    border-radius: 12px;
    margin: 20px 0;
    font-weight: 600;
    display: none;
}
.status-loading {
    background: #e0f2fe;
    color: #0369a1;
    border-left: 4px solid #0284c7;
}
.status-success {
    background: #dcfce7;
    color: #166534;
    border-left: 4px solid #22c55e;
}
.status-error {
    background: #fef2f2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}
.status-warning {
    background: #fffbeb;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

/* CARD ANIMATION */
.hosp-card {
    animation: fadeInUp 0.4s ease-out both;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* RESPONSIVE */
@media (max-width: 992px) {
    .profile-grid { grid-template-columns: 1fr; }
    .profile-stats { border-left: none; padding-left: 0; flex-direction: row; justify-content: space-around; border-top: 2px solid #f1f5f9; padding-top: 40px; }
}

@media (max-width: 768px) {
    .hero h1 { font-size: 2.4rem; }
    .hero-btns { flex-direction: column; padding: 0 40px; }

    /* Mostrar hamburguesa, ocultar links de nav */
    .nav-links { display: none; }
    .hamburger { display: flex; }
    .fab-apoyar { display: flex; align-items: center; gap: 6px; }

    /* ====================================================
       MOBILE: Ocultar formulario manual.
       Solo se muestra el botón de ubicación.
    ==================================================== */
    .search-grid { display: none; }
    .search-box h2 { font-size: 1.4rem; }
    .search-box > p { font-size: 0.95rem; }

    /* Botón ubicación: grande y protagonista */
    .geo-wrapper { margin-top: 24px; }
    .btn-geo {
        width: 100%;
        justify-content: center;
        padding: 20px 30px;
        font-size: 1.15rem;
        border-radius: 16px;
        box-shadow: 0 8px 28px rgba(0, 184, 148, 0.4);
    }
    .geo-hint { font-size: 0.85rem; text-align: center; }

    /* Cards: columna, texto izquierda con icono al lado */
    .hosp-card { flex-direction: column; text-align: left; gap: 20px; }
    .hosp-info p { display: flex; align-items: flex-start; gap: 8px; text-align: left; }
    .hosp-info p i { flex-shrink: 0; margin-top: 3px; color: var(--secondary); }
    .hosp-btns { width: 100%; justify-content: stretch; }
    .btn-hosp { flex: 1; text-align: center; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.8rem; }
    .hero p { font-size: 1rem; }
    .hero { padding: 80px 0 120px; border-radius: 0 0 40px 40px; }
    .search-box { padding: 30px 20px; margin-top: -80px; }
    .info-card { padding: 25px; }
    .donation-card { padding: 30px 20px; }
    .profile-grid { padding: 30px 20px; }
    .phone-number { font-size: 1.8rem; }
    .nav-links a { margin-left: 12px; font-size: 0.85rem; }
    .logo { font-size: 1.3rem; }
    .hosp-btns { flex-direction: column; width: 100%; }
    .btn-hosp { text-align: center; }
}

/* PREFERS REDUCED MOTION (Accesibilidad) */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .hosp-card { animation: none; }
    .btn-main:hover, .info-card:hover { transform: none; }
}

/* PRINT STYLES */
@media print {
    .navbar, .ad-container, .donation-section, .main-footer, .btn-search, .hosp-btns { display: none !important; }
    body { background: white; color: black; }
    .hero { background: none; color: black; padding: 20px 0; border-radius: 0; }
    .hosp-card { break-inside: avoid; border: 1px solid #ccc; box-shadow: none; }
}