﻿:root {
    --brand-blue-500: #0056b3;
    --brand-blue-600: #004099;
    --brand-blue-100: #d9eaff;
    --surface: #ffffff;
    --background: #f5f8fb;
    --gray-900: #1f2933;
    --gray-700: #52606d;
    --gray-400: #9aa5b1;
    --gray-200: #e4e7eb;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --shadow-sm: 0 12px 28px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 20px 45px rgba(15, 23, 42, 0.12);
    --transition-base: 0.2s ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--gray-900);
    background-color: var(--background);
    line-height: 1.6;
    min-height: 100vh;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: var(--brand-blue-500);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--brand-blue-600);
    text-decoration: underline;
}

button {
    font-family: inherit;
}


.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(0.75rem, 2vw, 1.5rem);
    padding: clamp(0.75rem, 2vw, 1.5rem) clamp(1rem, 4vw, 2.5rem);
    background-color: var(--surface);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    position: relative;
    z-index: 10;
    flex-wrap: wrap;
}

.site-header .logo {
    display: flex;
    align-items: center;
}

.site-header .logo img {
    height: clamp(64px, 10vw, 90px);
    width: auto;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 0.35rem;
    background: transparent;
    border: none;
    padding: 0.4rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color var(--transition-base);
}

.nav-toggle:hover {
    background-color: rgba(15, 23, 42, 0.05);
}

.nav-toggle:focus-visible {
    outline: 2px solid var(--brand-blue-500);
    outline-offset: 3px;
}

.nav-toggle__bar {
    width: 24px;
    height: 2px;
    background: var(--gray-900);
    border-radius: 999px;
    transition: transform var(--transition-base), opacity var(--transition-base);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.site-header .site-nav {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2.5vw, 1.75rem);
}

.site-header .site-nav a {
    font-weight: 600;
    color: var(--brand-blue-500);
    letter-spacing: 0.01em;
    padding: 0.4rem 0;
}

.site-header .site-nav a:hover {
    color: var(--brand-blue-600);
    text-decoration: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 1.25rem);
}

.site-header .login-btn,
.site-header .logout-button {
    padding: 0.65rem 1.6rem;
    background-color: var(--brand-blue-500);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--transition-base), transform var(--transition-base);
}

.site-header .login-btn:hover,
.site-header .logout-button:hover {
    background-color: var(--brand-blue-600);
    transform: translateY(-1px);
}

.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;
}

@media (max-width: 860px) {
    .site-header {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        padding: clamp(0.75rem, 2vw, 1rem) clamp(1rem, 3vw, 1.5rem);
    }

    .site-header .logo {
        flex: 0 0 auto;
        order: 1;
    }

    .nav-toggle {
        display: flex !important;
        flex: 0 0 auto;
        order: 2;
        margin: 0 0.5rem;
    }

    .site-header .site-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        background: var(--surface);
        border-top: 1px solid rgba(148, 163, 184, 0.25);
        padding: 0.4rem 0;
        box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
        z-index: 1000;
    }

    .site-header .site-nav.open {
        display: flex;
    }

    .site-header .site-nav a {
        width: 100%;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid rgba(148, 163, 184, 0.25);
        transition: background-color var(--transition-base);
    }

    .site-header .site-nav a:hover {
        background-color: rgba(148, 163, 184, 0.05);
    }

    .site-header .site-nav a:last-child {
        border-bottom: none;
    }

    .header-actions {
        flex: 0 0 auto !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.5rem;
        order: 3;
    }
}


.profile-pic {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(148, 163, 184, 0.35);
}

.page-shell {
    width: min(1100px, 100%);
    margin: 0 auto;
    padding: clamp(1.25rem, 3vw, 2rem) clamp(1rem, 4vw, 2.5rem) clamp(2rem, 5vw, 3rem);
}

.section-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 1rem;
    color: var(--brand-blue-500);
}

.card {
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    padding: clamp(1.5rem, 4vw, 2.5rem);
    box-shadow: var(--shadow-sm);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.6rem;
    border-radius: 999px;
    border: none;
    background-color: var(--brand-blue-500);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--transition-base), transform var(--transition-base);
}

.btn:hover {
    background-color: var(--brand-blue-600);
    transform: translateY(-1px);
}

.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-outline {
    background: transparent;
    color: var(--brand-blue-500);
    border: 1px solid currentColor;
}

