/* =========================================================
   Enym WPBakery Calendar — Frontend Styles
   ========================================================= */

/* ---------------------------------------------------------
   Base / Shared
   --------------------------------------------------------- */
.enym-calendar {
    --enym-cal-badge: #3d5ff7;
    --enym-cal-today-bg: rgba(61, 95, 247, 0.08);
    --enym-cal-today-ring: #3d5ff7;
    --enym-cal-text: #1a1a2e;
    --enym-cal-muted: #8b8fa8;
    --enym-cal-border: #e4e6f0;
    --enym-cal-bg: #ffffff;
    --enym-cal-header-bg: #ffffff;
    --enym-cal-header-text: #1a1a2e;
    --enym-cal-radius: 12px;
    --enym-cal-cell-radius: 8px;
    --enym-cal-font: inherit;

    font-family: var(--enym-cal-font);
    color: var(--enym-cal-text);
    width: 100%;
    position: relative;
    box-sizing: border-box;
}

/* Override badge color via inline style on parent */
.enym-calendar .enym-cal-event-badge {
    background-color: var(--enym-cal-badge);
}

/* Header */
.enym-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--enym-cal-header-bg);
    border-bottom: 1px solid var(--enym-cal-border);
    border-radius: var(--enym-cal-radius) var(--enym-cal-radius) 0 0;
}

.enym-cal-month-label {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--enym-cal-header-text);
    letter-spacing: 0.02em;
}

.enym-cal-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--enym-cal-border);
    background: transparent;
    color: var(--enym-cal-text);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.enym-cal-nav:hover {
    background: var(--enym-cal-badge);
    color: #fff;
    border-color: var(--enym-cal-badge);
    text-decoration: none;
}

/* Grid */
.enym-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-left: 1px solid var(--enym-cal-border);
    border-bottom: 1px solid var(--enym-cal-border);
    background: var(--enym-cal-bg);
    border-radius: 0 0 var(--enym-cal-radius) var(--enym-cal-radius);
    overflow: hidden;
}

/* Weekday headers */
.enym-cal-weekday-header {
    padding: 8px 4px;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--enym-cal-muted);
    border-right: 1px solid var(--enym-cal-border);
    border-bottom: 1px solid var(--enym-cal-border);
    box-sizing: border-box;
}

/* Day cells */
.enym-cal-day {
    min-height: 90px;
    padding: 6px 6px 8px;
    border-right: 1px solid var(--enym-cal-border);
    border-bottom: 1px solid var(--enym-cal-border);
    box-sizing: border-box;
    position: relative;
    transition: background 0.15s;
    vertical-align: top;
}

.enym-cal-day--empty {
    background: rgba(0,0,0,0.015);
}

.enym-cal-day--today {
    background: var(--enym-cal-today-bg);
}

.enym-cal-day--today .enym-cal-day-number {
    background: var(--enym-cal-today-ring);
    color: #fff;
}

.enym-cal-day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--enym-cal-muted);
    margin-bottom: 4px;
    transition: background 0.2s, color 0.2s;
}

.enym-cal-day--has-events .enym-cal-day-number {
    color: var(--enym-cal-text);
}

/* Events */
.enym-cal-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Event badge */
.enym-cal-event-badge {
    display: block;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.15s;
    cursor: default;
    max-width: 100%;
    box-sizing: border-box;
}

a.enym-cal-event-badge {
    cursor: pointer;
}

a.enym-cal-event-badge:hover {
    opacity: 0.85;
    transform: translateY(-1px);
    text-decoration: none;
    color: #fff;
}

.enym-cal-badge--start {
    border-radius: 4px 0 0 4px;
    margin-right: -1px;
}

.enym-cal-badge--end {
    border-radius: 0 4px 4px 0;
    margin-left: -1px;
}

.enym-cal-badge--mid {
    border-radius: 0;
    margin-left: -1px;
    margin-right: -1px;
}

/* Loading overlay */
.enym-calendar.enym-cal-loading {
    pointer-events: none;
}

.enym-calendar.enym-cal-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.6);
    border-radius: var(--enym-cal-radius);
    z-index: 10;
}

/* Tooltip */
.enym-cal-tooltip {
    position: fixed;
    z-index: 999999;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, visibility 0.18s ease;
    transform: translateY(4px);
    max-width: 240px;
}

.enym-cal-tooltip.enym-cal-tooltip--visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.enym-cal-tooltip-inner {
    background: #1a1a2e;
    color: #fff;
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    font-size: 0.78rem;
    line-height: 1.5;
}

.enym-cal-tooltip-thumb img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 8px;
    display: block;
}

.enym-cal-tooltip-title {
    font-weight: 700;
    font-size: 0.82rem;
    margin-bottom: 4px;
}

.enym-cal-tooltip-excerpt {
    opacity: 0.75;
    font-size: 0.74rem;
}

/* ---------------------------------------------------------
   Style: Material
   --------------------------------------------------------- */
.enym-cal-style-material {
    --enym-cal-bg: #ffffff;
    --enym-cal-border: #e8eaf6;
    --enym-cal-radius: 14px;
    box-shadow: 0 4px 24px rgba(61,95,247,0.08), 0 1px 4px rgba(0,0,0,0.06);
    border-radius: var(--enym-cal-radius);
}

