/* ═══════════════════════════════════════════════════════════════════════════
   T4P Eventos — Calendar & Agenda Styles
   Brand: Poppins · #E60000 rojo · #060606 oscuro
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables ───────────────────────────────────────────────────────────── */

.t4p-calendar-wrap {
    --t4p-red:       #E60000;
    --t4p-red-dark:  #cc0000;
    --t4p-red-light: rgba(230, 0, 0, 0.08);
    --t4p-dark:      #060606;
    --t4p-dark-2:    #1e2433;
    --t4p-mid:       #374151;
    --t4p-muted:     #6b7280;
    --t4p-border:    #e5e7eb;
    --t4p-bg:        #f8fafc;
    --t4p-white:     #ffffff;
    --t4p-shadow:    0 2px 12px rgba(0, 0, 0, 0.08);
    --t4p-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.14);
    --t4p-radius:    10px;
    --t4p-font:      "Poppins", sans-serif;

    font-family: var(--t4p-font);
}

/* ── Toolbar (filtros + toggle) ──────────────────────────────────────────── */

.t4p-cal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

/* ── Filtros por tipo — soft gray chips ──────────────────────────────────── */

.t4p-cal-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.t4p-filter-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 7px 14px !important;
    border: none !important;
    border-radius: 999px !important;
    background: #f3f4f6 !important;
    color: var(--t4p-muted) !important;
    font-family: var(--t4p-font) !important;
    font-size: 0.76rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: background 0.15s, color 0.15s !important;
    line-height: 1 !important;
    box-shadow: none !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    text-decoration: none !important;
    outline: none !important;
}

.t4p-filter-btn:hover {
    background: #e5e7eb !important;
    color: var(--t4p-mid) !important;
}

.t4p-filter-btn.active {
    background: var(--t4p-dark) !important;
    color: var(--t4p-white) !important;
    font-weight: 600 !important;
}

/* Count: número muted entre paréntesis */
.t4p-filter-count {
    font-size: 0.7rem;
    font-weight: 400;
    color: inherit;
    opacity: 0.6;
}

.t4p-filter-count::before { content: "("; }
.t4p-filter-count::after  { content: ")"; }

/* Dots: solo visible en estado activo */
.t4p-tipo-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}

.t4p-filter-btn.active .t4p-tipo-dot {
    opacity: 0.7;
}

.t4p-tipo-dot--virtual    { background: #a5b4fc; }
.t4p-tipo-dot--presencial { background: #fca5a5; }

/* ── Toggle de vista — segmented control ─────────────────────────────────── */

.t4p-cal-toggle {
    display: flex;
    gap: 2px;
    background: #f3f4f6;
    border-radius: 999px;
    padding: 3px;
    border-bottom: none;
}

.t4p-cal-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 7px 14px !important;
    border: none !important;
    border-bottom: none !important;
    margin-bottom: 0 !important;
    border-radius: 999px !important;
    background: transparent !important;
    color: #9ca3af !important;
    font-family: var(--t4p-font) !important;
    font-size: 0.78rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s !important;
    line-height: 1 !important;
    box-shadow: none !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    outline: none !important;
}

.t4p-cal-btn svg {
    flex-shrink: 0;
}

.t4p-cal-btn:hover {
    color: var(--t4p-mid) !important;
    background: rgba(255, 255, 255, 0.55) !important;
}

.t4p-cal-btn.active {
    background: var(--t4p-white) !important;
    color: var(--t4p-dark) !important;
    font-weight: 700 !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.10) !important;
}

/* ── Membership notice ───────────────────────────────────────────────────── */

.t4p-membership-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 20px;
    background: #f8f6ff;
    border: 1px solid #e0d9f7;
    border-left: 3px solid #1e2433;
    border-radius: 8px;
    font-family: var(--t4p-font);
    font-size: 0.78rem;
    color: #374151;
    line-height: 1.4;
}

.t4p-membership-notice svg {
    flex-shrink: 0;
    color: #1e2433;
    opacity: 0.8;
}

.t4p-membership-notice strong {
    color: #1e2433;
    font-weight: 700;
}

/* ── View visibility ─────────────────────────────────────────────────────── */

.t4p-view {
    display: none;
    animation: t4pFadeIn 0.22s ease;
}

.t4p-view.active {
    display: block;
}

@keyframes t4pFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── FullCalendar overrides ──────────────────────────────────────────────── */

