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

/* ==================== STEP 1: Calendar + Slots ==================== */

.booking-step1 {
    width: 100%;
}

.step1-wrap {
    display: flex;
    gap: 1rem;
    flex-wrap: nowrap;
}

.calendar-box,
.slots-box {
    flex: 1 1 0px;
    min-width: 200px;
    border-radius: 4px;
    padding: 0.5rem;
}

/* 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-nav .icon-btn:hover {
    background: #f0f0f0;
}

/* 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;
}

table.calendar-table td:hover:not(.disabled):not(.selected-day) {
    background: #f0f0f0;
}

.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;
}

/* Slots Column */
.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;
}

/* ==================== STEP 2: Form ==================== */

.step2-header {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.step2-header h5 {
    text-align: center;
    width: 80%;
}

.back-btn {
    cursor: pointer;
    background: #f0f0f0;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 0.5rem;
    transition: background 0.2s;
    border: none;
    font-size: 14px;
}

.back-btn:hover {
    background: #ddd;
}

/* Step 2 Layout */
.step2-wrap {
    display: flex;
    gap: 2rem;
    margin-top: 20px;
}

/* Info Box (Riepilogo) */
.info-box {
    flex: 0 0 300px;
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    height: fit-content;
    position: sticky;
    top: 1rem;
}

.info-box h6 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1rem;
    font-weight: 600;
}

.info-box-item {
    margin-bottom: 1rem;
}

.info-box-item strong {
    display: block;
    margin-bottom: 0.25rem;
    color: #333;
    font-size: 0.9em;
}

.info-box-value {
    font-size: 1.1em;
    color: #0017c2;
}

.info-box-note {
    font-size: 0.9em;
    color: #666;
    margin: 0;
}

/* Form Container */
.form-container {
    flex: 1;
    min-width: 0;
}

/* Form Fields */
.form-fields {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-field {
    margin-bottom: 0.5rem;
}

.form-field label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #333;
}

.form-field .required-mark {
    color: #dc3545;
}

.form-field input[type=text],
.form-field input[type=tel],
.form-field input[type=number],
.form-field input[type=email],
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-field input[type=text]:focus,
.form-field input[type=number]:focus,
.form-field input[type=email]:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: #0017c2;
}

/* Radio and Checkbox Styles */
.radio-group,
.checkbox-group,
.checkbox-list-group {
    margin-top: 0.5rem;
}

.radio-group label,
.checkbox-group label,
.checkbox-list-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: normal;
    cursor: pointer;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.radio-group label:hover,
.checkbox-group label:hover,
.checkbox-list-group label:hover {
    background-color: #f5f5f5;
}

.radio-group input,
.checkbox-group input,
.checkbox-list-group input {
    margin-right: 0.75rem;
    width: 18px;
    height: 18px;
}

/* Submit Button */
.form-submit-section {
    margin-top: 1.5rem;
}

.submit-btn {
    -webkit-box-align: center;
    align-items: center;
    border: none;
    box-shadow: rgba(0, 0, 0, 0.1) 0px 10px 30px 0px;
    background: rgb(0, 23, 254);
    color: rgb(255, 255, 255);
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    flex-shrink: 0;
    font-size: 18px;
    font-weight: 700;
    height: 68px;
    -webkit-box-pack: center;
    justify-content: center;
    line-height: 22px;
    opacity: 1;
    padding: 16px 32px;
    transform: perspective(1000px) translateZ(0px);
    transition: 0.15s ease-in-out;
    width: 100%;
}

.submit-btn:hover {
    box-shadow: rgba(0, 0, 0, 0.15) 0px 15px 35px 0px;
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Error States */
.has-error {
    border: 2px solid #dc3545 !important;
}

.text-danger {
    color: #dc3545;
}

.error-msg {
    color: #dc3545;
    font-size: 0.875em;
    margin-top: 0.25rem;
}

/* ==================== RESPONSIVE ==================== */

@media only screen and (max-width: 767px) {
    .step1-wrap {
        flex-direction: column !important;
    }

    .calendar-box,
    .slots-box {
        width: 100% !important;
        margin-bottom: 1rem;
    }

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

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

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

    .step2-wrap {
        flex-direction: column;
    }

    .info-box {
        flex: none;
        width: 100%;
        position: static;
    }

    .form-container {
        width: 100%;
    }
}

/* ==================== QUESTIONNAIRE SPECIFIC ==================== */

/* Full-page layout for questionnaire calendar */
.book-call-full-container {
    width: 100%;
    max-width: 900px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: white;
    flex-grow: 1;
    margin: 0 auto;
    font-family: Arial, sans-serif;
    color: #333;
    position: relative;
}

.book-call-full-container .calendar-widget-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100% !important;
}

.book-call-full-container .step1-wrap {
    /* no flex-grow - let it size naturally */
}

.book-call-full-container .calendar-title {
    font-size: 20px;
    font-weight: 300;
    margin-bottom: 0.5rem;
}

.book-call-full-container hr {
    border: none;
    border-bottom: 1px solid lightgray;
    margin-bottom: 1rem;
}

/* Skip button at bottom */
.book-call-full-container .skip-container {
    position: absolute;
    bottom: 2rem;
    left: 0;
    right: 0;
    text-align: center;
}

.book-call-full-container .skip-btn {
    background: transparent;
    border: none;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
    padding: 0.5rem 1rem;
}

.book-call-full-container .skip-btn:hover {
    color: #333;
}

/* Confirm Container (shown when slot selected in questionnaire) */
.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;
}

/* 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;
}
