/**
 * Calendar Widget - Shared CSS
 * Used by: calendars/view.blade.php, video-questionnaires/show_nuove_modifiche.blade.php
 */

/* STEP1 (Calendar + Slots) container */
.step1-wrap {
    display: flex;
    gap: 1rem;
    flex-wrap: nowrap;
    flex: 1;
    min-height: 0; /* Allow flex children to shrink below content size */
    overflow: hidden;
}

.calendar-box {
    flex: 0 0 auto; /* Don't grow, don't shrink, use content size */
    min-width: 200px;
    border-radius: 4px;
    padding: 0.5rem;
}

.slots-box {
    flex: 1 1 0px; /* Grow to fill remaining space */
    min-width: 200px;
    min-height: 0; /* Allow shrinking */
    border-radius: 4px;
    padding: 0.5rem;
    overflow-y: auto;
}

/* CALENDAR NAVIGATION */
.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.calendar-nav .icon-btn {
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
}

/* CALENDAR TABLE */
table.calendar-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
    font-size: 14px;
}

table.calendar-table thead th {
    background: transparent;
    padding: 0.5rem;
    color: #0017c2;
}

table.calendar-table td {
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    position: relative;
}

.selected-day {
    background: #0017c2 !important;
    transition: background-color 0.2s cubic-bezier(0.25, 0.1, 0.49, 0.9);
    color: white !important;
}

.disabled {
    color: #bbb;
    pointer-events: none;
    cursor: not-allowed !important;
}

.closed-day {
    color: #dc3545;
    text-decoration: line-through;
    pointer-events: none;
}

/* Days with available slots */
.has-slots {
    background-color: #e8f5e9;
    font-weight: bold;
    color: #2e7d32;
}

.has-slots:hover:not(.selected-day) {
    background-color: #c8e6c9;
}

/* Auto refresh indicator */
.auto-refresh-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #4caf50;
    color: white;
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.auto-refresh-indicator.active {
    opacity: 1;
}

/* SLOTS */
.slots-column {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 8px;
    row-gap: 0px;
    margin-bottom: 1rem;
}

.slot-btn {
    border: 1px solid #0017c2;
    color: #0017c2 !important;
    display: block;
    text-align: center;
    padding: 0.5rem;
    margin: 0.3rem 0;
    cursor: pointer;
    transition: background 0.3s;
    border-radius: 4px;
    background: white;
}

.slot-btn:hover {
    background: #0017c2;
    color: white !important;
}

.slot-btn.selected {
    background: #0017c2;
    color: white !important;
}

.slot-btn.disabled {
    border-color: #ccc;
    color: #ccc !important;
    cursor: not-allowed;
    text-decoration: line-through;
    display: none;
}

.slot-btn.disabled:hover {
    background: transparent;
    color: #ccc !important;
}

/* STATUS MESSAGES */
.loading-message {
    text-align: center;
    color: #666;
    padding: 2rem;
}

.error-message {
    text-align: center;
    color: #dc3545;
    padding: 1rem;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 1rem 0;
}

.no-slots-message {
    text-align: center;
    color: #666;
    padding: 2rem;
    font-style: italic;
}

/* CALENDAR TITLE */
.calendar-title {
    font-size: 20px;
    font-weight: 300;
    text-align: center;
    margin-bottom: 0.5rem;
}

.calendar-widget-container hr {
    border: none;
    border-bottom: 1px solid lightgray;
    margin-bottom: 1rem;
}

/* CONFIRM CONTAINER (for questionnaire mode) */
.confirm-container {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

.confirm-summary {
    margin-bottom: 1rem;
    font-size: 16px;
    color: #333;
}

.confirm-btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    background-color: #73abff;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: background 0.3s;
    border: none;
    font-size: 16px;
    font-weight: 500;
}

.confirm-btn:hover {
    background-color: #558ce0;
}

.confirm-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* RESPONSIVE - single column under 768px */
@media only screen and (max-width: 767px) {
    .step1-wrap {
        flex-direction: column !important;
        overflow: visible;
    }

    .calendar-box {
        width: 100% !important;
        flex: 0 0 auto;
        margin-bottom: 1rem;
    }

    .slots-box {
        width: 100% !important;
        flex: 1 1 auto;
        max-height: 50vh;
        margin-bottom: 1rem;
    }

    .slots-column {
        grid-template-columns: 1fr;
    }

    .slot-btn {
        min-height: 44px;
    }

    .calendar-title {
        font-size: 18px;
    }
}