.t4p-view--calendar {
    border-radius: var(--t4p-radius);
    overflow: hidden;
    box-shadow: var(--t4p-shadow);
    border: 1px solid var(--t4p-border);
}

/* Toolbar oscuro de marca */
.t4p-view--calendar .fc .fc-toolbar {
    background: var(--t4p-dark);
    padding: 14px 20px;
    margin-bottom: 0;
    flex-wrap: wrap;
    gap: 8px;
}

/* Gap entre grupos de botones dentro de cada chunk */
.t4p-view--calendar .fc .fc-toolbar-chunk {
    display: flex;
    align-items: center;
    gap: 6px;
}

.t4p-view--calendar .fc .fc-toolbar-title {
    color: var(--t4p-white);
    font-family: var(--t4p-font);
    font-size: 1.05rem;
    font-weight: 700;
    text-transform: capitalize;
}

/* Botones de navegación */
.t4p-view--calendar .fc .fc-button-primary {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    border-radius: 6px !important;
    font-family: var(--t4p-font) !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    padding: 5px 12px !important;
    transition: background 0.15s !important;
}

.t4p-view--calendar .fc .fc-button-primary:hover {
    background-color: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

.t4p-view--calendar .fc .fc-button-primary:not(:disabled).fc-button-active,
.t4p-view--calendar .fc .fc-button-primary:not(:disabled):active {
    background-color: var(--t4p-red) !important;
    border-color: var(--t4p-red-dark) !important;
}

/* Des-juntar button groups: gap entre < > y entre Mes / Lista */
.t4p-view--calendar .fc .fc-button-group {
    display: inline-flex !important;
    gap: 4px !important;
}

.t4p-view--calendar .fc .fc-button-group .fc-button {
    border-radius: 6px !important;
    margin-left: 0 !important;
}

/* Today button */
.t4p-view--calendar .fc .fc-today-button {
    background-color: var(--t4p-red) !important;
    border-color: var(--t4p-red-dark) !important;
    color: #fff !important;
    font-weight: 700 !important;
}

.t4p-view--calendar .fc .fc-today-button:hover {
    background-color: var(--t4p-red-dark) !important;
}

.t4p-view--calendar .fc .fc-today-button:disabled {
    background-color: rgba(255,255,255,0.15) !important;
    border-color: transparent !important;
    opacity: 0.5 !important;
}

/* Grid */
.t4p-view--calendar .fc .fc-daygrid-body {
    background: var(--t4p-white);
}

.t4p-view--calendar .fc .fc-col-header-cell {
    background: var(--t4p-bg);
    font-family: var(--t4p-font);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--t4p-muted);
    padding: 10px 0;
}

.t4p-view--calendar .fc .fc-daygrid-day-number {
    font-family: var(--t4p-font);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--t4p-mid);
    padding: 6px 8px;
}

.t4p-view--calendar .fc .fc-day-today {
    background: var(--t4p-red-light) !important;
}

.t4p-view--calendar .fc .fc-day-today .fc-daygrid-day-number {
    color: var(--t4p-red);
    font-weight: 700;
}

/* Events */
.t4p-view--calendar .fc .fc-event {
    border: none !important;
    border-radius: 4px !important;
    font-family: var(--t4p-font) !important;
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    padding: 2px 6px !important;
    cursor: pointer !important;
    transition: opacity 0.15s, transform 0.15s !important;
}

.t4p-view--calendar .fc .fc-event:hover {
    opacity: 0.85 !important;
    transform: translateY(-1px) !important;
}

.t4p-view--calendar .fc .fc-more-link {
    font-family: var(--t4p-font);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--t4p-red);
}

/* List view */
.t4p-view--calendar .fc .fc-list {
    border: none;
}

.t4p-view--calendar .fc .fc-list-day-cushion {
    background: var(--t4p-bg);
    font-family: var(--t4p-font);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: capitalize;
}

.t4p-view--calendar .fc .fc-list-event:hover td {
    background: var(--t4p-red-light);
}

.t4p-view--calendar .fc .fc-list-event-title a {
    font-family: var(--t4p-font);
    font-weight: 600;
    color: var(--t4p-dark);
}

/* ── Agenda view ─────────────────────────────────────────────────────────── */

.t4p-view--agenda {
    padding: 4px 0;
}

.t4p-agenda-month {
    margin-bottom: 40px;
}

.t4p-agenda-month__header {
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--t4p-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.t4p-agenda-month__label {
    font-family: var(--t4p-font);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--t4p-dark);
    margin: 0;
}

/* Evento card */
.t4p-agenda-event {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}

