/**
 * ICDN Booking System - Frontend Styles
 * Version 1.1.0
 */

/* ============================================
   RESET & BASE
   ============================================ */
.icdn-booking-wrapper {
    max-width: 700px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

.icdn-booking-wrapper * {
    box-sizing: border-box;
}

/* ============================================
   CALENDARIO - CONTAINER
   ============================================ */
.icdn-booking-calendar-container,
.icdn-booking-calendar-wrapper {
    margin-top: 10px;
}

.icdn-booking-calendar {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ============================================
   CALENDARIO - HEADER CON FRECCE
   ============================================ */
.icdn-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1D70B3 0%, #1a5f9a 100%);
    color: #fff;
}

.icdn-calendar-header .month-title {
    font-size: 18px;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.3px;
}

/* Frecce navigazione */
.icdn-calendar-header button.icdn-prev-month,
.icdn-calendar-header button.icdn-next-month {
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.3);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.icdn-calendar-header button.icdn-prev-month:hover,
.icdn-calendar-header button.icdn-next-month:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.5);
    transform: scale(1.05);
}

.icdn-calendar-header button.icdn-prev-month:active,
.icdn-calendar-header button.icdn-next-month:active {
    transform: scale(0.95);
}

.icdn-calendar-header button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none !important;
}

/* SVG frecce */
.icdn-calendar-header button svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
}

/* ============================================
   CALENDARIO - GIORNI SETTIMANA
   ============================================ */
.icdn-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.icdn-calendar-weekdays span {
    padding: 14px 0;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   CALENDARIO - GRIGLIA GIORNI
   ============================================ */
.icdn-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    padding: 12px;
    background: #fff;
}

.icdn-calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 2px solid transparent;
    position: relative;
}

.icdn-calendar-day:hover:not(.unavailable):not(.past):not(.empty) {
    background: #e7f3ff;
    border-color: #1D70B3;
    transform: scale(1.05);
}

.icdn-calendar-day.empty {
    cursor: default;
    background: transparent;
}

.icdn-calendar-day.today {
    font-weight: 700;
    color: #1D70B3;
}

.icdn-calendar-day.today::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: #1D70B3;
    border-radius: 50%;
}

.icdn-calendar-day.available {
    background: #e8f5e9;
    color: #2e7d32;
    font-weight: 600;
}

.icdn-calendar-day.unavailable {
    color: #ccc;
    cursor: not-allowed;
    background: #fafafa;
}

.icdn-calendar-day.past {
    color: #d0d0d0;
    cursor: not-allowed;
}

.icdn-calendar-day.selected {
    background: #1D70B3;
    color: #fff;
    border-color: #1D70B3;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(29, 112, 179, 0.4);
}

/* ============================================
   SLOT ORARI
   ============================================ */
.icdn-booking-slots {
    margin-top: 24px;
    animation: icdn-fadeIn 0.3s ease-out;
}

.icdn-slots-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.icdn-slots-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: #1D70B3;
    border-radius: 2px;
}

.icdn-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
}

.icdn-slot-btn {
    padding: 14px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.15s ease;
    text-align: center;
    color: #333;
}

.icdn-slot-btn:hover {
    border-color: #1D70B3;
    background: #e7f3ff;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(29, 112, 179, 0.15);
}

.icdn-slot-btn.selected {
    border-color: #1D70B3;
    background: #1D70B3;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 112, 179, 0.3);
}

.icdn-slots-empty {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    background: #f8f9fa;
    border-radius: 10px;
    font-size: 14px;
}

.icdn-slots-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.icdn-slots-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #1D70B3;
    border-top-color: transparent;
    border-radius: 50%;
    animation: icdn-spin 0.8s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

/* ============================================
   SELEZIONE RIEPILOGO
   ============================================ */
.icdn-booking-selection {
    margin-top: 24px;
    padding: 18px 20px;
    background: linear-gradient(135deg, #e7f3ff 0%, #d4e8ff 100%);
    border-radius: 10px;
    display: none;
    border: 1px solid #b8d4f0;
}

.icdn-booking-selection.visible {
    display: block;
    animation: icdn-fadeIn 0.3s ease-out;
}

.icdn-booking-selection .selection-text {
    font-size: 15px;
    color: #1D70B3;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.icdn-booking-selection .selection-text::before {
    content: '\2713';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #1D70B3;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
}

.icdn-booking-selection .selection-text strong {
    font-weight: 700;
}

/* ============================================
   CF7 INTEGRATION
   ============================================ */
.wpcf7-form .icdn-booking-calendar-wrapper {
    margin: 15px 0;
}

.wpcf7-form .icdn-booking-calendar {
    margin-bottom: 20px;
}

.wpcf7-not-valid-tip {
    margin-top: 10px;
    color: #dc3545;
    font-size: 13px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
    .icdn-calendar-header {
        padding: 14px 16px;
    }
    
    .icdn-calendar-header .month-title {
        font-size: 16px;
    }
    
    .icdn-calendar-header button.icdn-prev-month,
    .icdn-calendar-header button.icdn-next-month {
        width: 36px;
        height: 36px;
    }
    
    .icdn-calendar-header button svg {
        width: 18px;
        height: 18px;
    }
    
    .icdn-calendar-days {
        gap: 4px;
        padding: 10px;
    }
    
    .icdn-calendar-day {
        font-size: 13px;
        border-radius: 8px;
    }
    
    .icdn-slots-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .icdn-slot-btn {
        padding: 12px 8px;
        font-size: 14px;
    }
}

/* ============================================
   ANIMAZIONI
   ============================================ */
@keyframes icdn-fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes icdn-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   LOADING STATE
   ============================================ */
.icdn-loading {
    position: relative;
    pointer-events: none;
}

.icdn-loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    border-radius: inherit;
}
