/**
 * CertFlow Public Booking Calendar Styles
 *
 * Custom calendar widget for the [certflow_booking] shortcode.
 * Separate from public.css — loaded conditionally when view=calendar.
 */

/* ============================================================
   Variables
   ============================================================ */
:root {
    --cfcal-primary: #6366f1;
    --cfcal-primary-light: #eef2ff;
    --cfcal-text: #111827;
    --cfcal-text-muted: #6b7280;
    --cfcal-border: #e5e7eb;
    --cfcal-bg: #ffffff;
    --cfcal-bg-muted: #f9fafb;
    --cfcal-green: #059669;
    --cfcal-green-bg: #ecfdf5;
    --cfcal-orange: #d97706;
    --cfcal-orange-bg: #fffbeb;
    --cfcal-red: #dc2626;
    --cfcal-red-bg: #fef2f2;
    --cfcal-radius: 8px;
    --cfcal-radius-sm: 4px;
}

/* ============================================================
   Calendar Container
   ============================================================ */
.certflow-booking-calendar {
    margin-bottom: 24px;
    background: var(--cfcal-bg);
    border: 1px solid var(--cfcal-border);
    border-radius: var(--cfcal-radius);
    overflow: hidden;
}

.cfcal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--cfcal-border);
}

.cfcal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--cfcal-text);
    margin: 0;
}

.cfcal-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--cfcal-border);
    border-radius: var(--cfcal-radius);
    background: var(--cfcal-bg);
    color: var(--cfcal-text-muted);
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.cfcal-nav-btn:hover {
    background: var(--cfcal-bg-muted);
    color: var(--cfcal-text);
    border-color: var(--cfcal-text-muted);
}

.cfcal-nav-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Day-of-week headers */
.cfcal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--cfcal-border);
}

.cfcal-weekday {
    padding: 10px 4px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--cfcal-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Day Grid */
.cfcal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.cfcal-day {
    min-height: 90px;
    padding: 6px;
    border-right: 1px solid var(--cfcal-border);
    border-bottom: 1px solid var(--cfcal-border);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.cfcal-day:nth-child(7n) {
    border-right: none;
}

.cfcal-day:hover {
    background: var(--cfcal-bg-muted);
}

.cfcal-day.cfcal-day-outside {
    background: var(--cfcal-bg-muted);
    opacity: 0.5;
    cursor: default;
}

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

.cfcal-day.cfcal-day-selected {
    background: var(--cfcal-primary-light);
}

.cfcal-day.cfcal-day-has-events {
    background: rgba(249, 250, 251, 0.5);
}

.cfcal-day-number {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--cfcal-text);
    margin-bottom: 4px;
    padding: 2px;
}

.cfcal-day-outside .cfcal-day-number {
    color: var(--cfcal-text-muted);
}

/* Event blocks */
.cfcal-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cfcal-event {
    padding: 2px 6px;
    border-radius: var(--cfcal-radius-sm);
    font-size: 11px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    font-weight: 500;
    transition: opacity 0.15s;
}

.cfcal-event:hover {
    opacity: 0.85;
}

.cfcal-event-available {
    background: var(--cfcal-green-bg);
    color: var(--cfcal-green);
    border-left: 3px solid var(--cfcal-green);
}

.cfcal-event-low {
    background: var(--cfcal-orange-bg);
    color: var(--cfcal-orange);
    border-left: 3px solid var(--cfcal-orange);
}

.cfcal-event-full {
    background: var(--cfcal-red-bg);
    color: var(--cfcal-red);
    border-left: 3px solid var(--cfcal-red);
}

.cfcal-more {
    padding: 2px 6px;
    font-size: 11px;
    color: var(--cfcal-primary);
    cursor: pointer;
    font-weight: 500;
}

.cfcal-more:hover {
    text-decoration: underline;
}

/* ============================================================
   Tooltip
   ============================================================ */
.cfcal-tooltip {
    position: fixed;
    z-index: 10000;
    background: #1d2327;
    color: #fff;
    padding: 10px 14px;
    border-radius: var(--cfcal-radius);
    font-size: 13px;
    line-height: 1.5;
    max-width: 280px;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: opacity 0.15s;
}

.cfcal-tooltip.cfcal-tooltip-visible {
    opacity: 1;
}

.cfcal-tooltip-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.cfcal-tooltip-row {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
}

.cfcal-tooltip-row strong {
    color: #fff;
}

/* ============================================================
   Mobile Compact Calendar (<768px)
   ============================================================ */
@media (max-width: 767px) {
    .cfcal-day {
        min-height: 44px;
        padding: 4px;
    }

    .cfcal-day-number {
        font-size: 12px;
        text-align: center;
    }

    /* Hide event titles — show dots */
    .cfcal-events {
        flex-direction: row;
        justify-content: center;
        gap: 3px;
        flex-wrap: wrap;
    }

    .cfcal-event {
        width: 6px;
        height: 6px;
        min-width: 6px;
        padding: 0;
        border-radius: 50%;
        font-size: 0;
        overflow: hidden;
        text-indent: -9999px;
        border-left: none;
    }

    .cfcal-event-available { background: var(--cfcal-green); }
    .cfcal-event-low { background: var(--cfcal-orange); }
    .cfcal-event-full { background: var(--cfcal-red); }

    .cfcal-more {
        font-size: 9px;
        padding: 0;
    }

    .cfcal-tooltip {
        display: none !important;
    }

    .cfcal-header { padding: 12px 16px; }
    .cfcal-title { font-size: 16px; }
}

@media (min-width: 768px) and (max-width: 991px) {
    .cfcal-day { min-height: 70px; }
    .cfcal-event { font-size: 10px; }
}
