/* =========================================================
   Adventure Park Calendar — Frontend Styles
   Usa le CSS variables di Elementor quando disponibili,
   con fallback sensati per siti non-Elementor.
   ========================================================= */

.apc-calendar-widget,
.apc-tabs-wrap {
    /* Font: prende quello di Elementor, fallback system */
    --apc-font:         var(--e-global-typography-primary-font-family,
                            var(--e-global-typography-text-font-family,
                            inherit));
    --apc-font-text:         var(--e-global-typography-text-font-family,
                            inherit);

    /* Colori Elementor → variabili interne */
    --apc-primary:      var(--e-global-color-primary,       #2c7a2c);
    --apc-secondary:    var(--e-global-color-secondary,     #1a4d1a);
    --apc-accent:       var(--e-global-color-accent,        #4caf50);
    --apc-text:         var(--e-global-color-text,          #1d2327);
    --apc-link:         var(--e-global-color-accent,        #4caf50);

    /* Colori interni derivati */
    --apc-open-bg:      #eff5e6;
    --apc-open-border:  #92a673;
    --apc-today:        #2c2825;
    --apc-special:      #f59e0b;
    --apc-muted:        #6b7280;
    --apc-surface:      #f8f9fa;
    --apc-border:       #e5e7eb;
    --apc-radius:       10px;
    --apc-shadow:       0 2px 16px rgba(0,0,0,.08);
}

/* Fallback per browser senza color-mix */
@supports not (color: color-mix(in srgb, red, blue)) {
    .apc-calendar-widget,
    .apc-tabs-wrap {
        --apc-open-bg:     rgba(76,175,80,.12);
        --apc-open-border: rgba(76,175,80,.35);
    }
}

/* ── Tabs ──────────────────────────────────────── */
.apc-tabs-wrap { font-family: var(--apc-font); }

.apc-tabs-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.apc-tab-btn {
    padding: 8px 20px;
    border: 2px solid var(--apc-border);
    border-radius: 30px;
    background: transparent;
    color: var(--apc-muted);
    font-size: 14px;
    font-family: var(--apc-font);
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}
.apc-tab-btn:hover,
.apc-tab-btn.apc-tab-active {
    background: var(--apc-primary);
    border-color: var(--apc-primary);
    color: #fff;
}

.apc-park-panel { display: none; }
.apc-park-panel.apc-park-active { display: block; }

/* ── Widget wrapper ────────────────────────────── */
.apc-calendar-widget {
    font-family: var(--apc-font);
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Header ─────────────────────────────────────── */
.apc-header {
    background: var(--apc-primary);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 12px;
    border-radius: var(--apc-radius) var(--apc-radius) 0 0;
}

.apc-month-label {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .3px;
    font-family: var(--apc-font);
}

.apc-nav-btn {
    background: rgba(255,255,255,.18);
    border: none;
    color: #fff;
    font-size: 22px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}
.apc-nav-btn:hover { background: rgba(255,255,255,.32); }

/* ── Body: calendario + pannello info ──────────── */
.apc-body {
    display: flex;
    flex-direction: row;
    border: 1px solid var(--apc-border);
    border-top: none;
    border-radius: 0 0 var(--apc-radius) var(--apc-radius);
    overflow: hidden;
    background: #fff;
}

/* ── Calendar column ───────────────────────────── */
.apc-calendar {
    flex: 1;
    padding: 16px;
    min-width: 0;
}

.apc-dow-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 4px;
}
.apc-dow-cell {
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--apc-muted);
    text-transform: none;
    letter-spacing: 0;
    padding: 6px 2px;
    font-family: var(--apc-text);
}

.apc-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.apc-day {
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s, transform .1s, box-shadow .1s;
    border: 1.5px solid transparent;
    position: relative;
    user-select: none;
    font-family: var(--apc-font);
    gap: 0;
    line-height: 1;
}

.apc-day.apc-empty {
    cursor: default;
    pointer-events: none;
    background: transparent;
    border-color: transparent;
}

/* Giorno chiuso */
.apc-day.apc-closed {
    color: var(--apc-muted);
    background: var(--apc-surface);
    border-color: transparent;
}
.apc-day.apc-closed:hover {
    background: #f0f0f0;
    color: var(--apc-text);
}

/* Giorno aperto */
.apc-day.apc-open {
    background: var(--apc-open-bg);
    color: var(--apc-primary);
    border-color: var(--apc-open-border);
    font-weight: 700;
}
.apc-day.apc-open:hover {
    background: var(--apc-primary);
    color: #fff;
    border-color: var(--apc-primary);
    transform: scale(1.06);
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

/* Stella data speciale */
.apc-day.apc-special::after {
    content: '★';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 8px;
    color: #2c2825;
    font-size: 14px;
    line-height: 1;
}
.apc-day.apc-open.apc-special::after {
    color: var(--apc-special);
}

/* Oggi */
.apc-day.apc-today {
    box-shadow: inset 0 0 0 2px var(--apc-today) !important;
}

/* Selezionato */
.apc-day.apc-selected {
    box-shadow: inset 0 0 0 2px var(--apc-primary) !important;
    border-color: var(--apc-primary);
    transform: scale(1.08);
    z-index: 1;
}
.apc-day.apc-open.apc-selected {
    background: var(--apc-primary);
    color: #fff;
}

/* ── Info panel — a DESTRA del calendario ──────── */
.apc-info-panel {
    width: 350px;
    min-width: 350px;
    flex-shrink: 0;
    border-left: 1px solid var(--apc-border);
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #fff;
}

/* ── Contenuto pannello info ───────────────────── */
.apc-info-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 10px;
    text-align: center;
    color: var(--apc-muted);
    font-size: 13px;
    font-style: italic;
    font-family: var(--apc-font);
    opacity: .6;
    padding: 20px 0;
}
.apc-info-placeholder-icon {
    font-size: 36px;
    opacity: .4;
}

/* Blocco info giorno */
.apc-info-day {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: var(--apc-font);
}

.apc-info-dayname {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--apc-muted);
    font-family: var(--apc-font-text);
}

.apc-info-date-num {
    font-size: 22px;
    font-weight: 700;
    color: var(--apc-primary);
    line-height: 1;
    margin-top: 2px;
}

.apc-info-month-year {
    font-size: 13px;
    color: var(--apc-muted);
    margin-top: 1px;
}

.apc-info-divider {
    height: 1px;
    background: var(--apc-border);
    margin: 20px 0;
}

.apc-info-status-open {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--apc-primary);
    margin-bottom: 10px;
}
.apc-info-status-open:before {
    content: '';
    width: 10px;
    height: 10px;
    background-color: #77b255;
    border-radius: 10px;
}

.apc-info-status-closed {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--apc-primary);
}

.apc-info-status-closed:before {
    content: '';
    width: 10px;
    height: 10px;
    background-color: #dc2626;
    border-radius: 10px;
}

.apc-info-times {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 2px;
}
.apc-info-time-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.apc-info-time-label {
    font-size: 16px;
    color: var(--apc-muted);
    font-family: var(--apc-font-text);
}
.apc-info-time-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--apc-text);
    font-family: var(--apc-font);
    background: #fff;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid var(--apc-border);
}