.btn-outline:hover {
    background: rgba(0, 86, 179, 0.08);
    color: var(--brand-blue-600);
}


.form-grid {
    display: grid;
    gap: 1rem;
}

.form-grid.two-col {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

label {
    font-weight: 600;
    color: var(--gray-900);
    display: inline-block;
    margin-bottom: 0.4rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    background: #fff;
    font-size: 1rem;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand-blue-500);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.15);
    outline: none;
}

textarea {
    min-height: 140px;
    resize: vertical;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-top: 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

th,
td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

th {
    background: #f1f5f9;
    text-transform: uppercase;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    color: var(--gray-700);
}

tbody tr:hover td {
    background: rgba(218, 234, 255, 0.35);
}

.hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: clamp(1.5rem, 4vw, 3rem);
    align-items: center;
    padding: clamp(2rem, 6vw, 4.5rem);
    background: var(--brand-blue-100);
}

.hero .text h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 1rem;
    color: var(--brand-blue-500);
    line-height: 1.1;
}

.hero .text p {
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    color: var(--gray-700);
}

.categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: clamp(1rem, 3vw, 2rem);
    padding: clamp(2rem, 5vw, 3.5rem);
    max-width: min(1100px, 100%);
    margin: 0 auto;
}

.category {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    text-align: center;
    padding: 1.4rem;
    background-color: #bcd9ff;
    border-radius: var(--radius-md);
    box-shadow: 0 16px 35px rgba(37, 99, 235, 0.15);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.category:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 45px rgba(37, 99, 235, 0.2);
}

.category h3 {
    color: var(--brand-blue-500);
    font-size: 1.1rem;
}

.category img {
    width: 52px;
    height: 52px;
}

.font-toggle-btn,
.read-page-btn {
    position: fixed;
    right: clamp(0.75rem, 3vw, 1.5rem);
    bottom: clamp(0.75rem, 3vw, 1.5rem);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background-color: var(--brand-blue-500);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
}

.read-page-btn {
    right: clamp(4rem, 8vw, 5rem);
}

.read-page-btn img {
    filter: invert(100%);
}

.read-page-btn.active img {
    filter: invert(48%) sepia(73%) saturate(542%) hue-rotate(86deg) brightness(92%) contrast(90%);
}

.color-options {
    position: fixed;
    right: clamp(4rem, 8vw, 5rem);
    bottom: clamp(0.75rem, 3vw, 1.5rem);
    display: flex;
    gap: 6px;
    z-index: 1000;
}

.color-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #fff;
    cursor: pointer;
}

body.large-font {
    font-size: 18px;
}

body.extra-font {
    font-size: 22px;
}

.calendario-wrapper {
    margin-top: 1.5rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    padding: 1rem;
}

.calendario {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}

.calendario th,
.calendario td {
    border: 1px solid rgba(148, 163, 184, 0.35);
    padding: 0.6rem;
    vertical-align: top;
}

.calendario th {
    background: #eff6ff;
    color: var(--brand-blue-500);
    text-align: center;
}

.calendario .dia {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-height: 120px;
    font-weight: 600;
    color: var(--gray-900);
}

.evento {
    padding: 0.55rem 0.6rem;
    border-radius: var(--radius-sm);
    background: rgba(0, 86, 179, 0.12);
    color: var(--gray-900);
    font-size: 0.9rem;
}

.evento a {
    color: inherit;
    font-weight: 600;
}

.cancelar {
    font-size: 0.78rem;
    color: #c53030;
    font-weight: 600;
}

.chat-layout {
    display: grid;
    gap: clamp(1.5rem, 4vw, 2.5rem);
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.chat-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
}

.chat-message.respuesta {
    margin-left: 1rem;
    border-left: 4px solid var(--brand-blue-500);
}

.chat-input textarea {
    min-height: 120px;
}

.video-player iframe {
    width: 100%;
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: rgba(0, 86, 179, 0.12);
    color: var(--brand-blue-500);
    font-weight: 600;
    font-size: 0.85rem;
}

.list-clean {
    list-style: none;
    margin: 0;
    padding: 0;
}

@media (max-width: 1024px) {
    header {
        padding-inline: clamp(1rem, 5vw, 2rem);
    }

    table {
        min-width: 600px;
    }
}

