:root {
    --primary-dark: #1a1a2e;
    --accent: #e94560;
}

html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #333;
    overflow-x: hidden;
}

/* Modo contenido centrado (no ancho completo): que se note el "caja" */
body:not(.layout-fullwidth) {
    background-color: #e9ecef;
}

body:not(.layout-fullwidth) main > section.container {
    background-color: #fff;
    box-shadow: 0 0 1.5rem rgba(0, 0, 0, 0.08);
    border-radius: 0.5rem;
    padding-left: calc(var(--bs-gutter-x, 1rem) + 1rem);
    padding-right: calc(var(--bs-gutter-x, 1rem) + 1rem);
    margin-bottom: 2rem;
}

body:not(.layout-fullwidth) main > section.container:last-child {
    margin-bottom: 0;
}

/* Ancho completo (desde Ajustes) */
body.layout-fullwidth main .container {
    max-width: 100%;
    width: 100%;
    padding-left: var(--bs-gutter-x, 1rem);
    padding-right: var(--bs-gutter-x, 1rem);
}

body.layout-fullwidth main .container .row .col-lg-10 {
    max-width: 100%;
    flex: 0 0 100%;
}

/* Navbar */
.navbar .container {
    flex-wrap: wrap;
}
.navbar-brand {
    font-size: clamp(0.95rem, 2.5vw + 0.8rem, 1.2rem);
    letter-spacing: 0.5px;
    max-width: calc(100vw - 100px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 400px) {
    .navbar-brand {
        font-size: 0.9rem;
        max-width: calc(100vw - 90px);
    }
}
.navbar-collapse {
    max-height: 70vh;
    overflow-y: auto;
}
.navbar-nav .nav-link {
    white-space: nowrap;
}
.dropdown-menu {
    max-height: 60vh;
    overflow-y: auto;
}

/* Hero / Page header */
.page-hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--color-secondary, #16213e) 50%, #0f3460 100%);
    background-size: cover;
    background-position: center;
    color: white;
    padding: 4rem 0 3rem;
    margin-bottom: 2rem;
}

.page-hero h1 {
    font-weight: 700;
    font-size: clamp(1.25rem, 5vw + 1rem, 2.5rem);
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}
.page-hero .breadcrumb {
    flex-wrap: wrap;
}
.page-hero .breadcrumb-item + .breadcrumb-item {
    padding-left: 0.5rem;
}

.page-hero .breadcrumb-item a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
}

.page-hero .breadcrumb-item.active {
    color: rgba(255,255,255,0.9);
}

/* Content */
.page-content {
    min-height: 10vh;
}

.page-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Gallery grid */
.gallery-card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.12);
}

.gallery-card .card-img-top {
    height: 220px;
    object-fit: cover;
}

.gallery-card .card-body {
    padding: 1.2rem;
}

/* Gallery detail images */
.gallery-thumb {
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-thumb:hover {
    transform: scale(1.03);
}

.gallery-thumb img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

/* Events */
.event-card {
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    transition: box-shadow 0.2s;
}

.event-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Imágenes dentro de la descripción del evento: que no se salgan del recuadro */
.event-card .event-description,
.event-card .card-body > div {
    overflow: hidden;
    max-width: 100%;
}
.event-card .event-description img,
.event-card .card-body img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    border-radius: 6px;
}

