/*
 * Postiguet Calendar — FullCalendar Dark Theme
 * Matches the Postiguet design system variables
 */

/* ============================================================
   CALENDAR WRAPPER
   ============================================================ */
.postiguet-calendar-wrapper {
    margin: var(--spacing-lg) 0;
    min-height: 700px;
}

.postiguet-calendar-wrapper.calendar-mini {
    max-width: 100%;
    margin: var(--spacing-md) 0;
    min-height: 600px;
}

/* Force fixed height on FullCalendar root element */
#postiguet-calendar-mini,
#postiguet-calendar-full {
    min-height: 600px !important;
}

#postiguet-calendar-full {
    min-height: 800px !important;
}

/* Ensure the FC root element fills the container */
.fc {
    min-height: inherit;
}

/* Ensure the scroll grid fills the height */
.fc .fc-scrollgrid {
    min-height: inherit;
}

/* Month view: ensure day cells have minimum height */
.fc .fc-daygrid-day-frame {
    min-height: 80px;
}

/* List view: ensure minimum height when few events */
.fc .fc-list {
    min-height: 500px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.calendar-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--color-text);
    margin: 0;
}

.calendar-expand {
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.calendar-expand:hover {
    color: var(--color-secondary);
}

/* ============================================================
   FULLCALENDAR OVERRIDES — DARK THEME
   ============================================================ */

/* Base calendar background */
.fc {
    --fc-bg-color: var(--color-bg);
    --fc-border-color: var(--color-surface-high);
    --fc-today-bg-color: var(--color-surface-low);
    --fc-neutral-bg-color: var(--color-surface-low);
    --fc-page-bg-color: var(--color-bg);
    --fc-highlight-color: var(--color-surface-low);
    --fc-non-business-color: rgba(255, 255, 255, 0.03);
    --fc-event-bg-color: var(--color-surface-high);
    --fc-event-border-color: var(--color-primary);
    --fc-today-border-color: var(--color-primary);
}

/* Calendar container */
.fc .fc-scrollgrid {
    border-color: var(--color-surface-high);
}

.fc th {
    background: var(--color-surface-low);
    border-color: var(--color-surface-high) !important;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 10px 4px !important;
}

.fc td {
    border-color: var(--color-surface-high) !important;
    background: var(--color-bg);
}

.fc .fc-daygrid-day-number,
.fc .fc-col-header-cell-cushion {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 600;
}

.fc .fc-daygrid-day.fc-day-today {
    background: var(--color-surface-low);
}

.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
    background: var(--color-primary);
    color: var(--color-on-primary);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Header toolbar */
.fc .fc-toolbar {
    padding: var(--spacing-sm) var(--spacing-sm);
    margin-bottom: var(--spacing-sm) !important;
}

.fc .fc-toolbar-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--color-text);
    text-transform: capitalize;
}

.fc .fc-button {
    background: var(--color-surface-high) !important;
    border: 1px solid var(--color-surface-highest) !important;
    color: var(--color-text) !important;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 12px !important;
    border-radius: var(--border-radius-md) !important;
    text-transform: capitalize;
}

.fc .fc-button:hover {
    background: var(--color-surface-highest) !important;
    border-color: var(--color-primary) !important;
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    background: var(--gradient-gold) !important;
    color: var(--color-on-primary) !important;
    border-color: var(--color-primary) !important;
}

.fc .fc-button-primary:disabled {
    opacity: 0.4;
}

/* ============================================================
   CUSTOM EVENT RENDERING
   ============================================================ */

.fc-event-custom {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    font-size: 0.8rem;
    background: transparent;
    border: none;
    cursor: pointer;
}

.fc-event-custom .event-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-primary);
    flex-shrink: 0;
}

