/* ==========================================================
   Instituto Oriente - Agenda 2026-2027
   CSS ÚNICO / Desktop + Tablet + Mobile-first
   ========================================================== */

:root {
    --io-blue: #003366;
    --io-blue-dark: #00264d;
    --io-navy: #252772;
    --io-orange: #f28c28;
    --io-bg: #f5f7fa;
    --io-surface: #ffffff;
    --io-line: #e3e8ef;
    --io-text: #202838;
    --io-muted: #6f7887;
    --io-shadow: 0 5px 18px rgba(0, 35, 70, .07);
    --io-radius: 12px;
    --agenda-header-height: 64px;
}

/* ---------- Base ---------- */
html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--io-bg);
    color: var(--io-text);
    font-family: Arial, Helvetica, sans-serif;
}

img {
    max-width: 100%;
}

/* No hipervínculos activos dentro de la agenda */
.agenda-page a,
.agenda-header a {
    color: inherit !important;
    text-decoration: none !important;
    pointer-events: none !important;
    cursor: default !important;
}

/* ---------- Encabezado ejecutivo ---------- */
.agenda-header {
    position: sticky;
    top: 0;
    z-index: 1050;
    background: rgba(255, 255, 255, .98);
    border-bottom: 1px solid var(--io-line);
    box-shadow: 0 2px 10px rgba(0, 35, 70, .07);
}

.agenda-header-inner {
    min-height: var(--agenda-header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.agenda-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.agenda-logo {
    width: auto;
    height: 42px;
    object-fit: contain;
}

.agenda-title-wrap {
    min-width: 0;
    line-height: 1;
}

.agenda-kicker {
    display: block;
    margin-bottom: 4px;
    color: #748091;
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .12em;
}

.agenda-title {
    position: relative;
    display: inline-block;
    margin: 0;
    color: var(--io-blue);
    font-size: 1.3rem;
    font-weight: 800;
    white-space: nowrap;
}

.agenda-title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -7px;
    width: 38px;
    height: 3px;
    border-radius: 99px;
    background: var(--io-orange);
}

/* ---------- Página ---------- */
.agenda-page {
    padding: 14px 0 34px;
}

.agenda-container {
    max-width: 1600px;
    margin: 0 auto;
    padding-left: 18px;
    padding-right: 18px;
}

/* ---------- Toolbar ---------- */
.agenda-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
    padding: 0 3px;
}

.agenda-toolbar-copy {
    display: flex;
    align-items: baseline;
    gap: 9px;
    color: var(--io-blue);
    font-size: .84rem;
}

.agenda-toolbar-eyebrow {
    color: var(--io-muted);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .11em;
}

.agenda-color-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 11px;
    border: 1px solid #d8e0e9;
    border-radius: 8px;
    background: #fff;
    color: var(--io-blue);
    font-size: .74rem;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(0, 35, 70, .04);
}

.agenda-color-btn:hover {
    background: #f8fafc;
}

/* ==========================================================
   DESKTOP / TABLE
   ========================================================== */
.agenda-table-wrap {
    width: 100%;
    overflow: visible;
    background: #fff;
    border: 1px solid var(--io-line);
    border-radius: var(--io-radius);
    box-shadow: var(--io-shadow);
}

.agenda-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
}

/* Encabezados de columnas SIEMPRE VISIBLES */
.agenda-table thead {
    position: sticky;
    top: var(--agenda-header-height);
    z-index: 1000;
}

.agenda-table thead th {
    padding: 13px 10px;
    background: #fff;
    color: var(--io-blue);
    border-bottom: 2px solid #edf0f4;
    box-shadow: 0 3px 7px rgba(0, 35, 70, .04);
    font-size: .76rem;
    font-weight: 850;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .025em;
}

.agenda-table thead th:first-child {
    border-radius: 12px 0 0 0;
}

.agenda-table thead th:last-child {
    border-radius: 0 12px 0 0;
}

.agenda-fecha-head {
    width: 104px;
    position: relative;
}

.agenda-fecha-head::after,
.agenda-col-head::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -7px;
    width: 27px;
    height: 3px;
    border-radius: 99px;
    background: var(--io-orange);
}

.agenda-table thead th:nth-child(n+3) {
    width: calc((100% - 104px) / 4);
}

.agenda-col-head {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.agenda-section-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 50%;
    background: var(--section-color);
    border: 1px solid rgba(0, 0, 0, .12);
}

/* ---------- Filas ---------- */
.agenda-table tbody td {
    vertical-align: top;
    border-bottom: 1px solid #edf0f4;
}

.agenda-table tbody tr:nth-child(odd) td {
    background: #fbfcfd;
}

.agenda-table tbody tr:last-child td {
    border-bottom: 0;
}

