/* --- Variables de Diseño --- */
:root {
    --color-dark: #1E1E1E;
    --color-orange: #E55A19;
    --color-white: #FFFFFF;
    --color-grey: #2D2D2D;
    --font-family: 'JetBrains Mono', monospace;
}

/* --- Reseteo y Globales --- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    --color-dark-blue: #0d0f2b;
    --color-purple: #4c1a57;
    --mouse-x: 50%;
    --mouse-y: 50%;

    background-color: var(--color-dark);
    background-image: radial-gradient(
        circle at var(--mouse-x) var(--mouse-y),
        var(--color-purple) 0%,
        var(--color-dark-blue) 35%,
        var(--color-dark) 70%
    );
    transition: background 0.5s ease-out;
    color: var(--color-white);
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.6;
}
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
a { color: var(--color-orange); text-decoration: none; transition: color 0.3s; }
a:hover { color: #d45117; }
img { max-width: 100%; height: auto; }
ul { list-style: none; }

/* --- Tipografía (Mobile First) --- */
h1 { font-size: 36px; font-weight: 700; margin-bottom: 0.5em;}
h2 { font-size: 28px; font-weight: 500; margin-bottom: 0.75em;}
h3 { font-size: 22px; font-weight: 700; margin-bottom: 0.5em;}
.legal-text, .small-text { font-size: 14px; }
.subtitle { font-size: 18px; max-width: 600px; margin: 0 auto 30px; }

/* --- Utilidades --- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.container-narrow { max-width: 800px; }
.section-description { max-width: 700px; margin: 0 auto 40px; }
.mt-20 { margin-top: 20px; }
.mt-40 { margin-top: 40px; }
.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; }

/* --- Accesibilidad (Mandatorio) --- */
a:focus, button:focus, input:focus {
    outline: 2px solid var(--color-white);
    outline-offset: 4px;
}

/* --- Header --- */
.site-header { padding: 20px 0; border-bottom: 1px solid var(--color-grey); }
.site-header .container { display: flex; justify-content: space-between; align-items: center; }
.logo-horizontal { height: 50px; }

.mobile-nav-toggle { display: none; } /* Oculto en desktop, visible en mobile via media query */

.main-nav a { color: var(--color-white); font-weight: 500; transition: color 0.3s; }
.main-nav a:hover, .main-nav a:focus { color: var(--color-orange); }

/* --- Botones --- */
.btn {
    display: inline-block;
    padding: 12px 28px;
    background-color: var(--color-orange);
    color: var(--color-white);
    font-weight: 700;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}
.btn:hover, .btn:focus {
    transform: translateY(-2px);
    background-color: #d45117;
    color: var(--color-dark);
}

/* --- Secciones y Tarjetas (Mobile First) --- */
.section {
    padding: 60px 0;
    text-align: center;
    background-color: var(--color-dark-blue);
    /*border-radius: 8px;*/
    margin-bottom: 2rem;
    position: relative; /* Para que el z-index de los popups de leaflet funcione */
}

.section:last-child {
    margin-bottom: 0;
}


.plans-grid, .features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    text-align: left;
}
.features-grid { text-align: center; }
.plan-card {
    background: linear-gradient(145deg, var(--color-purple), var(--color-dark-blue));
    border: 1px solid #444;
    padding: 30px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.plan-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-orange);
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5), 0 0 20px 0px rgba(229, 90, 25, 0.4);
}
.speed-container {
    margin-bottom: 15px;
}
.speed-container p {
    margin: 0;
    font-size: 18px;
    line-height: 1.4;
    font-weight: 500;
}
.plan-card .price { font-size: 36px; font-weight: 700; margin: 15px 0 5px; }
.plan-card .price-note { font-size: 16px; margin-bottom: 10px;}
.plan-card .ift-folio { font-size: 14px; color: #aaa; margin-bottom: 25px;}
.plan-card .btn { margin-top: auto; }

/* --- Detailed Plan Page --- */
.detailed-plans-container {
    display: grid;
    gap: 30px;
}

.plan-detail {
    background: linear-gradient(145deg, var(--color-purple), var(--color-dark-blue));
    border: 1px solid #444;
    padding: 30px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
    overflow: hidden;
}

.plan-detail:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5), 0 0 20px 0px rgba(229, 90, 25, 0.4);
    border-color: var(--color-orange);
}

.plan-detail .plan-name {
    color: var(--color-orange);
    font-size: 28px;
    margin-bottom: 10px;
}

.plan-detail .plan-price {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 15px;
}

.plan-detail .plan-price .price-note {
    font-size: 16px;
    font-weight: 400;
    color: #ccc;
}

.speed-container-animated {
    position: relative;
    padding-left: 20px; /* Space for the animation */
    margin-bottom: 15px;
}

.speed-container-animated p {
    margin: 0;
    font-size: 18px;
    line-height: 1.4;
    font-weight: 500;
}

.speed-container-animated::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 15px; /* Height of the small rectangle */
    background-color: var(--color-orange);
    animation: drop-and-repeat var(--animation-duration, 2s) linear infinite;
}

.plan-detail .plan-description {
    margin-bottom: 15px;
    color: #eee;
}

.plan-detail .plan-ift-folio {
    font-size: 12px;
    color: #aaa;
}

.btn-lg {
    padding: 15px 35px;
    font-size: 18px;
}


/* --- Formularios --- */
.form-group { margin-bottom: 20px; text-align: left; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; }
.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px;
    background-color: var(--color-grey);
    border: 1px solid #555;
    color: var(--color-white);
    font-family: var(--font-family);
}
.form-group textarea { resize: vertical; min-height: 120px; }

