/**
 * Responsive styles
 *
 * @package ChaletMontagne
 */

/*--------------------------------------------------------------
>>> TABLE OF CONTENTS:
----------------------------------------------------------------
1.0 - Tablet (max-width: 1024px)
2.0 - Mobile (max-width: 768px)
3.0 - Small Mobile (max-width: 480px)
--------------------------------------------------------------*/

/*--------------------------------------------------------------
1.0 - Tablet (max-width: 1024px)
--------------------------------------------------------------*/
@media screen and (max-width: 1024px) {
    .site-container {
        padding: 0 15px;
    }

    .cm2-location-gallery {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .cm2-locations-listing {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }
}

/*--------------------------------------------------------------
2.0 - Mobile (max-width: 768px)
--------------------------------------------------------------*/
@media screen and (max-width: 768px) {
    /* Body lock when fullscreen menu is open */
    body.menu-open {
        overflow: hidden;
    }

    /* Typography */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }

    /* Header */
    .site-header .site-container {
        position: relative;
        padding-right: 60px;
    }

    .site-branding {
        min-width: 0;
    }

    .site-title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .site-description {
        display: none;
    }

    /* ══════════════════════════════════════════
       Mobile menu — Hamburger + Fullscreen overlay
       ══════════════════════════════════════════ */

    /* Hamburger button */
    .menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        width: 44px;
        height: 44px;
        padding: 8px;
        background: transparent;
        color: var(--color-text);
        border: 1px solid var(--color-divider);
        border-radius: 6px;
        cursor: pointer;
        position: absolute;
        right: var(--spacing-sm, 1rem);
        top: 50%;
        transform: translateY(-50%);
        z-index: 100001;
        transition: all 0.3s ease;
    }

    .menu-toggle:hover,
    .menu-toggle:focus {
        border-color: var(--color-primary);
    }

    .menu-toggle .hamburger-bar {
        display: block;
        width: 22px;
        height: 2px;
        background-color: var(--color-text);
        border-radius: 2px;
        transition: all 0.3s ease;
        transform-origin: center;
    }

    /* Hamburger → X animation */
    .main-navigation.toggled .menu-toggle .hamburger-bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .main-navigation.toggled .menu-toggle .hamburger-bar:nth-child(2) {
        opacity: 0;
    }

    .main-navigation.toggled .menu-toggle .hamburger-bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* Hide desktop nav in mobile */
    .main-navigation {
        margin-top: 0;
    }

    .main-navigation > ul {
        display: none !important;
    }

    /* ══════════════════════════════════════════
       Fullscreen menu overlay (appended to body)
       ══════════════════════════════════════════ */
    .mobile-menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 100000;
        background: var(--color-bg, #0a0a0a);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        overflow-y: auto;
    }

    .admin-bar .mobile-menu-overlay {
        top: 32px;
        height: calc(100% - 32px);
    }

    .mobile-menu-overlay.active {
        display: flex;
    }

    /* Close button (X) inside overlay */
    .mobile-menu-close {
        position: absolute;
        top: 1.5rem;
        right: 1.5rem;
        width: 44px;
        height: 44px;
        background: transparent;
        border: 1px solid var(--color-divider);
        border-radius: 6px;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 0;
        z-index: 1;
        transition: border-color 0.3s ease;
    }

    .mobile-menu-close:hover,
    .mobile-menu-close:focus {
        border-color: var(--color-primary);
    }

    .mobile-menu-close .hamburger-bar {
        display: block;
        width: 22px;
        height: 2px;
        background-color: var(--color-text);
        border-radius: 2px;
    }

    .mobile-menu-close .hamburger-bar:first-child {
        transform: rotate(45deg) translateY(1px);
    }

    .mobile-menu-close .hamburger-bar:last-child {
        transform: rotate(-45deg) translateY(-1px);
    }

    /* Menu items inside overlay */
    .mobile-menu-overlay > ul,
    .mobile-menu-overlay ul {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        gap: 0;
        list-style: none;
        margin: 0;
        padding: 2rem;
        width: 100%;
    }

    .mobile-menu-overlay ul ul {
        padding: 0;
    }

    .mobile-menu-overlay li {
        width: 100%;
        max-width: 400px;
        text-align: center;
        position: static;
    }

    .mobile-menu-overlay a {
        display: block;
        padding: 1rem 0;
        font-size: 1.2rem;
        font-family: var(--font-heading);
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--color-text);
        text-decoration: none;
        border-bottom: 1px solid var(--color-divider);
        transition: color 0.3s ease;
    }

    .mobile-menu-overlay li:last-child > a {
        border-bottom: none;
    }

    .mobile-menu-overlay a:hover,
    .mobile-menu-overlay .current-menu-item > a,
    .mobile-menu-overlay .current_page_item > a {
        color: var(--color-primary);
    }

    /* Sub-menus: inline in overlay */
    .mobile-menu-overlay ul ul {
        position: static !important;
        display: flex !important;
        flex-direction: column;
        box-shadow: none;
        min-width: 0;
        width: 100%;
        padding: 0;
        background: transparent;
        border-radius: 0;
    }

    .mobile-menu-overlay ul ul a {
        font-size: 1rem;
        opacity: 0.7;
    }

    /* Content */
    .site-content {
        padding: 20px 0;
    }

    /* Sidebar */
    #secondary {
        margin-top: 2rem;
    }

    /* Footer */
    .footer-widget {
        margin-bottom: 2rem;
    }

    .footer-widget:last-child {
        margin-bottom: 0;
    }

    /* Plugin overrides */
    .cm2-planning-container,
    .cm2-contact-form {
        padding: 1rem;
    }

    .cm2-location-header {
        margin: -1rem -1rem 1rem;
        height: 250px;
    }

    .cm2-location-tabs {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .cm2-tab-btn {
        flex: 1;
        min-width: 120px;
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    .cm2-tab-content {
        padding: 1.5rem 0;
    }

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

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

    .cm2-locations-listing {
        grid-template-columns: 1fr;
    }

    .cm2-location-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    /* Table responsive */
    .cm2-tarifs-table {
        font-size: 0.9rem;
    }

    .cm2-tarifs-table th,
    .cm2-tarifs-table td {
        padding: 0.75rem 0.5rem;
    }

    /* Breadcrumbs */
    .breadcrumbs {
        font-size: 0.85rem;
        padding: 0.75rem;
    }

    /* Pagination */
    .page-numbers {
        padding: 6px 10px;
        margin: 0 2px;
        font-size: 0.9rem;
    }
}

/*--------------------------------------------------------------
3.0 - Small Mobile (max-width: 480px)
--------------------------------------------------------------*/
@media screen and (max-width: 480px) {
    /* Typography */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    /* Buttons */
    .button,
    button,
    input[type="submit"] {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    /* Forms */
    input[type="text"],
    input[type="email"],
    input[type="url"],
    input[type="password"],
    input[type="search"],
    input[type="number"],
    input[type="tel"],
    input[type="date"],
    textarea,
    select {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    /* Location header */
    .cm2-location-header {
        height: 200px;
    }

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

    .cm2-gallery-item img {
        height: 200px;
    }

    /* Tabs */
    .cm2-location-tabs {
        flex-direction: column;
        border-bottom: none;
    }

    .cm2-tab-btn {
        width: 100%;
        border-bottom: 1px solid #e0e0e0;
        border-left: 3px solid transparent;
    }

    .cm2-tab-btn.active {
        border-bottom-color: #e0e0e0;
        border-left-color: var(--color-primary);
        background-color: rgba(44, 95, 124, 0.05);
    }

    /* Contact form */
    .cm2-contact-form {
        padding: 1rem;
    }

    /* Table */
    .cm2-tarifs-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .cm2-tarifs-table thead {
        display: none;
    }

    .cm2-tarifs-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e0e0e0;
        border-radius: 4px;
    }

    .cm2-tarifs-table td {
        display: block;
        text-align: left;
        padding: 0.5rem 1rem;
    }

    .cm2-tarifs-table td::before {
        content: attr(data-label);
        font-weight: 600;
        display: block;
        margin-bottom: 0.25rem;
        color: var(--color-primary);
    }

    /* Social links */
    .social-links {
        justify-content: center;
    }

    .social-link {
        width: 35px;
        height: 35px;
    }
}

/* Print styles */
@media print {
    .site-header,
    .main-navigation,
    .site-footer,
    .menu-toggle,
    .breadcrumbs,
    .social-links,
    .cm2-tab-btn {
        display: none;
    }

    .cm2-tab-content {
        display: block !important;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }

    a {
        color: #000;
        text-decoration: underline;
    }
}
