/**
 * CSS mobile dedicato - Centro Sportivo Roero
 * Breakpoints: 968px (tablet) | 768px (mobile) | 600px (phone) | 480px (small phone)
 * Mantiene proporzioni e adatta tutto il sito alla vista mobile
 */

/* ========== BASE & UTILITY ========== */
/* Breakpoints: 968px tablet | 768px mobile | 600px phone | 480px small | 390px iPhone SE/13 mini */
@media (max-width: 968px) {
    html {
        font-size: 15px;
    }
    body {
        overflow-x: hidden;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
}

@media (max-width: 600px) {
    html {
        font-size: 13.5px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 13px;
    }
}

@media (max-width: 390px) {
    html {
        font-size: 12.5px;
    }
}

/* ========== OVERLAY MENU MOBILE (stesso comportamento su tutte le pagine) ========== */
@media (max-width: 968px) {
    body.menu-open {
        overflow: hidden;
    }
    body.menu-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9999;
        pointer-events: none; /* I tap passano al menu (z-index superiore) o al contenuto per chiudere */
        animation: menuOverlayFade 0.3s ease forwards;
    }
}
@keyframes menuOverlayFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========== HEADER & NAVIGATION ========== */
@media (max-width: 968px) {
    .top-bar,
    .top-bar-fixed {
        padding: 12px 16px !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    .main-nav {
        display: flex !important;
        align-items: center !important;
        margin-left: auto !important;
    }
    .mobile-menu-toggle,
    body.index-page .mobile-menu-toggle {
        display: flex !important;
        flex-direction: column !important;
        visibility: visible !important;
        opacity: 1 !important;
        padding: 10px !important;
        cursor: pointer !important;
        z-index: 10003 !important;
    }
    .mobile-menu-toggle span {
        width: 24px;
        height: 3px;
        background: #fff !important;
    }
    .nav-menu {
        width: min(340px, 88vw) !important; /* Pannello slide-in come Alba, bilanciato su tutti i dispositivi */
        max-width: 340px !important;
        padding: 80px 32px 36px !important; /* Stile uniforme come Alba */
        touch-action: manipulation; /* Rimuove ritardo 300ms su tap mobile */
    }
    .nav-menu.active {
        z-index: 10002 !important; /* Sopra overlay - riceve i tap su smartphone */
    }
    .logo-img {
        height: 32px !important;
        max-width: 120px !important;
    }
}

@media (max-width: 768px) {
    .top-bar,
    .top-bar-fixed {
        padding: 10px 14px !important;
    }
    .logo-img {
        height: 28px !important;
        max-width: 100px !important;
    }
    .nav-menu {
        width: min(320px, 88vw) !important;
        max-width: 320px !important;
        padding: 72px 28px 32px !important;
    }
    .nav-link {
        font-size: 1rem !important;
        padding: 16px 0 !important;
        text-align: center !important;
    }
    .nav-dropdown .nav-link {
        display: flex !important;
        justify-content: center;
        align-items: center;
    }
    .dropdown-menu {
        width: 100% !important;
        min-width: 0 !important;
    }
    .dropdown-menu a {
        padding: 12px 16px !important;
        font-size: 0.9rem !important;
        text-align: center !important;
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .dropdown-arrow {
        margin-left: 6px !important;
    }
    .mobile-menu-toggle span {
        width: 22px;
    }
}

@media (max-width: 480px) {
    .logo-img {
        height: 24px !important;
    }
    .mobile-menu-toggle span {
        width: 20px;
    }
}

/* ========== HOME - HERO & VIDEO ========== */
@media (max-width: 968px) {
    .fullscreen-bg {
        min-height: 100vh;
    }
    .hero-center {
        padding: 0 16px;
        max-width: 90vw;
    }
    .hero-logo {
        max-width: 55vw !important;
    }
}

@media (max-width: 768px) {
    .hero-center {
        padding: 0 12px;
        max-width: 95vw;
    }
    .hero-logo {
        max-width: 70vw !important;
        margin-bottom: 12px !important;
    }
    .text-line {
        font-size: clamp(1rem, 4.5vw, 1.5rem) !important;
        letter-spacing: 0.08em !important;
    }
    .text-line.text-wide {
        letter-spacing: 0.5em !important;
    }
}

@media (max-width: 480px) {
    .hero-logo {
        max-width: 80vw !important;
    }
}

/* ========== WELCOME SECTION ========== */
@media (max-width: 968px) {
    .welcome-section {
        padding: 70px 24px 80px;
    }
    .welcome-title {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        font-size: 2.6rem;
        white-space: normal !important;
        line-height: 1.15 !important;
        margin-bottom: 24px !important;
        padding: 0 10px !important;
        max-width: 100% !important;
    }
    .welcome-content {
        margin-top: 0 !important;
    }
    .welcome-intro {
        font-size: 1.05rem;
    }
}

@media (max-width: 768px) {
    .welcome-section {
        padding: 50px 20px 60px;
    }
    .welcome-title {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        font-size: 1.9rem;
        line-height: 1.2 !important;
        margin-bottom: 28px !important;
        white-space: normal !important;
        letter-spacing: 0.05em !important;
        padding: 0 8px !important;
    }
    .welcome-content {
        margin-top: 0 !important;
    }
    .welcome-intro {
        font-size: 0.95rem;
        margin-bottom: 30px;
        line-height: 1.65;
    }
    .welcome-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 30px;
    }
    .welcome-card {
        padding: 24px 18px;
    }
    .welcome-card h3 {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .welcome-title {
        font-size: 1.6rem !important;
        line-height: 1.2 !important;
        margin-bottom: 24px !important;
    }
    .welcome-intro {
        font-size: 0.9rem;
    }
}

/* ========== PISCINE / POOLS GRID ========== */
@media (max-width: 968px) {
    .pools-section {
        padding: 40px 16px 80px;
    }
    .section-title {
        font-size: 2.5rem;
        margin-bottom: 60px;
    }
    .pools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        max-width: 100%;
        padding: 0 12px;
    }
    .pool-placeholder {
        font-size: 1.2rem;
        letter-spacing: 2px;
    }
    .pool-card:nth-child(6) .pool-placeholder {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .pools-section {
        padding: 30px 12px 60px;
    }
    .section-title {
        font-size: 2rem;
        margin-bottom: 40px;
    }
    .pools-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 0 10px;
    }
    .pool-card {
        aspect-ratio: 16/9;
    }
    .pool-placeholder {
        font-size: 1.3rem;
        letter-spacing: 2px;
        padding: 16px;
    }
    .pool-card:nth-child(6) .pool-placeholder {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .section-title {
        font-size: 1.7rem;
        margin-bottom: 30px;
    }
    .pool-placeholder {
        font-size: 1.1rem;
    }
}

/* ========== NEWS SECTION ========== */
@media (max-width: 968px) {
    .news-section {
        padding-top: 80px;
        padding-bottom: 100px;
        padding-left: 16px;
        padding-right: 16px;
    }
    .news-container {
        flex-direction: column;
        gap: 36px;
    }
    .news-header h2 {
        font-size: 3.2rem;
    }
    .news-header p {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .news-section {
        padding-top: 60px;
        padding-bottom: 80px;
        padding-left: 12px;
        padding-right: 12px;
    }
    .news-container {
        gap: 28px;
    }
    .news-header h2 {
        font-size: 2.5rem;
        line-height: 0.95;
    }
    .news-header p {
        font-size: 0.95rem;
        margin-bottom: 24px;
    }
    .news-carousel-wrapper {
        min-width: 0;
    }
    .news-carousel .news-item {
        padding-right: 8px;
    }
    .news-carousel .news-title {
        font-size: 1.1rem;
    }
    .news-carousel .news-description {
        font-size: 0.9rem;
        -webkit-line-clamp: 3;
    }
    .news-carousel-controls {
        margin-top: 28px;
        gap: 24px;
    }
    .carousel-arrow svg {
        width: 20px;
        height: 20px;
    }
    .carousel-dot {
        width: 6px;
        height: 6px;
    }
    .carousel-dot.active {
        width: 20px;
    }
}

@media (max-width: 480px) {
    .news-header h2 {
        font-size: 2rem;
    }
}

/* ========== MODAL ========== */
@media (max-width: 768px) {
    .modal-content {
        width: 94%;
        max-width: none;
        padding: 24px 20px;
        border-radius: 16px;
        margin: 20px;
    }
    #modalTitle {
        font-size: 2rem;
        margin-bottom: 16px;
    }
    #modalDesc {
        font-size: 1rem;
        margin-bottom: 24px;
    }
    .close-btn {
        top: 12px;
        right: 16px;
        font-size: 32px;
    }
}

/* ========== POOL PAGES - HERO ========== */
@media (max-width: 968px) {
    .pool-hero {
        height: 60vh;
    }
    .pool-hero .hero-center h1 {
        font-size: 3rem;
    }
    .back-home-btn {
        font-size: 0.9rem;
        padding: 10px 20px;
    }
}

@media (max-width: 768px) {
    .pool-hero {
        height: 50vh;
        min-height: 280px;
    }
    .pool-hero .hero-center h1 {
        font-size: 2.2rem;
        line-height: 1.1;
        text-align: center;
    }
    .back-home-btn {
        font-size: 0.85rem;
        padding: 8px 16px;
    }
}

@media (max-width: 480px) {
    .pool-hero {
        height: 45vh;
        min-height: 240px;
    }
    .pool-hero .hero-center h1 {
        font-size: 1.8rem;
    }
}

/* ========== SERVICES GRID (pool pages) ========== */
@media (max-width: 968px) {
    .services-section {
        padding: 50px 20px;
        text-align: center;
    }
    .section-title-dark {
        font-size: 2.2rem;
        margin-bottom: 36px;
        text-align: center !important;
    }
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    .service-item {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }
    .service-item h3,
    .service-item p,
    .service-cta {
        text-align: center !important;
    }
    .service-cta {
        align-self: center !important;
    }
}

@media (max-width: 768px) {
    .services-section {
        padding: 40px 16px;
        text-align: center;
    }
    .section-title-dark {
        font-size: 1.8rem;
        margin-bottom: 28px;
        text-align: center !important;
    }
    .services-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .service-item {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        padding: 24px 20px;
    }
    .service-item h3 {
        font-size: 1.2rem;
        text-align: center !important;
    }
    .service-item p {
        font-size: 0.95rem;
        text-align: center !important;
    }
    .service-cta {
        align-self: center !important;
        text-align: center !important;
    }
}

/* ========== FOOTER (ridotto su smartphone - più compatto) ========== */
@media (max-width: 968px) {
    .site-footer {
        padding: 40px 16px 16px;
    }
    .footer-container {
        padding-bottom: 20px;
    }
    .site-footer.footer-pool .footer-container {
        grid-template-columns: 1fr 1fr;
        gap: 16px 12px;
        padding-bottom: 18px;
    }
    .site-footer:not(.footer-pool) .footer-container {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .footer-col {
        text-align: center;
    }
    .footer-brand {
        align-items: center;
    }
    .footer-contact-item {
        justify-content: center;
    }
    .footer-map-canvas {
        height: 140px;
    }
    .site-footer.footer-pool .footer-map-canvas {
        height: 100px;
    }
    .blue-info-section {
        padding-top: 40px;
    }
    .blue-container {
        padding: 0 16px 36px;
        gap: 24px;
    }
    .blue-col h4 {
        font-size: 1rem;
        margin-bottom: 12px;
    }
    .blue-col p {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
    .copyright-bar {
        padding: 14px 16px;
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) {
    .site-footer {
        padding: 28px 14px 14px;
    }
    .footer-container {
        padding-bottom: 14px;
    }
    .site-footer.footer-pool .footer-container {
        gap: 12px 10px;
    }
    .site-footer:not(.footer-pool) .footer-container {
        gap: 20px;
    }
    .footer-col h3,
    .footer-col h4 {
        font-size: 0.8rem;
        margin-bottom: 8px;
        padding-bottom: 4px;
    }
    .site-footer.footer-pool .footer-col p {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }
    .footer-brand-name {
        font-size: 1rem;
    }
    .footer-tagline {
        font-size: 0.8rem;
    }
    .footer-contact-item {
        font-size: 0.8rem;
        justify-content: center;
    }
    .footer-address,
    .footer-legal-info {
        font-size: 0.8rem;
    }
    .footer-map-canvas {
        height: 90px;
        margin-bottom: 6px;
    }
    .footer-map-link {
        font-size: 0.75rem;
    }
    .footer-bottom {
        padding-top: 12px;
        border-top: 1px solid #eee;
    }
    .footer-links-legal {
        flex-wrap: wrap;
        gap: 4px 8px;
        justify-content: center;
    }
    .footer-link {
        font-size: 0.7rem;
    }
    .footer-copyright {
        font-size: 0.7rem;
    }
    .footer-admin-link {
        margin: 8px 0;
    }
    .footer-admin-btn {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
    .blue-info-section {
        padding-top: 32px;
    }
    .blue-container {
        padding: 0 12px 28px;
        gap: 18px;
    }
    .blue-col h4 {
        font-size: 0.95rem;
        margin-bottom: 10px;
    }
    .blue-col p {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
    .copyright-bar {
        padding: 12px 12px;
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .site-footer {
        padding: 22px 12px 12px;
    }
    .footer-container {
        gap: 12px 8px;
        padding-bottom: 12px;
    }
    .footer-col h3,
    .footer-col h4 {
        font-size: 0.75rem;
        margin-bottom: 6px;
    }
    .site-footer.footer-pool .footer-col p {
        font-size: 0.75rem;
    }
    .footer-map-canvas {
        height: 75px;
    }
    .blue-info-section {
        padding-top: 24px;
    }
    .blue-container {
        padding: 0 10px 20px;
        gap: 14px;
    }
    .blue-col h4 {
        font-size: 0.9rem;
    }
    .blue-col p {
        font-size: 0.8rem;
    }
    .copyright-bar {
        padding: 10px 10px;
        font-size: 0.65rem;
    }
}

/* Blue footer (legacy - se ancora presente) */
@media (max-width: 900px) {
    .blue-container {
        grid-template-columns: 1fr 1fr;
        gap: 24px;
        padding: 0 16px 48px;
    }
}

@media (max-width: 600px) {
    .blue-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .blue-col h4 {
        font-size: 1rem;
    }
    .blue-col p {
        font-size: 0.9rem;
    }
}

/* ========== SERVICE DETAIL PAGES ========== */
@media (max-width: 968px) {
    .service-detail-container {
        margin: 48px auto;
        padding: 0 20px;
    }
    .service-intro {
        font-size: 1.1rem;
        margin-bottom: 40px;
        text-align: center;
    }
    .info-title {
        font-size: 1.7rem;
        margin-top: 48px;
        margin-bottom: 16px;
        text-align: center;
    }
    .info-subtitle {
        text-align: center;
    }
}

@media (max-width: 768px) {
    .service-detail-container {
        margin: 32px auto;
        padding: 0 16px;
    }
    .service-intro {
        font-size: 1rem;
        margin-bottom: 32px;
        text-align: center;
    }
    .info-title {
        font-size: 1.5rem;
        margin-top: 36px;
        margin-bottom: 14px;
        padding-left: 0;
        text-align: center;
    }
    .info-subtitle {
        text-align: center;
    }
    .info-subtitle {
        font-size: 1.15rem;
    }
    .btn-prenota-wrap {
        margin-top: 32px;
    }
    .btn-prenota {
        padding: 12px 28px;
        font-size: 0.95rem;
    }
}

@media (max-width: 600px) {
    .info-table th,
    .info-table td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    .info-table th {
        font-size: 0.8rem;
    }
    .table-note {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .info-table th,
    .info-table td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
}

/* ========== POOL NEWS SECTION ========== */
@media (max-width: 768px) {
    .pool-news-section {
        padding: 48px 16px;
    }
    .pool-news-header h2 {
        font-size: 2rem;
    }
    .pool-news-list .news-item {
        padding-bottom: 24px;
    }
}

/* ========== LOGIN PAGE ========== */
@media (max-width: 768px) {
    .login-container {
        padding: 24px 16px;
    }
    .login-box {
        width: 100%;
        max-width: 100%;
        padding: 28px 20px;
    }
    .login-box h1 {
        font-size: 1.8rem;
    }
    .form-group input {
        padding: 12px 16px;
    }
    .btn-primary {
        padding: 12px 24px;
    }
}

/* ========== PRIVACY & COOKIE POLICY ========== */
@media (max-width: 768px) {
    .privacy-container,
    .cookie-container {
        padding: 24px 16px;
        margin: 20px auto;
    }
    .privacy-header h1,
    .cookie-header h1 {
        font-size: 1.8rem;
    }
    .privacy-content h2,
    .cookie-content h2 {
        font-size: 1.3rem;
    }
    .privacy-content h3,
    .cookie-content h3 {
        font-size: 1.1rem;
    }
}

/* ========== ADMIN PAGES ========== */
@media (max-width: 968px) {
    .admin-container {
        padding: 24px 16px;
    }
    .admin-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    .admin-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-header-left h1 {
        font-size: 1.5rem;
    }
    .admin-news-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .news-form-card,
    .news-list-card {
        padding: 20px 16px;
    }
    .confirm-box {
        width: 90%;
        max-width: none;
        padding: 24px 20px;
    }
    .course-detail-panel {
        width: 95%;
        max-width: none;
        padding: 24px 20px;
    }
}

/* ========== SAFE AREA (notch / home indicator - iPhone X+ e Android) ========== */
@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        .top-bar,
        .top-bar-fixed {
            padding-top: max(12px, env(safe-area-inset-top));
            padding-left: max(16px, env(safe-area-inset-left));
            padding-right: max(16px, env(safe-area-inset-right));
        }
        .nav-menu {
            padding-top: max(72px, calc(72px + env(safe-area-inset-top))) !important;
        }
        .news-section,
        .pools-section,
        .welcome-section {
            padding-left: max(16px, env(safe-area-inset-left));
            padding-right: max(16px, env(safe-area-inset-right));
        }
        .site-footer {
            padding-bottom: max(16px, env(safe-area-inset-bottom));
        }
        .copyright-bar {
            padding-bottom: max(12px, env(safe-area-inset-bottom));
        }
        .pool-hero,
        .service-detail-container {
            padding-left: max(16px, env(safe-area-inset-left));
            padding-right: max(16px, env(safe-area-inset-right));
        }
    }
}

/* ============================================================
   TABELLA ORARI -> schede impilate su telefono
   ============================================================ */
@media (max-width: 600px) {
    .info-table { border: none; box-shadow: none; border-radius: 0; background: transparent; overflow: visible; }
    .info-table thead { display: none; }
    .info-table, .info-table tbody, .info-table tr, .info-table td { display: block; width: 100%; }
    .info-table tr { background: #fff !important; border: 1px solid #e4e9ee; border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
    .info-table td { border: none !important; padding: 5px 0 !important; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 0.9rem !important; color: #5a6672; }
    .info-table td::before { content: attr(data-label); color: #9aa6b1; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.3px; }
    .info-table td.info-day { display: block; font-family: 'Syne', sans-serif; font-weight: 700; font-size: 1.05rem !important; color: #16324f; padding: 0 0 8px 0 !important; margin-bottom: 6px; border-bottom: 1px solid #eef1f4 !important; }
    .info-table td.info-day::before { display: none; }
}