.agenda-dia-semana {
    width: 40px;
    padding: 16px 4px 12px 10px;
    color: var(--io-blue);
    font-size: .72rem;
    font-weight: 800;
    text-align: center;
}

.agenda-fecha {
    width: 64px;
    padding: 13px 9px 12px 3px;
    text-align: center;
}

.agenda-num {
    display: block;
    color: var(--io-blue);
    font-size: 1rem;
    font-weight: 900;
    line-height: 1.1;
}

.agenda-mes {
    display: block;
    margin-top: 3px;
    color: var(--io-muted);
    font-size: .67rem;
    font-weight: 750;
    text-transform: uppercase;
}

.agenda-cell {
    padding: 11px 10px;
}

/* ---------- Tarjeta por evento ---------- */
.agenda-event-card {
    margin: 0 0 12px;
    padding: 11px 12px;
    background: #fff;
    border: 1px solid #e6eaf0;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 35, 70, .055);
}

.agenda-event-card:last-child {
    margin-bottom: 0;
}

.agenda-event-card-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}

.agenda-event-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 50%;
    border: 1px solid transparent;
}

.agenda-event-area {
    color: #5d6876;
    font-size: .61rem;
    font-weight: 850;
    letter-spacing: .025em;
    text-transform: uppercase;
}

.agenda-event-title {
    color: #17206b;
    font-size: .79rem;
    font-weight: 800;
    line-height: 1.34;
    overflow-wrap: anywhere;
}

.agenda-event-meta {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    margin-top: 6px;
    color: #526173;
    font-size: .68rem;
    line-height: 1.28;
}

.agenda-event-meta i {
    color: var(--io-blue);
    line-height: 1.15;
}

.agenda-event-location {
    color: #44586c;
}

/* Días vacíos: visibles y discretos en escritorio */
.agenda-day-empty td {
    min-height: 42px;
    background: #fafbfc !important;
}

.agenda-day-empty .agenda-dia-semana,
.agenda-day-empty .agenda-num,
.agenda-day-empty .agenda-mes {
    opacity: .52;
}

/* ==========================================================
   MODAL GUÍA DE COLORES
   ========================================================== */
.agenda-modal {
    border: 0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 55px rgba(0, 32, 67, .2);
}

.agenda-modal-header {
    padding: 18px 20px;
    background: var(--io-blue);
    color: #fff;
    border: 0;
}

.agenda-modal-kicker {
    display: block;
    margin-bottom: 3px;
    color: rgba(255, 255, 255, .72);
    font-size: .6rem;
    font-weight: 800;
    letter-spacing: .12em;
}

.agenda-modal .modal-title {
    font-size: 1.05rem;
    font-weight: 800;
}

.agenda-modal-intro {
    margin-bottom: 15px;
    color: var(--io-muted);
    font-size: .78rem;
}

.agenda-color-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 18px;
}

.agenda-color-item {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    padding: 7px 0;
    color: #394455;
    font-size: .78rem;
    font-weight: 700;
}

.agenda-color-swatch {
    width: 13px;
    height: 13px;
    flex: 0 0 13px;
    border-radius: 4px;
    border: 1px solid transparent;
}

/* ==========================================================
   TABLET
   ========================================================== */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .agenda-container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .agenda-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .agenda-table {
        min-width: 1080px;
    }

    .agenda-event-card {
        padding: 9px 10px;
    }
}

/* ==========================================================
   MOBILE-FIRST
   ========================================================== */
