/* ==========================================================
   El Mar – hoja de estilos única para todo el sitio
   ========================================================== */

:root {
    --color-mar-oscuro: #052f4f;
    --color-mar-medio: #0b5394;
    --color-mar-claro: #3d9ed9;
    --color-mar-superficie: #76d2f2;
    --color-mar-fondo-fin: #1a6aa5;
    --color-primario: #0d6efd;
    --color-texto: #212529;
    --color-titulo-oscuro: #0b2a44;
    --sombra-suave: 0 4px 12px rgba(0, 47, 79, 0.15);
    --sombra-hover: 0 12px 30px rgba(11, 83, 148, 0.25);
    --espacio-seccion: 3rem;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 4.5rem; /* evita que la barra fija tape los anclajes */
}

body {
    font-family: 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    background: linear-gradient(180deg,
        var(--color-mar-oscuro) 0%,
        var(--color-mar-medio) 45%,
        var(--color-mar-fondo-fin) 100%);
    background-repeat: no-repeat;
    min-height: 100vh;
    color: #fff;
    overflow-x: hidden;
}

img {
    max-width: 100%;
}

/* ---------- Navegación ---------- */
.navbar-brand {
    font-size: 1.25rem;
    letter-spacing: 0.5px;
    color: #ffffff !important;
}

.nav-link {
    position: relative;
    transition: color 0.3s ease;
    color: #ffffff !important;
}

/* Subrayado animado (no se aplica al menú desplegable para no romper su flecha) */
.nav-link:not(.dropdown-toggle)::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-mar-claro);
    transition: width 0.3s ease;
}

.nav-link:hover {
    color: var(--color-mar-superficie) !important;
}

.nav-link:not(.dropdown-toggle):hover::after,
.nav-link.active:not(.dropdown-toggle)::after {
    width: 100%;
}

.nav-link.active {
    color: #ffffff !important;
    font-weight: 600;
}

/* ---------- Títulos ---------- */
/* Por defecto blancos (van sobre el fondo azul)… */
h1, h2, h3, h4, h5, h6 {
    color: #ffffff;
    font-weight: 700;
}

/* …y oscuros cuando están dentro de superficies claras */
.card .card-title,
.card h1, .card h2, .card h3, .card h4, .card h5, .card h6,
.modal-body h1, .modal-body h2, .modal-body h3, .modal-body h4,
#miFormulario h3 {
    color: var(--color-titulo-oscuro);
}

h1 {
    text-align: center;
    font-size: clamp(1.75rem, 4.5vw, 2.5rem);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--color-mar-claro), var(--color-primario)) 1;
}

h2 {
    font-size: clamp(1.4rem, 3vw, 2rem);
}

.card-title {
    font-size: 1.35rem;
}

/* ---------- Contenedores ---------- */
.container.py-5 {
    padding-top: var(--espacio-seccion) !important;
    padding-bottom: var(--espacio-seccion) !important;
}

/* ---------- Tarjetas ---------- */
.card {
    border: none;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--sombra-suave);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
    background-color: rgba(255, 255, 255, 0.95);
}

.card-img-top {
    height: 200px;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.card-body {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
}

.card-text {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.card-text:last-of-type {
    margin-bottom: 1.25rem;
}

.card-text strong {
    color: var(--color-mar-medio);
}

.card-body .btn {
    margin-top: auto;
}

/* El efecto hover solo en dispositivos con ratón (en celular se quedaba "pegado") */
@media (hover: hover) {
    .card:hover {
        transform: translateY(-8px);
        box-shadow: var(--sombra-hover);
    }

    .card:hover .card-img-top {
        transform: scale(1.05);
    }
}

/* ---------- Botones ---------- */
.btn-primary {
    background: linear-gradient(90deg, var(--color-mar-medio) 0%, var(--color-primario) 100%);
    border: none;
    border-radius: 0.75rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
    color: #ffffff !important;
    transition: all 0.3s ease;
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background: linear-gradient(90deg, var(--color-mar-oscuro) 0%, #0b5ed7 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
    color: #ffffff !important;
}

.btn-secondary {
    background-color: #6c757d;
    border: none;
    border-radius: 0.5rem;
    color: #ffffff;
}

/* ---------- Inicio (hero) ---------- */
.inicio-profesional {
    min-height: calc(100vh - 56px); /* 56px = alto de la barra fija */
    padding: 4rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: linear-gradient(135deg, var(--color-mar-oscuro) 0%, var(--color-mar-medio) 55%, var(--color-mar-fondo-fin) 100%);
    color: #ffffff;
}

.inicio-profesional__contenido {
    max-width: 800px;
}

.inicio-profesional__titulo {
    font-size: clamp(1.75rem, 5vw, 3.25rem);
    margin-bottom: 1.5rem;
    color: #ffffff;
}

.inicio-profesional__descripcion {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    margin-bottom: 2.5rem;
    line-height: 1.8;
}

/* ---------- Ventanas modales ---------- */
.modal-content {
    border: none;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.2);
}

.modal-header {
    background: linear-gradient(90deg, var(--color-mar-oscuro) 0%, var(--color-mar-medio) 100%);
    color: #ffffff;
    border-bottom: none;
    padding: 1rem 1.5rem;
}

.modal-header .modal-title {
    color: #ffffff;
    font-size: 1.25rem;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 1;
}

.modal-body {
    padding: 1.5rem;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--color-texto);
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
}

/* ---------- Carrusel ---------- */
#carrusel {
    max-width: 100%;
    margin: 0 auto;
}