/* --- Cobertura --- */
#postal-code-checker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#postal-code-checker input {
    max-width: 350px;
    text-align: center;
    font-size: 18px;
}

#coverage-result {
    margin-top: 30px;
    min-height: 50px; /* Evita saltos de layout */
}

#coverage-result p {
    font-size: 18px;
    font-weight: 500;
}

#coverage-result .success { color: #4CAF50; }
#coverage-result .notice { color: #FFC107; }
#coverage-result .error { color: #F44336; }

.feasibility-note {
    color: var(--color-orange);
    font-size: 14px;
    margin-top: 15px;
}


.map-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    background: var(--color-grey);
}
.map-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0; }

/* --- Footer (Mobile First) --- */
.site-footer { background-color: #111; padding: 60px 0; font-size: 14px; }
.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
}
.logo-vertical { height: 100px; margin-bottom: 20px; }
.footer-contact h3, .footer-legal h3 { font-size: 18px; font-weight: 700; margin-bottom: 15px; }
.footer-legal ul li { margin-bottom: 10px; }
.footer-legal a, .footer-contact a { color: #ccc; transition: color 0.3s; }
.footer-legal a:hover, .footer-contact a:hover { color: var(--color-orange); }

/* --- Estilos del Mapa Leaflet --- */
#coverage-map {
    height: 400px; /* Altura para mobile */
    width: 100%;
    background-color: var(--color-grey);
    border-radius: 0;
    border: 1px solid #555;
}
.leaflet-popup-content-wrapper {
    background-color: var(--color-grey);
    color: var(--color-white);
    border-radius: 0;
}
.leaflet-popup-content { font-family: var(--font-family); }
.leaflet-popup-tip { background-color: var(--color-grey); }
.leaflet-container a.leaflet-popup-close-button { color: var(--color-white); }

.coverage-label {
    background-color: rgba(30, 30, 30, 0.75);
    color: var(--color-white);
    font-size: 18px;
    font-weight: 700;
    padding: 8px 15px;
    border: 5px solid var(--color-dark);
}

/* --- Contact Card --- */
.contact-card {
    background-color: var(--color-grey);
    border-top: 1px solid #444;
    border-bottom: 1px solid #444;
}

.contact-card .container {
    max-width: 800px;
}

.contact-card h2 {
    color: var(--color-orange);
}

.contact-card p {
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* =================================
   Animaciones
   ================================= */

@keyframes drop-and-repeat {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    80% {
        transform: translateY(35px);
        opacity: 1;
    }
    100% {
        transform: translateY(35px);
        opacity: 0;
    }
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Elementos a animar: estado inicial */
.plan-card, .features-grid > div {
    opacity: 0;
    transform: translateY(20px);
}

/* Estado final cuando la sección está en vista */
.section.in-view .plan-card,
.section.in-view .features-grid > div {
    animation: fade-in-up 0.6s forwards;
}

/* Delay para las tarjetas */
.section.in-view .plan-card:nth-child(2) { animation-delay: 0.2s; }
.section.in-view .plan-card:nth-child(3) { animation-delay: 0.4s; }
.section.in-view .features-grid > div:nth-child(2) { animation-delay: 0.2s; }
.section.in-view .features-grid > div:nth-child(3) { animation-delay: 0.4s; }


/* --- Back to Top Button --- */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--color-orange);
    color: var(--color-white);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(100px);
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: #d45117;
    transform: scale(1.1);
    color: var(--color-white);
}

.back-to-top svg {
    width: 24px;
    height: 24px;
}

/* =================================
   Responsive Styles
   ================================= */

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    h1 { font-size: 48px; }
    h2 { font-size: 36px; }
    .subtitle { font-size: 20px; }
    .section { padding: 80px 0; }
    .logo-horizontal { height: 65px; }

    .nav-links { display: flex; gap: 30px; }

    .plans-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
    .features-grid { grid-template-columns: repeat(3, 1fr); }
    .footer-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
    #coverage-map { height: 550px; }
}

/* Small devices (phones, less than 768px) */
@media (max-width: 767.98px) {
    .mobile-nav-toggle {
        display: block;
        position: relative;
        z-index: 9999;
        background: transparent;
        border: 0;
        width: 2rem;
        height: 2rem;
        cursor: pointer;
    }

    .mobile-nav-toggle .sr-only { display: none; }

    .mobile-nav-toggle::before,
    .mobile-nav-toggle::after {
        content: '';
        position: absolute;
        left: 0.25rem;
        width: 1.5rem;
        height: 2px;
        background: var(--color-white);
        transition: transform 300ms ease-out, top 300ms ease-out, bottom 300ms ease-out;
    }

    .mobile-nav-toggle::before { top: 0.6rem; }
    .mobile-nav-toggle::after { bottom: 0.6rem; }

    .mobile-nav-toggle[aria-expanded="true"]::before {
        top: 0.9rem;
        transform: rotate(45deg);
    }
    .mobile-nav-toggle[aria-expanded="true"]::after {
        bottom: 0.9rem;
        transform: rotate(-45deg);
    }

    .main-nav {
        position: fixed;
        z-index: 1000;
        inset: 0;
        background: hsla(0, 0%, 12%, 0.95);
        backdrop-filter: blur(5px);

        transform: translateX(100%);
        transition: transform 350ms ease-out;
    }

    .main-nav[data-visible="true"] {
        transform: translateX(0);
    }

    .nav-links {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        height: 100%;
        gap: 40px;
    }

    .nav-links a { font-size: 24px; }
}