.event-date-badge {
    background: var(--accent);
    color: white;
    width: 70px;
    min-height: 70px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.event-date-badge .day {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
}

.event-date-badge .month {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Contact form */
.contact-form .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.2rem rgba(233,69,96,0.15);
}

/* Footer */
footer {
    margin-top: auto;
}
footer .row {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}
footer [class*="col-"] {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}
footer h5 {
    font-size: 1.1rem;
}
footer p, footer .small {
    font-size: 0.9rem;
}
@media (max-width: 767.98px) {
    footer .text-md-end {
        text-align: center !important;
    }
    footer .col-md-6:first-child {
        text-align: center;
        margin-bottom: 1rem;
    }
}

/* Past events */
.event-past {
    opacity: 0.6;
}

/* Calendar view */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day {
    min-height: 80px;
    padding: 4px;
    background: white;
    border: 1px solid #e9ecef;
    font-size: 0.85rem;
}

.calendar-day.today {
    background: #fff3cd;
}

.calendar-day.has-event {
    background: #e8f5e9;
}

.calendar-header {
    background: #343a40;
    color: white;
    padding: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
}
@media (max-width: 575.98px) {
    .calendar-grid {
        gap: 1px;
    }
    .calendar-day {
        min-height: 50px;
        padding: 2px;
        font-size: 0.7rem;
    }
    .calendar-header {
        padding: 4px;
        font-size: 0.65rem;
    }
    .calendar-day strong {
        font-size: 0.85em;
    }
}

/* Page blocks */
.page-block {
    animation: fadeInBlock 0.3s ease;
}

.block-spacer {
    display: block;
    width: 100%;
    min-height: 1px;
    pointer-events: none;
}

@keyframes fadeInBlock {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.block-text img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.block-image img {
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.block-video {
    max-width: 800px;
    width: 100%;
}

.block-video iframe {
    border-radius: 8px;
}

.block-link .btn-lg {
    padding: 12px 32px;
    font-size: 1.1rem;
    border-radius: 8px;
}

.block-link-card {
    border: 1px solid #dee2e6;
    border-radius: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
    max-width: 500px;
    width: 100%;
    color: #333;
}

.block-link-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    color: #333;
}

.block-gallery .gallery-thumb img {
    height: 180px;
}

/* Header block */
.block-header {
    border-radius: 12px;
    overflow: hidden;
}

.block-header-inner {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--color-secondary, #16213e) 100%);
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.block-header-inner[style*="background-image"] {
    background-blend-mode: overlay;
}

.block-header-overlay {
    position: relative;
    z-index: 1;
}

.block-header-inner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 0;
}

.block-header-inner:not([style*="background-image"])::before {
    display: none;
}

/* Text + Image block */
.block-text-image .block-text-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Table block */
.block-table .table {
    margin-bottom: 0;
    font-size: 0.9rem;
}
.block-table .table-responsive {
    -webkit-overflow-scrolling: touch;
}
@media (max-width: 575.98px) {
    .block-table .table {
        font-size: 0.8rem;
    }
    .block-table th,
    .block-table td {
        padding: 0.4rem 0.5rem;
    }
}

/* CTA block */
.block-cta {
    border-radius: 12px;
}
.block-cta .btn-lg {
    max-width: 320px;
}
.block-cta.bg-dark,
.block-cta.bg-primary {
    color: white;
}

/* Cards block */
.block-cards .card {
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.block-cards .card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

@media (max-width: 767.98px) {
    .page-hero {
        padding: 2.5rem 0 2rem;
    }
    .page-hero .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .gallery-card .card-img-top {
        height: 180px;
    }
    .gallery-thumb img {
        height: 150px;
    }
    .block-gallery .gallery-thumb img {
        height: 120px;
    }
    .block-header-inner {
        min-height: 150px;
        padding: 2rem 1rem !important;
    }
    .block-header-inner .display-5 {
        font-size: 1.75rem !important;
    }
    .block-header-inner .lead {
        font-size: 1rem !important;
    }
    .block-text-image .row {
        flex-direction: column !important;
    }
    .block-text-image .col-md-6 {
        max-width: 100%;
    }
    .block-video {
        max-width: 100%;
    }
    .block-link-card {
        max-width: 100%;
    }
    .block-cta,
    .block-contact .card {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    .block-cta .btn-lg,
    .block-contact .btn-lg {
        width: 100%;
    }
    .event-date-badge {
        width: 56px;
        min-height: 56px;
    }
    .event-date-badge .day {
        font-size: 1.35rem;
    }
    .event-date-badge .month {
        font-size: 0.65rem;
    }
    .event-card .card-body {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .event-card h5 {
        font-size: 1rem;
    }
    body:not(.layout-fullwidth) main > section.container {
        padding-left: 1rem;
        padding-right: 1rem;
        margin-left: 0.5rem;
        margin-right: 0.5rem;
        margin-bottom: 1.5rem;
    }
    body.layout-fullwidth main .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .page-content img,
    .block-text img,
    .block-image img {
        max-width: 100%;
        height: auto;
    }
    .contact-form .btn-lg {
        width: 100%;
    }
    .card .card-body.p-4 {
        padding: 1rem !important;
    }
}