/* Animación solo al filtrar (clase añadida por JS), no en page load */
.t4p-agenda-event.t4p-filtered {
    animation: t4pFadeIn 0.2s ease;
}

/* Columna fecha */
.t4p-agenda-event__date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    width: 52px;
    background: #2d2d2d;
    color: var(--t4p-white);
    border-radius: 8px;
    padding: 10px 8px;
    flex-shrink: 0;
}

.t4p-adate-day {
    display: block;
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1;
}

.t4p-adate-mon {
    display: block;
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.7;
    margin-top: 2px;
}

/* Card */
.t4p-agenda-event__card {
    flex: 1;
    display: flex;
    background: var(--t4p-white);
    border: 1px solid var(--t4p-border);
    border-radius: var(--t4p-radius);
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    min-width: 0;
}

.t4p-agenda-event__card:hover {
    box-shadow: var(--t4p-shadow);
    border-color: #d1d5db;
}

/* Thumbnail dentro de la card */
.t4p-agenda-event__thumb {
    width: 90px;
    min-width: 90px;
    overflow: hidden;
    flex-shrink: 0;
}

.t4p-agenda-event__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}

.t4p-agenda-event__card:hover .t4p-agenda-event__thumb img {
    transform: scale(1.04);
}

/* Contenido de la card */
.t4p-agenda-event__content {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.t4p-agenda-event__top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.t4p-agenda-event__title {
    font-family: var(--t4p-font);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--t4p-dark);
    text-decoration: none;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.15s;
    cursor: pointer;
}

.t4p-agenda-event__card:hover .t4p-agenda-event__title {
    color: var(--t4p-red);
}

.t4p-agenda-event__title--blocked {
    opacity: 0.55;
    text-decoration: line-through;
    pointer-events: none;
}

.t4p-agenda-event__ponente {
    font-size: 0.75rem;
    color: var(--t4p-muted);
    font-weight: 500;
}

.t4p-agenda-event__cta {
    display: inline-block;
    margin-top: 9px;
    font-family: var(--t4p-font);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--t4p-muted);
    text-decoration: none;
    background-image: linear-gradient(var(--t4p-dark), var(--t4p-dark));
    background-size: 0% 1.5px;
    background-position: left bottom;
    background-repeat: no-repeat;
    transition: background-size 0.2s ease, color 0.2s ease;
    position: relative;
    z-index: 1;
}

.t4p-agenda-event__cta:hover {
    color: var(--t4p-dark);
    background-size: 100% 1.5px;
}

/* Badge dentro de la agenda (override de frontend.css) */
.t4p-agenda-event__top .t4p-badge {
    font-size: 0.6rem;
}

/* Duración del evento — hereda tamaño de t4p-badge, solo override de color */
.t4p-agenda-event__duracion {
    background: #f3f4f6 !important;
    color: var(--t4p-muted) !important;
}

.t4p-agenda-event__duracion::before {
    display: none !important;
}

/* Badge Miembros Select */
.t4p-badge--select {
    background-color: #1e2433;
    color: #fff;
}

.t4p-badge--select::before {
    background-color: #fbbf24;
}

/* Badge agotado */
.t4p-badge--agotado {
    background-color: var(--t4p-muted);
    color: #fff;
}

.t4p-badge--agotado::before {
    background-color: #fff;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */

.t4p-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--t4p-muted);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
}

.t4p-empty-state p {
    margin: 0;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */

.t4p-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.t4p-modal.active {
    pointer-events: auto;
    opacity: 1;
}

.t4p-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 20, 0.72);
    backdrop-filter: blur(3px);
}

.t4p-modal__box {
    position: relative;
    z-index: 1;
    background: var(--t4p-white);
    border-radius: 14px;
    width: 100%;
    max-width: 480px;
    overflow: hidden;
    box-shadow: var(--t4p-shadow-lg);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s ease;
    opacity: 0;
    max-height: 90vh;
    overflow-y: auto;
}

.t4p-modal.active .t4p-modal__box {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.t4p-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 10;
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    border: none !important;
    background: transparent !important;
    background-color: transparent !important;
    color: #9ca3af !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: color 0.15s !important;
    padding: 0 !important;
    box-shadow: none !important;
}

.t4p-modal__close:hover {
    background: transparent !important;
    background-color: transparent !important;
    color: var(--t4p-dark) !important;
}

.t4p-modal__img {
    display: none;
}

