/**
 * Vacation Rental Calendar System - Standalone CSS
 * Complete styling for calendar components
 * 
 * @author Stilverso Full Digital Agency
 * @version 1.0.0
 */

/* === RESET E BASE === */
.vacation-calendar *,
.vacation-filter-calendar * {
    box-sizing: border-box;
}

/* === CALENDARIO VACANZE === */

/* Contenitore principale */
.vacation-calendar,
.vacation-filter-calendar {
    max-width: 500px;
    margin: 0 auto 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
    position: relative;
}

/* Header calendario */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.calendar-header h3 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
    text-transform: capitalize;
}

.calendar-header button {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.calendar-header button:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

.calendar-header button:active {
    transform: translateY(0);
}

/* Griglia calendario */
.calendar-grid {
    padding: 0;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.weekday {
    text-align: center;
    font-weight: 600;
    padding: 12px 4px;
    font-size: 0.85em;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: white;
}

/* Giorni calendario */
.calendar-day {
    min-height: 70px;
    border: 1px solid #e9ecef;
    border-width: 0 1px 1px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

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

.calendar-day.empty {
    border: none;
    cursor: default;
    background: #f8f9fa;
}

.calendar-day.past {
    background: #f8f9fa;
    color: #adb5bd;
    cursor: not-allowed;
}

.calendar-day.available {
    background: #f8fff8;
    border-color: #d4edda;
}

.calendar-day.available:hover {
    background: #e8f5e8;
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.calendar-day.occupied {
    background: #fff5f5;
    border-color: #f5c6cb;
    cursor: not-allowed;
}

.calendar-day.occupied:hover {
    background: #ffebee;
}

/* Numeri e prezzi giorni */
.day-number {
    font-weight: 600;
    font-size: 1em;
    margin-bottom: 2px;
}

.day-price {
    font-size: 0.75em;
    color: #28a745;
    font-weight: 600;
    background: rgba(40, 167, 69, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
}

/* Stati selezione */
.calendar-day.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-color: #667eea !important;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.calendar-day.filter-selected {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%) !important;
    color: white !important;
    border-color: #ff9800 !important;
    transform: scale(1.02);
}

/* Stili range */
.calendar-day.range-start {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%) !important;
    color: white !important;
    border-color: #2196f3 !important;
    border-radius: 50% 0 0 50%;
}

.calendar-day.range-end {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%) !important;
    color: white !important;
    border-color: #2196f3 !important;
    border-radius: 0 50% 50% 0;
}

.calendar-day.range-middle {
    background: linear-gradient(135deg, #bbdefb 0%, #90caf9 100%) !important;
    color: #1976d2 !important;
    border-color: #2196f3 !important;
}

/* Legenda */
.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #495057;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 2px solid transparent;
}

.legend-color.available {
    background: linear-gradient(135deg, #f8fff8 0%, #e8f5e8 100%);
    border-color: #d4edda;
}

.legend-color.occupied {
    background: linear-gradient(135deg, #fff5f5 0%, #ffebee 100%);
    border-color: #f5c6cb;
}

/* === CONTROLLI FILTRO === */

.filter-controls {
    margin-bottom: 20px;
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.filter-controls button {
    margin: 5px 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.clear-selection {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
}

.clear-selection:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
}

.search-availability {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    color: white;
    font-size: 1em;
    padding: 15px 30px;
}

.search-availability:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

/* === DATE SELEZIONATE === */

#selected-dates-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

#selected-dates-container h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-weight: 600;
}

.range-info,
#range-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #2196f3;
}

.range-status {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 1px solid #ff9800;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 4px solid #ff9800;
}

.selection-summary {
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
    border: 1px solid #4caf50;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: center;
    border-left: 4px solid #4caf50;
}

.date-range-display {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    border: 1px solid #9c27b0;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    border-left: 4px solid #9c27b0;
    line-height: 1.6;
}

.selected-date-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.selected-date-item:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
}

.remove-date,
.remove-all-dates {
    background: #f44336;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.remove-date:hover,
.remove-all-dates:hover {
    background: #d32f2f;
    transform: scale(1.05);
}

/* === RISULTATI RICERCA === */

.search-results {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 10000;
    display: none;
    overflow-y: auto;
}

.results-content {
    background: white;
    max-width: 1200px;
    margin: 20px auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 50px rgba(0,0,0,0.3);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
}

.results-header h3 {
    margin: 0;
    font-size: 1.5em;
}

.close-results {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.2s ease;
}

.close-results:hover {
    background: rgba(255,255,255,0.3);
}

.results-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

/* Griglia case disponibili */
.available-houses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.house-result-card {
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.house-result-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.house-thumbnail {
    height: 220px;
    overflow: hidden;
    position: relative;
}

.house-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.house-result-card:hover .house-thumbnail img {
    transform: scale(1.05);
}

.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    font-size: 3em;
    color: #adb5bd;
}

.house-info {
    padding: 20px;
}

.house-info h4 {
    margin: 0 0 15px 0;
    font-size: 1.2em;
    color: #495057;
}

.house-info h4 a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.house-info h4 a:hover {
    color: #667eea;
}

.house-details {
    display: flex;
    gap: 20px;
    margin: 15px 0;
    color: #6c757d;
    font-size: 0.9em;
}

.house-pricing {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    font-weight: 600;
    padding: 10px 0;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
}

.price-per-night {
    color: #495057;
}

.total-price {
    color: #28a745;
    font-size: 1.1em;
}

.house-excerpt {
    margin: 15px 0;
    color: #6c757d;
    line-height: 1.5;
}

.view-house-btn {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 25px;
    text-decoration: none;
    border-radius: 25px;
    margin-top: 15px;
    transition: all 0.3s ease;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85em;
}

.view-house-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    color: white;
    text-decoration: none;
}

.results-summary {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
    border-radius: 12px;
    border-left: 4px solid #4caf50;
    font-size: 1.1em;
    color: #2e7d32;
}

.no-results {
    text-align: center;
    padding: 50px 20px;
    color: #6c757d;
}

.no-results h4 {
    font-size: 2em;
    margin-bottom: 15px;
}

.error {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border: 1px solid #f44336;
    border-left: 4px solid #f44336;
    padding: 20px;
    border-radius: 8px;
    color: #c62828;
    text-align: center;
}

/* === DETTAGLI GIORNO === */

.day-details {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    z-index: 1000;
    min-width: 250px;
    overflow: hidden;
}

.details-content {
    padding: 20px;
    text-align: center;
}

.details-content h4 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 1.1em;
}

.details-content p {
    margin: 0 0 15px 0;
    color: #28a745;
    font-size: 1.1em;
}

.details-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-contact,
.btn-close {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-contact {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    color: white;
}

.btn-contact:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.btn-close {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
}

.btn-close:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.4);
}