#carrusel .carousel-inner {
    border-radius: 1rem;
    box-shadow: var(--sombra-suave);
}

#carrusel .carousel-item img {
    height: 350px;
    object-fit: cover;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    background-color: rgba(3, 52, 84, 0.5);
    border-radius: 50%;
    padding: 1rem;
}

/* ---------- Preguntas frecuentes ---------- */
.accordion {
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--sombra-suave);
}

/* ---------- Formulario ---------- */
#miFormulario {
    max-width: 700px;
    width: 100%;
    margin: 0 auto 2rem;
    padding: 2rem;
    background-color: #e0f7fa;
    border: 2px solid #0288d1;
    border-radius: 1rem;
    box-shadow: 0 5px 20px rgba(0, 87, 150, 0.2);
    color: var(--color-texto);
}

#miFormulario label {
    display: block;
    margin-top: 0.5rem;
    color: #01579b;
    font-weight: 600;
}

#miFormulario .form-control {
    padding: 0.65rem 0.75rem;
    border: 1px solid #b2ebf2;
    border-radius: 0.5rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#miFormulario .form-control:focus {
    border-color: #0288d1;
    box-shadow: 0 0 8px rgba(2, 136, 209, 0.3);
}

#miFormulario h3 {
    margin: 1rem 0 0.5rem;
    font-size: 1.1rem;
}

#miFormulario input[type="checkbox"] {
    width: 1.1em;
    height: 1.1em;
    margin: 0 0.5rem 0 0;
    vertical-align: middle;
}

#miFormulario input[type="checkbox"] + label {
    display: inline-block;
    margin-top: 0;
    margin-bottom: 0.35rem;
    font-weight: 500;
}

/* Mensajes de error: sin hueco cuando están vacíos */
#miFormulario .text-danger {
    margin: 0.25rem 0 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}

#miFormulario .text-danger:empty {
    display: none;
}

#miFormulario .btn-primary {
    width: 100%;
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Estados de error del formulario (deben ganarle a la regla de #miFormulario .form-control) */
#miFormulario .form-control.is-invalid {
    border-color: #dc3545;
}

#miFormulario .form-control.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

#miFormulario input[type="checkbox"].is-invalid {
    outline: 2px solid #dc3545;
    outline-offset: 1px;
}

#miFormulario .alert-success {
    font-weight: 600;
}

/* ---------- Botón «volver arriba» ---------- */
.btn-volver-arriba {
    position: fixed;
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
    z-index: 1030; /* por debajo de los avisos (toast) y las ventanas modales */
    width: 3rem;  /* 48 px: cómodo de tocar en celular */
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    color: #ffffff;
    font-size: 1.4rem;
    background: linear-gradient(135deg, var(--color-mar-medio), var(--color-primario));
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden; /* oculto también para teclado y lectores de pantalla */
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.btn-volver-arriba.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.btn-volver-arriba:hover {
    background: linear-gradient(135deg, var(--color-mar-oscuro), var(--color-mar-medio));
}

.btn-volver-arriba:focus-visible {
    outline: 3px solid var(--color-mar-superficie);
    outline-offset: 3px;
}

/* ---------- Pie de página ---------- */
.footer-mar {
    background: linear-gradient(135deg, #031b32, #052f4f, #0b5394);
    color: #ffffff;
    border-top: 4px solid var(--color-mar-superficie);
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.12);
}

.footer-mar .container {
    padding-top: 3rem !important;
    padding-bottom: 1.5rem !important;
}

.footer-mar h2 {
    color: var(--color-mar-superficie);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    letter-spacing: 0.5px;
}

.footer-mar p {
    color: #e3f4ff;
    font-size: 0.95rem;
    line-height: 1.8;
}

.footer-mar ul {
    padding: 0;
    margin: 0;
}

.footer-mar li {
    margin-bottom: 0.65rem;
}

.footer-mar a {
    color: #e3f4ff;
    text-decoration: none;
    font-size: 0.95rem;
    display: inline-block;
    transition: color 0.3s ease, transform 0.3s ease;
}

.footer-mar a:hover {
    color: var(--color-mar-superficie);
    transform: translateX(5px);
}

.footer-mar hr {
    border: 0;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.35);
    opacity: 1;
    margin: 1.5rem 0;
}

.footer-mar .text-center {
    color: #c5e3f3;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
}

/* ==========================================================
   Responsivo
   ========================================================== */

/* Tablet y celular */
@media (max-width: 767.98px) {
    :root {
        --espacio-seccion: 2rem;
    }

    .card-img-top {
        height: 170px;
    }

    #carrusel .carousel-item img {
        height: 220px;
    }

    .inicio-profesional {
        padding: 3rem 1rem;
    }

    #miFormulario {
        padding: 1.25rem;
    }

    .footer-mar .container {
        padding-top: 2rem !important;
    }

    .footer-mar h2 {
        margin-bottom: 0.8rem;
    }

    .footer-mar a:hover {
        transform: none;
    }
}

/* Celulares muy pequeños */
@media (max-width: 575.98px) {
    .navbar-brand {
        font-size: 1.1rem;
    }

    .modal-body,
    .modal-header,
    .modal-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Respeta a quien prefiere menos animaciones */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