/* Contenedor de badges en modal */
.t4p-modal__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* Badge en modal — tamaño controlado */
.t4p-modal__body .t4p-badge {
    display: inline-flex;
    align-self: flex-start;
    font-size: 0.68rem !important;
}

/* Body del modal */
.t4p-modal__body {
    padding: 28px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.t4p-modal__title {
    font-family: var(--t4p-font);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--t4p-dark);
    margin: 0;
    line-height: 1.3;
}

.t4p-modal__date {
    font-family: var(--t4p-font);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--t4p-muted);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.t4p-modal__date::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    flex-shrink: 0;
    opacity: 0.7;
}

.t4p-modal__desc {
    font-family: var(--t4p-font);
    font-size: 0.875rem;
    color: #4b5563;
    line-height: 1.6;
    margin: 0;
}

/* Ponente en modal */
.t4p-modal__ponente {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--t4p-bg);
    border-radius: 8px;
    border: 1px solid var(--t4p-border);
}

.t4p-modal__ponente-foto {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--t4p-border);
}

.t4p-modal__ponente-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.t4p-modal__ponente-nombre {
    font-family: var(--t4p-font);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--t4p-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.t4p-modal__ponente-cargo {
    font-family: var(--t4p-font);
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--t4p-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* CTA del modal — mismas dimensiones que .t4p-cta */
.t4p-modal__cta {
    display: block;
    text-align: center;
    background: var(--t4p-red);
    color: #fff;
    font-family: var(--t4p-font);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 16px 32px;
    border-radius: 9px;
    text-decoration: none;
    transition: background 0.3s, transform 0.15s;
    margin-top: 4px;
    border: 1px solid var(--t4p-red);
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    line-height: 1;
}

.t4p-modal__cta:hover {
    background: var(--t4p-red-dark);
    border-color: var(--t4p-red-dark);
    color: #fff;
}

.t4p-modal__cta--disabled {
    background: var(--t4p-muted);
    border-color: var(--t4p-muted);
    cursor: not-allowed;
    pointer-events: none;
}

/* Bloquea scroll del body cuando modal está abierto */
body.t4p-modal-open {
    overflow: hidden;
}

/* ── Responsive — Tablet (768–1024px) ────────────────────────────────────── */

@media (min-width: 768px) and (max-width: 1024px) {
    .t4p-cal-toolbar {
        gap: 10px;
    }

    .t4p-view--calendar .fc .fc-toolbar {
        padding: 12px 16px;
    }

    .t4p-view--calendar .fc .fc-toolbar-title {
        font-size: 0.95rem;
    }

    .t4p-modal__box {
        max-width: 560px;
    }
}

/* ── Responsive — Mobile (<768px) ────────────────────────────────────────── */

@media (max-width: 767px) {
    .t4p-cal-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .t4p-cal-filters {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .t4p-filter-btn {
        justify-content: center !important;
        padding: 8px 10px !important;
    }

    .t4p-cal-toggle {
        align-self: flex-end;
    }

    .t4p-agenda-event {
        gap: 10px;
    }

    .t4p-agenda-event__date {
        min-width: 44px;
        width: 44px;
    }

    .t4p-adate-day {
        font-size: 1.15rem;
    }

    .t4p-agenda-event__thumb {
        display: none;
    }

    .t4p-modal__box {
        max-height: 95vh;
    }

    .t4p-modal__body {
        padding: 16px 18px 20px;
    }
}

/* ── Reduced motion ─────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .t4p-modal,
    .t4p-modal__box,
    .t4p-filter-btn,
    .t4p-cal-btn,
    .t4p-agenda-event__card,
    .t4p-agenda-event__thumb img,
    .t4p-agenda-event__title,
    .t4p-view,
    .t4p-modal__cta {
        transition: none !important;
        animation: none !important;
    }
}

/* ── Responsive — Small mobile (<420px) ──────────────────────────────────── */

@media (max-width: 420px) {
    .t4p-cal-filters {
        gap: 5px;
    }

    .t4p-filter-btn {
        font-size: 0.7rem !important;
        padding: 7px 8px !important;
    }

    .t4p-cal-btn {
        font-size: 0.72rem !important;
        padding: 6px 10px !important;
    }

    .t4p-view--calendar .fc .fc-toolbar {
        padding: 10px 12px;
    }

    .t4p-view--calendar .fc .fc-toolbar-title {
        font-size: 0.85rem;
    }

    .t4p-view--calendar .fc .fc-button-primary {
        padding: 4px 8px !important;
        font-size: 0.72rem !important;
    }
}