.fc-event-custom .event-time {
    color: var(--color-primary);
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.fc-event-custom .event-name {
    color: var(--color-text);
    font-weight: 600;
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fc-event-custom .event-artist {
    color: var(--color-text-muted);
    font-size: 0.7rem;
    flex-shrink: 0;
}

.fc-event-custom .event-price-badge {
    background: var(--gradient-gold);
    color: var(--color-on-primary);
    padding: 2px 6px;
    border-radius: 99px;
    font-size: 0.65rem;
    font-weight: 800;
    flex-shrink: 0;
    margin-left: auto;
}

/* More events link */
.fc .fc-daygrid-more-link {
    color: var(--color-primary);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 6px;
}

.fc .fc-daygrid-more-link:hover {
    background: var(--color-surface-highest);
    border-radius: var(--border-radius-md);
}

/* ============================================================
   LIST VIEW (MOBILE / MINI)
   ============================================================ */

.fc .fc-list {
    background: var(--color-bg);
    border-color: var(--color-surface-high);
}

.fc .fc-list-day-cushion {
    background: var(--color-surface-low);
    border-color: var(--color-surface-high);
}

.fc .fc-list-day .fc-list-day-text,
.fc .fc-list-day .fc-list-day-side-text {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 700;
}

.fc .fc-list-event {
    background: var(--color-surface-high);
    border-color: var(--color-surface-highest);
}

.fc .fc-list-event:hover {
    background: var(--color-surface-highest);
}

.fc .fc-list-event-title a {
    color: var(--color-text);
    text-decoration: none;
}

.fc .fc-list-event-time {
    color: var(--color-primary);
    font-weight: 700;
}

/* ============================================================
   EVENT POPOVER
   ============================================================ */

.postiguet-event-popover {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.postiguet-event-popover.visible {
    opacity: 1;
}

.postiguet-event-popover .popover-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 21, 37, 0.85);
    backdrop-filter: blur(8px);
}

.postiguet-event-popover .popover-content {
    position: relative;
    z-index: 1;
    background: var(--color-surface-low);
    border: 1px solid var(--color-surface-highest);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-md);
    max-width: 450px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.postiguet-event-popover.visible .popover-content {
    transform: scale(1);
}

.postiguet-event-popover .popover-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--color-surface-highest);
    border: none;
    color: var(--color-text);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.postiguet-event-popover .popover-close:hover {
    background: var(--color-primary);
    color: var(--color-on-primary);
}

.postiguet-event-popover .popover-flyer {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-sm);
}

.postiguet-event-popover .popover-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--color-text);
    margin: 0 0 var(--spacing-xs);
}

.postiguet-event-popover .popover-artist {
    color: var(--color-secondary);
    font-size: 1rem;
    margin: 0 0 var(--spacing-sm);
}

.postiguet-event-popover .popover-meta p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin: 4px 0;
}

.postiguet-event-popover .popover-excerpt {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
    margin: var(--spacing-sm) 0;
}

.postiguet-event-popover .btn-popover-detail {
    display: inline-block;
    background: var(--gradient-gold);
    color: var(--color-on-primary);
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 800;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.8rem;
    text-decoration: none;
    margin-top: var(--spacing-sm);
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.postiguet-event-popover .btn-popover-detail:hover {
    background: #fff;
    color: var(--color-bg);
}

/* ============================================================
   RESPONSIVE — MINI CALENDAR
   ============================================================ */

.calendar-mini .fc .fc-header-toolbar {
    padding: 0;
}

.calendar-mini .fc .fc-header-toolbar-title {
    font-size: 1rem;
}

.calendar-mini .fc .fc-button {
    padding: 8px 14px !important;
    font-size: 0.85rem;
}

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */

@media (max-width: 768px) {
    .fc .fc-toolbar {
        flex-direction: column;
        gap: var(--spacing-xs);
    }

    .fc .fc-toolbar-title {
        font-size: 1.1rem;
    }

    .postiguet-event-popover .popover-content {
        padding: var(--spacing-sm);
        max-width: 95%;
    }

    .postiguet-event-popover .popover-title {
        font-size: 1.2rem;
    }

    .fc-event-custom .event-artist {
        display: none;
    }
}