.apc-info-note {
    margin-top: 4px;
    font-size: 16px;
    border-radius: 0 6px 6px 0;
    font-family: var(--apc-font-text);
    line-height: 1.4;
}
.apc-info-note::before {
    content: '★ ';
    color: var(--apc-special);
    font-size: 10px;
}

/* ── Loading / Error ────────────────────────────── */
.apc-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    color: var(--apc-muted);
    font-size: 13px;
    font-family: var(--apc-font);
}
.apc-spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--apc-border);
    border-top-color: var(--apc-primary);
    border-radius: 50%;
    animation: apc-spin .7s linear infinite;
    flex-shrink: 0;
}
@keyframes apc-spin { to { transform: rotate(360deg); } }

.apc-error {
    padding: 20px;
    text-align: center;
    color: #dc2626;
    font-size: 13px;
    font-family: var(--apc-font);
}

/* ── MOBILE ─────────────────────────────────────── */
@media (max-width: 640px) {
    .apc-body {
        flex-direction: column;
    }
    .apc-info-panel {
        width: 100%;
        min-width: unset;
        border-left: none;
        border-top: 1px solid var(--apc-border);
        padding: 18px 16px;
    }
    .apc-calendar {
        padding: 12px;
    }
    .apc-month-label {
        font-size: 16px;
    }
    .apc-day {
        font-size: 12px;
    }
}

/* ── Pulsante acquisto biglietti ────────────────── */
.apc-ticket-btn {
    display: block;
    margin-top: 14px;
    padding: 15px 16px;
    background: #92a673;
    color: #fff !important;
    text-align: center;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 700;
    font-family: var(--apc-font-text);
    text-decoration: none !important;
    transition: background .15s, transform .1s;
    letter-spacing: .3px;
}
.apc-ticket-btn:hover {
    background: #000;
    color: #fff !important;
    text-decoration: none !important;
}
