/**
 * Frontend CSS for Chalet Montagne
 *
 * @package ChaletMontagne
 */

/* Planning */
.cm2-planning {
    margin: 20px 0;
}

.cm2-planning #cm2-calendar {
    max-width: 100%;
}

/* Make calendar days clickable */
.cm2-planning .fc-daygrid-day {
    cursor: pointer;
    transition: box-shadow 0.2s ease;
}

.cm2-planning .fc-daygrid-day:hover {
    box-shadow: inset 0 0 0 2px #3498db;
}

/* Don't show hover on past dates */
.cm2-planning .fc-day-past:hover {
    box-shadow: none;
    cursor: default;
}

/* Background events styling */
/* Green background for available periods */
.cm2-planning .fc-bg-event.cm2-available-period {
    opacity: 1; /* Semi-transparent green for available dates */
}

/* Red background for unavailable/reserved periods */
.cm2-planning .fc-bg-event.cm2-unavailable-period {
    opacity: 1; /* Semi-transparent red for reserved dates */
}

/* FullCalendar 3-month view optimizations */
.cm2-planning .fc-multimonth {
    font-size: 0.85em;
}

.cm2-planning .fc-multimonth-title {
    font-size: 1.1em;
    font-weight: 600;
    padding: 8px 0;
}

.cm2-planning .fc-multimonth-daygrid {
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.cm2-planning .fc-col-header-cell {
    padding: 5px 2px;
    font-size: 0.85em;
    font-weight: 600;
}

.cm2-planning .fc-daygrid-day-number {
    padding: 4px;
    font-size: 0.9em;
}

.cm2-planning .fc-daygrid-day {
    min-height: 35px;
}

.cm2-planning .fc-event {
    font-size: 0.85em;
    padding: 2px 4px;
    margin: 1px;
}

.cm2-planning .fc-daygrid-more-link {
    font-size: 0.8em;
    padding: 2px 4px;
}

/* Compact single month view */
.cm2-planning .fc-daygrid-day-frame {
    min-height: 60px;
}

/* Better spacing for toolbar */
.cm2-planning .fc-toolbar {
    margin-bottom: 15px;
}

.cm2-planning .fc-toolbar-title {
    font-size: 1.3em;
}

.cm2-planning .fc-button {
    padding: 6px 12px;
    font-size: 0.9em;
}

/* Tarifs */
.cm2-tarifs {
    margin: 20px 0;
}

.cm2-tarifs-header {
    border-radius: 5px;
}

.cm2-tarifs-table {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    overflow: hidden;
}

.cm2-tarifs-table th,
.cm2-tarifs-table td {
    padding: 12px;
}

.cm2-tarifs-table tbody tr:hover {
    background-color: #f5f5f5;
}

/* Galerie */
.cm2-galerie {
    margin: 20px 0;
}

.cm2-gallery-grid {
    margin-top: 20px;
}

.cm2-gallery-item img {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cm2-gallery-item:hover img {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Contact */
.cm2-contact {
    margin: 20px 0;
}

.cm2-contact-header {
    border-radius: 5px;
}

.cm2-contact-form {
    margin-top: 20px;
}

.cm2-contact-form input,
.cm2-contact-form textarea {
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.3s;
}

.cm2-contact-form input:focus,
.cm2-contact-form textarea:focus {
    border-color: #3498db;
    outline: none;
}

.cm2-contact-form button {
    transition: opacity 0.3s, transform 0.2s;
}

.cm2-contact-form button:hover {
    transform: translateY(-2px);
}

.cm2-contact-form button:active {
    transform: translateY(0);
}

/* Owner Info Card */
.cm2-owner-info {
    position: sticky;
    top: 20px;
}

.cm2-owner-info h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.cm2-owner-info p {
    line-height: 1.6;
}

.cm2-owner-info a:hover {
    text-decoration: underline;
}

/* Messages */
.cm2-message {
    border-radius: 5px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Contact link button */
.cm2-contact-link .button {
    display: inline-block;
    padding: 12px 24px;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: opacity 0.3s, transform 0.2s;
}

.cm2-contact-link .button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 768px) {
    /* Calendar responsive adjustments */
    .cm2-planning .fc-multimonth {
        font-size: 0.75em;
    }

    .cm2-planning .fc-toolbar {
        flex-direction: column;
        gap: 10px;
    }

    .cm2-planning .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
    }

    .cm2-planning .fc-button {
        padding: 5px 10px;
        font-size: 0.85em;
    }

    .cm2-planning .fc-daygrid-day {
        min-height: 30px;
    }

    .cm2-planning .fc-daygrid-day-frame {
        min-height: 40px;
    }

    .cm2-planning .fc-event {
        font-size: 0.75em;
        padding: 1px 3px;
    }

    /* On mobile, stack months vertically */
    .cm2-planning .fc-multimonth-singlecol {
        max-width: 100%;
    }

    .cm2-tarifs-table th,
    .cm2-tarifs-table td {
        padding: 8px;
        font-size: 14px;
    }

    .cm2-contact-form {
        max-width: 100% !important;
    }

    .cm2-contact-form input,
    .cm2-contact-form textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Stack contact form and owner info on mobile */
    .cm2-contact > div {
        grid-template-columns: 1fr !important;
    }

    .cm2-owner-info {
        position: static;
        margin-top: 30px;
    }
}

@media (max-width: 900px) {
    /* Force single column layout for 3-month view on tablets */
    .cm2-planning .fc {
        --fc-multimonth-max-columns: 1;
    }
}

/* Loading state */
.cm2-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.cm2-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Generated Pages - Locations Listing */
.cm2-locations-listing {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin: 30px 0;
}

.cm2-location-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.cm2-location-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.cm2-location-photo img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.cm2-location-info {
    padding: 20px;
}

.cm2-location-info h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
}

.cm2-location-info h3 a {
    color: #2c3e50;
    text-decoration: none;
}

.cm2-location-info h3 a:hover {
    color: #3498db;
}

.cm2-location-excerpt {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}

.cm2-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #3498db;
    color: white !important;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s;
}