.enym-cal-style-material .enym-cal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom: none;
}

.enym-cal-style-material .enym-cal-month-label {
    color: #fff;
}

.enym-cal-style-material .enym-cal-nav {
    border-color: rgba(255,255,255,0.4);
    color: #fff;
    background: rgba(255,255,255,0.15);
}

.enym-cal-style-material .enym-cal-nav:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.6);
    color: #fff;
}

.enym-cal-style-material .enym-cal-day {
    min-height: 96px;
}

.enym-cal-style-material .enym-cal-day--today {
    background: #f0f2ff;
}

/* ---------------------------------------------------------
   Style: Flat
   --------------------------------------------------------- */
.enym-cal-style-flat {
    --enym-cal-bg: #f8f9fa;
    --enym-cal-border: transparent;
    --enym-cal-radius: 6px;
    border: none;
}

.enym-cal-style-flat .enym-cal-grid {
    border-left: none;
    border-bottom: none;
    gap: 3px;
    background: #f8f9fa;
}

.enym-cal-style-flat .enym-cal-weekday-header {
    border: none;
    background: transparent;
    color: #6c757d;
}

.enym-cal-style-flat .enym-cal-day {
    border: none;
    background: #ffffff;
    border-radius: 6px;
    min-height: 86px;
}

.enym-cal-style-flat .enym-cal-day--empty {
    background: transparent;
}

.enym-cal-style-flat .enym-cal-day--today {
    background: #e8edff;
}

.enym-cal-style-flat .enym-cal-header {
    border-radius: 6px;
    border: none;
    background: #fff;
    margin-bottom: 3px;
}

/* ---------------------------------------------------------
   Style: Modern (Glassmorphism / Dark-accent)
   --------------------------------------------------------- */
.enym-cal-style-modern {
    --enym-cal-bg: #0f0f23;
    --enym-cal-text: #e0e0ff;
    --enym-cal-muted: #6b6b9a;
    --enym-cal-border: rgba(255,255,255,0.08);
    --enym-cal-today-bg: rgba(61,95,247,0.2);
    --enym-cal-radius: 16px;
    background: #0f0f23;
    border-radius: var(--enym-cal-radius);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.enym-cal-style-modern .enym-cal-header {
    background: rgba(255,255,255,0.04);
    border-bottom-color: rgba(255,255,255,0.07);
}

.enym-cal-style-modern .enym-cal-month-label {
    color: #e0e0ff;
}

.enym-cal-style-modern .enym-cal-nav {
    border-color: rgba(255,255,255,0.15);
    color: #e0e0ff;
    background: rgba(255,255,255,0.05);
}

.enym-cal-style-modern .enym-cal-nav:hover {
    background: rgba(61,95,247,0.6);
    border-color: rgba(61,95,247,0.8);
    color: #fff;
}

.enym-cal-style-modern .enym-cal-grid {
    background: #0f0f23;
    border-color: rgba(255,255,255,0.06);
}

.enym-cal-style-modern .enym-cal-weekday-header {
    border-color: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.3);
}

.enym-cal-style-modern .enym-cal-day {
    border-color: rgba(255,255,255,0.05);
    min-height: 96px;
}

.enym-cal-style-modern .enym-cal-day--empty {
    background: rgba(0,0,0,0.2);
}

.enym-cal-style-modern .enym-cal-day--today {
    background: rgba(61,95,247,0.15);
}

.enym-cal-style-modern .enym-cal-day-number {
    color: rgba(255,255,255,0.35);
}

.enym-cal-style-modern .enym-cal-day--has-events .enym-cal-day-number {
    color: rgba(255,255,255,0.8);
}

.enym-cal-style-modern .enym-cal-day--today .enym-cal-day-number {
    background: #3d5ff7;
    color: #fff;
}

.enym-cal-style-modern .enym-cal-event-badge {
    box-shadow: 0 2px 8px rgba(61,95,247,0.4);
}

/* ---------------------------------------------------------
   Style: Raw (unstyled — inherit from theme)
   --------------------------------------------------------- */
.enym-cal-style-raw {
    --enym-cal-radius: 0;
    --enym-cal-border: currentColor;
}

.enym-cal-style-raw .enym-cal-header {
    border-radius: 0;
}

.enym-cal-style-raw .enym-cal-grid {
    border-radius: 0;
}

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */
@media (max-width: 600px) {
    .enym-cal-day {
        min-height: 50px;
        padding: 4px 3px;
    }

    .enym-cal-badge-label {
        display: none;
    }

    /* Show as colored dot on mobile */
    .enym-cal-event-badge {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        padding: 0;
        overflow: hidden;
        flex-shrink: 0;
        align-self: flex-start;
        margin: 1px 2px;
    }

    .enym-cal-events {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .enym-cal-month-label {
        font-size: 0.9rem;
    }

    .enym-cal-weekday-header {
        font-size: 0.6rem;
        padding: 6px 2px;
    }

    .enym-cal-day-number {
        width: 20px;
        height: 20px;
        font-size: 0.68rem;
    }
}