@media (max-width: 820px) {

    /* Solo aplicar flex-direction: column a headers que no sean .site-header */
    header:not(.site-header) {
        flex-direction: column;
        align-items: stretch;
    }

    header:not(.site-header) nav {
        width: 100%;
        justify-content: flex-start;
        gap: 0.6rem;
    }

    header:not(.site-header) nav a {
        width: 100%;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    }

    header:not(.site-header) nav a:last-child {
        border-bottom: none;
    }

    header:not(.site-header) .login-btn,
    header:not(.site-header) .logout-button {
        width: 100%;
    }

    .profile-pic {
        align-self: flex-end;
    }

    .categories {
        padding-inline: clamp(1rem, 4vw, 2rem);
    }
}

@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        min-width: unset;
    }

    table thead,
    table tbody {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .hero {
        padding: clamp(1.5rem, 6vw, 2.5rem);
        text-align: center;
    }

    .hero .text {
        margin: 0 auto;
    }

    .hero img {
        margin-inline: auto;
        max-width: clamp(220px, 70vw, 320px);
    }

    .contact-section {
        padding: clamp(2rem, 6vw, 3rem) 0;
    }

    .contact-content {
        padding: 0 1rem;
    }

    .contact-form {
        gap: 1.25rem;
    }

    .contact-form input,
    .contact-form textarea {
        font-size: 16px;
        /* Evita zoom en iOS */
    }

    table {
        min-width: 520px;
    }

    .chat-message.respuesta {
        margin-left: 0;
        border-left-width: 0;
    }

    .font-toggle-btn,
    .read-page-btn {
        width: 46px;
        height: 46px;
    }
}

@media (max-width: 480px) {
    header .logo img {
        height: 56px;
    }

    .card {
        padding: clamp(1.25rem, 5vw, 1.75rem);
    }

    th,
    td {
        padding-inline: 0.65rem;
    }

    .font-toggle-btn {
        right: 0.9rem;
        bottom: 0.9rem;
    }

    .read-page-btn {
        right: 3.9rem;
        bottom: 0.9rem;
    }

    .color-options {
        right: 3.9rem;
        bottom: 3.2rem;
    }
}

/* Estilo para botón de logout en móviles */
@media (max-width: 768px) {
    .logout-button {
        width: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 0 !important;
        background-color: #dc2626 !important;
        border: none !important;
        position: relative !important;
        background-image: url('../img/logout.svg') !important;
        background-size: 20px 20px !important;
        background-position: center !important;
        background-repeat: no-repeat !important;
    }

    .logout-button:hover {
        background-color: #b91c1c !important;
        transform: scale(1.05) !important;
        transition: all 0.2s ease !important;
    }

    .logout-button:active {
        transform: scale(0.95) !important;
    }
}

.about {
    padding: clamp(2rem, 6vw, 3.5rem);
    text-align: center;
    max-width: min(900px, 92%);
    margin: 0 auto;
    color: var(--gray-700);
}

.about h2 {
    margin-bottom: 1rem;
    font-size: clamp(1.75rem, 4vw, 2.2rem);
    color: var(--brand-blue-500);
}

.about p {
    font-size: clamp(1rem, 2.2vw, 1.15rem);
    margin: 0;
}

/* Contact Section */
.contact-section {
    padding: clamp(3rem, 8vw, 5rem) 0;
    background: var(--surface);
}

.contact-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.contact-content h2 {
    font-size: clamp(2rem, 4vw, 2.5rem);
    margin-bottom: 1rem;
    color: var(--brand-blue-500);
}

.contact-content>p {
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    color: var(--gray-700);
    margin-bottom: 2rem;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    text-align: left;
}

.contact-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.contact-form label {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 0.95rem;
}

.contact-form input,
.contact-form textarea {
    padding: 0.75rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: white;
    font-size: 1rem;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    font-family: inherit;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--brand-blue-500);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.15);
}

.contact-form input:hover,
.contact-form textarea:hover {
    border-color: var(--brand-blue-100);
}

.contact-form .error-message {
    color: #dc2626;
    font-size: 0.85rem;
    font-weight: 500;
}

.error-message-general {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-weight: 500;
}

.success-message {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
    font-weight: 500;
}

.success-message p {
    margin: 0;
}

.contact-form .btn {
    align-self: center;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    margin-top: 0.5rem;
}