.cm2-btn:hover {
    background: #2980b9;
}

/* Generated Pages - Individual Location */
.cm2-location-header {
    margin-bottom: 30px;
}

.cm2-location-main-photo {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border-radius: 8px;
}

/* Tabs Navigation */
.cm2-location-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
}

.cm2-tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    transition: color 0.3s, border-color 0.3s;
}

.cm2-tab-btn:hover {
    color: #3498db;
}

.cm2-tab-btn.active {
    color: #2c3e50;
    border-bottom-color: #3498db;
}

/* Tab Content */
.cm2-tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.cm2-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Description Section */
.cm2-location-description h1 {
    margin-top: 0;
    font-size: 32px;
    color: #2c3e50;
    margin-bottom: 15px;
}

/* Location Info - Type, Classification, Station */
.cm2-location-info-badges {
    background: #f8f9fa;
    border-left: 4px solid #3498db;
    padding: 15px 20px;
    margin-bottom: 25px;
    border-radius: 5px;
}

.cm2-info-line {
    margin-bottom: 8px;
    font-size: 15px;
    line-height: 1.6;
}

.cm2-info-line:last-child {
    margin-bottom: 0;
}

.cm2-info-type-line {
    color: #2c3e50;
    font-weight: 500;
}

.cm2-info-type {
    color: #7b1fa2;
    font-weight: 600;
}

.cm2-info-classification {
    color: #666;
    font-weight: 400;
    font-size: 14px;
}

.cm2-info-location-line {
    color: #555;
}

.cm2-info-label {
    font-weight: 600;
    color: #2c3e50;
}

.cm2-info-station {
    color: #1976d2;
}

.cm2-info-distance {
    color: #666;
    font-style: italic;
    font-size: 14px;
}

.cm2-description-text {
    line-height: 1.8;
    color: #555;
    margin-bottom: 30px;
}

/* Booking Information Box - Card Style */
.cm2-booking-info {
    background: #ffffff;
    border: 2px solid #e0e7ff;
    border-radius: 10px;
    padding: 18px 22px;
    margin: 25px 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.12);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.cm2-booking-info:hover {
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.cm2-booking-info-title {
    color: #667eea;
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e7ff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cm2-booking-info-title::before {
    content: '📋';
    font-size: 20px;
}

.cm2-booking-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}

.cm2-booking-info-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 14px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.cm2-booking-info-label {
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

.cm2-booking-info-label::after {
    content: ':';
}

.cm2-booking-info-value {
    color: #2c3e50;
    font-weight: 600;
}

/* Remarques Section (detailed description) */
.cm2-location-remarques {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid #e0e0e0;
}

.cm2-location-remarques h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.cm2-remarques-text {
    line-height: 1.8;
    color: #555;
    margin-bottom: 30px;
}

.cm2-location-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 30px;
}

.cm2-detail-item {
    font-size: 16px;
    color: #555;
}

.cm2-detail-item strong {
    color: #2c3e50;
}

.cm2-location-equipements {
    margin-top: 30px;
}

.cm2-location-equipements h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.cm2-location-equipements ul {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.cm2-location-equipements li {
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 5px;
    position: relative;
    padding-left: 30px;
}

.cm2-location-equipements li::before {
    content: '✓';
    position: absolute;
    left: 10px;
    color: #27ae60;
    font-weight: bold;
}

/* Gallery Section */
.cm2-location-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.cm2-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    aspect-ratio: 4/3;
}

.cm2-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.cm2-gallery-item:hover img {
    transform: scale(1.05);
}

.cm2-gallery-item a {
    display: block;
    height: 100%;
}

/* Contact Section at Bottom */
.cm2-location-contact {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

/* Month Separators in Tarifs */
.cm2-tarifs-month-separator {
    background: #f8f9fa;
    padding: 12px 15px;
    font-weight: bold;
    font-size: 18px;
    color: #2c3e50;
    border-left: 4px solid #3498db;
    margin-top: 20px;
    margin-bottom: 10px;
}

.cm2-tarifs-month-separator:first-child {
    margin-top: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cm2-locations-listing {
        grid-template-columns: 1fr;
    }

    .cm2-location-tabs {
        justify-content: center;
    }

    .cm2-tab-btn {
        flex: 1;
        min-width: 100px;
        text-align: center;
    }

    .cm2-location-description h1 {
        font-size: 24px;
    }

    .cm2-location-info-badges {
        padding: 12px 15px;
    }

    .cm2-info-line {
        font-size: 14px;
    }

    .cm2-info-classification,
    .cm2-info-distance {
        font-size: 13px;
    }

    .cm2-booking-info {
        padding: 15px 18px;
    }

    .cm2-booking-info-title {
        font-size: 16px;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }

    .cm2-booking-info-title::before {
        font-size: 18px;
    }

    .cm2-booking-info-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .cm2-booking-info-item {
        font-size: 13px;
        padding: 6px 10px;
    }

    .cm2-booking-info-label {
        font-size: 13px;
    }

    .cm2-booking-info-value {
        font-size: 13px;
    }

    .cm2-location-details {
        grid-template-columns: 1fr;
    }

    .cm2-location-equipements ul {
        grid-template-columns: 1fr;
    }

    .cm2-location-gallery {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .cm2-tab-btn {
        padding: 10px 12px;
        font-size: 14px;
    }
}