/* === STATI LOADING === */

.vacation-calendar.loading,
.vacation-filter-calendar.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.vacation-calendar.loading::before,
.vacation-filter-calendar.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1000;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === RESPONSIVE === */

@media (max-width: 768px) {
    .vacation-calendar,
    .vacation-filter-calendar {
        max-width: 100%;
        margin: 0 0 15px 0;
        border-radius: 8px;
    }
    
    .calendar-day {
        min-height: 60px;
        font-size: 0.9em;
    }
    
    .day-price {
        font-size: 0.7em;
    }
    
    .calendar-header {
        padding: 15px;
    }
    
    .calendar-header h3 {
        font-size: 1.1em;
    }
    
    .calendar-header button {
        padding: 8px 12px;
        font-size: 16px;
    }
    
    .filter-controls {
        padding: 15px;
    }
    
    .filter-controls button {
        padding: 10px 15px;
        font-size: 0.8em;
        margin: 3px 5px;
    }
    
    .search-availability {
        padding: 12px 20px !important;
        font-size: 0.9em !important;
    }
    
    .results-content {
        margin: 10px;
        max-height: 95vh;
    }
    
    .results-header {
        padding: 15px 20px;
    }
    
    .results-header h3 {
        font-size: 1.2em;
    }
    
    .results-body {
        padding: 20px 15px;
    }
    
    .available-houses-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .house-thumbnail {
        height: 180px;
    }
    
    .house-details {
        flex-direction: column;
        gap: 10px;
    }
    
    .house-pricing {
        flex-direction: column;
        text-align: center;
        gap: 5px;
    }
    
    .day-details {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 350px;
    }
    
    #selected-dates-container {
        padding: 15px;
    }
    
    .selected-date-item {
        padding: 8px 12px;
        font-size: 0.9em;
    }
    
    .weekday {
        font-size: 0.75em;
        padding: 8px 2px;
    }
    
    .calendar-legend {
        gap: 20px;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .calendar-day {
        min-height: 50px;
        font-size: 0.8em;
    }
    
    .day-number {
        font-size: 0.9em;
    }
    
    .day-price {
        font-size: 0.6em;
        padding: 1px 4px;
    }
    
    .legend-item {
        font-size: 0.8em;
    }
    
    .calendar-legend {
        gap: 15px;
        padding: 15px 10px;
    }
    
    .filter-controls button {
        display: block;
        width: 100%;
        margin: 5px 0;
    }
    
    .vacation-calendar,
    .vacation-filter-calendar {
        border-radius: 6px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
}

/* === ACCESSIBILITA === */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.calendar-day:focus,
.filter-controls button:focus,
.calendar-header button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Miglioramento contrasto per accessibilità */
@media (prefers-contrast: high) {
    .calendar-day.available {
        background: #ffffff;
        border: 2px solid #28a745;
    }
    
    .calendar-day.occupied {
        background: #ffffff;
        border: 2px solid #dc3545;
    }
    
    .calendar-day.selected,
    .calendar-day.filter-selected {
        background: #000000 !important;
        color: #ffffff !important;
        border: 2px solid #ffffff !important;
    }
}

/* === UTILITA === */

.text-center { text-align: center; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.p-10 { padding: 10px; }
.p-15 { padding: 15px; }
.p-20 { padding: 20px; }

/* === DARK MODE === */
@media (prefers-color-scheme: dark) {
    .vacation-calendar,
    .vacation-filter-calendar {
        background: #2d3748;
        color: #e2e8f0;
        box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    }
    
    .calendar-weekdays {
        background: #4a5568;
    }
    
    .weekday {
        color: #cbd5e0;
    }
    
    .calendar-days {
        background: #2d3748;
    }
    
    .calendar-day {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .calendar-day.available {
        background: #22543d;
        border-color: #38a169;
    }
    
    .calendar-day.occupied {
        background: #742a2a;
        border-color: #e53e3e;
    }
    
    .calendar-legend {
        background: #4a5568;
    }
    
    #selected-dates-container {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .filter-controls {
        background: #2d3748;
    }
    
    .results-content {
        background: #2d3748;
        color: #e2e8f0;
    }
}