@media (max-width: 767.98px) {
    :root {
        --agenda-header-height: 56px;
    }

    .agenda-header-inner {
        min-height: var(--agenda-header-height);
    }

    .agenda-logo {
        height: 33px;
    }

    .agenda-kicker {
        display: none;
    }

    .agenda-title {
        font-size: .98rem;
    }

    .agenda-title::after {
        bottom: -5px;
        width: 30px;
        height: 2px;
    }

    .agenda-page {
        padding-top: 8px;
    }

    .agenda-container {
        padding-left: 8px;
        padding-right: 8px;
    }

    .agenda-toolbar {
        margin-bottom: 8px;
        padding: 0 3px;
    }

    .agenda-toolbar-copy {
        display: block;
        font-size: .71rem;
        line-height: 1.2;
    }

    .agenda-toolbar-eyebrow {
        display: block;
        margin-bottom: 2px;
        font-size: .54rem;
    }

    .agenda-color-btn {
        min-width: 35px;
        justify-content: center;
        padding: 7px 9px;
    }

    .agenda-color-btn span {
        display: none;
    }

    /* Volvemos a la vista mobile-first de tarjetas por fecha */
    .agenda-table-wrap {
        overflow: visible !important;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .agenda-table,
    .agenda-table tbody,
    .agenda-table tr,
    .agenda-table td {
        display: block;
        width: 100% !important;
        max-width: 100%;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .agenda-table {
        table-layout: auto;
        background: transparent;
    }

    .agenda-table thead {
        display: none;
    }

    /* En móvil no mostramos días sin actividades */
    .agenda-table tbody tr.agenda-day-empty {
        display: none !important;
    }

    .agenda-table tbody tr.agenda-day-has-events {
        position: relative;
        margin: 0 0 12px;
        padding: 49px 8px 8px;
        background: #fff;
        border: 1px solid var(--io-line);
        border-radius: 12px;
        box-shadow: 0 3px 12px rgba(0, 35, 70, .06);
    }

    /* Encabezado de fecha de cada tarjeta */
    .agenda-dia-semana,
    .agenda-fecha {
        position: absolute;
        top: 0;
        min-height: 42px;
        background: var(--io-blue) !important;
        color: #fff !important;
        border: 0 !important;
    }

    .agenda-dia-semana {
        left: 0;
        width: 42px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0 !important;
        border-radius: 11px 0 0 0;
        font-size: .66rem;
    }

    .agenda-fecha {
        left: 42px;
        right: 0;
        width: auto !important;
        display: flex !important;
        align-items: center;
        gap: 6px;
        padding: 0 11px !important;
        border-radius: 0 11px 0 0;
        text-align: left;
    }

    .agenda-num,
    .agenda-mes {
        display: inline-block;
        margin: 0;
        color: #fff !important;
        opacity: 1 !important;
    }

    .agenda-num {
        font-size: 1rem;
    }

    .agenda-mes {
        font-size: .66rem;
    }

    /* Cada sección dentro del día */
    .agenda-cell {
        position: relative;
        min-height: 40px;
        margin: 0;
        padding: 9px 5px 9px 88px !important;
        background: #fff !important;
        border: 0 !important;
        border-bottom: 1px solid #eef1f4 !important;
    }

    .agenda-cell:last-child {
        border-bottom: 0 !important;
    }

    .agenda-cell:empty {
        display: none !important;
    }

    .agenda-cell::before {
        content: attr(data-section);
        position: absolute;
        left: 5px;
        top: 12px;
        width: 76px;
        color: #6e7885;
        font-size: .57rem;
        font-weight: 900;
        letter-spacing: .025em;
        text-transform: uppercase;
    }

    .agenda-event-card {
        margin-bottom: 10px;
        padding: 10px 11px;
        border-radius: 9px;
        box-shadow: 0 2px 7px rgba(0, 35, 70, .05);
    }

    .agenda-event-area {
        font-size: .56rem;
    }

    .agenda-event-title {
        font-size: .73rem;
        line-height: 1.32;
    }

    .agenda-event-meta {
        margin-top: 5px;
        font-size: .63rem;
    }

    /* Modal optimizado para teléfono */
    .agenda-modal .modal-body {
        padding: 14px;
    }

    .agenda-color-grid {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .agenda-color-item {
        padding: 6px 0;
        font-size: .72rem;
    }
}


/* ==========================================================
   Ajustes V5 - encabezado con acciones + periodo dinámico
   ========================================================== */

.agenda-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
}

.agenda-header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid #d7e0e9;
    border-radius: 8px;
    background: #fff;
    color: var(--io-blue);
    font-size: .72rem;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 2px 7px rgba(0, 35, 70, .04);
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.agenda-header-btn:not(:disabled):hover {
    background: #f6f9fc;
    border-color: #c6d3df;
    transform: translateY(-1px);
}

.agenda-header-btn i {
    font-size: .95rem;
}

.agenda-header-btn-secondary {
    background: var(--io-blue);
    border-color: var(--io-blue);
    color: #fff;
}

.agenda-header-btn:disabled {
    opacity: .48;
    cursor: not-allowed;
    box-shadow: none;
}

.agenda-toolbar-copy {
    flex-wrap: wrap;
}

.agenda-toolbar-end {
    color: var(--io-muted);
    font-size: .68rem;
    font-weight: 650;
}

@media (max-width: 767.98px) {
    .agenda-header-inner {
        gap: 8px;
    }

    .agenda-header-actions {
        gap: 5px;
    }

    .agenda-header-btn {
        width: 34px;
        height: 34px;
        min-height: 34px;
        padding: 0;
        border-radius: 8px;
    }

    .agenda-header-btn span {
        display: none;
    }

    .agenda-header-btn i {
        font-size: .95rem;
    }

    .agenda-toolbar-copy {
        display: flex;
        align-items: baseline;
        gap: 5px;
    }

    .agenda-toolbar-end {
        width: 100%;
        margin-top: 1px;
        font-size: .59rem;
    }
}