/* Reset e Base */
*, *::before, *::after {
    box-sizing: border-box;
    touch-action: manipulation;
}

:root {
    --sidebar-width: 215px;
    --primary-color: #ff6600;
    --primary-color-rgb: 255, 102, 0;
    --bg-dark: #1a1a1a;
    --bg-card: #262626;
    --text-white: #ffffff;
    --text-gray: #a0a0a0;
    --text-muted: #ccc;
    
    /* Typography */
    --font-main: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --fs-h1: 32px;
    --fs-h1-mobile: 26px;
    --fs-h2: 24px;
    --fs-h2-mobile: 20px;
    --fs-body: 16px;
    --fs-small: 14px;
    --fs-tiny: 12px;
}

.hidden {
    display: none !important;
}

.d-block {
    display: block !important;
}

.mt-20 {
    margin-top: 20px !important;
}

.mb-10 {
    margin-bottom: 10px !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.fs-small {
    font-size: var(--fs-small) !important;
}

html {
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-white);
    overflow-x: hidden;
    font-size: var(--fs-body);
}

/* Responsive Global Scaling - DISABILITATO PER PROBLEMI SIDEBAR */
/* @media (max-width: 1200px) {
    body {
        zoom: 0.9; 
        -moz-transform: scale(0.9);
        -moz-transform-origin: 0 0;
    }
}

@media (max-width: 992px) {
    body {
        zoom: 0.85;
        -moz-transform: scale(0.85);
    }
    :root {
        --sidebar-width: 0px !important; 
    }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        transition: margin-left 0.3s ease;
    }
}

@media (max-width: 768px) {
    body {
        zoom: 0.8; 
        -moz-transform: scale(0.8);
    }
    
    .navbar {
        padding: 10px;
    }
    
    .sidebar-toggle-btn {
        top: 10px;
        left: 2px;
        padding: 8px;
    }
}

@media (max-width: 480px) {
    body {
        zoom: 0.75; 
        -moz-transform: scale(0.75);
    }
} */

/* Manteniamo solo le regole necessarie per la sidebar mobile senza lo zoom */
@media (max-width: 768px) {
    .navbar {
        padding: 10px;
    }
}

/* Common Header Style for internal pages */
.content-header {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 40px auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
}

.content-header h1 {
    color: var(--primary-color);
    font-size: var(--fs-h1);
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
    font-family: var(--font-main);
}

@media (max-width: 992px) {
    .main-content {
        padding-top: 15px !important;
    }

    .content-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        justify-content: center;
        padding: 0 20px !important;
        margin-bottom: 30px;
    }

    .content-header h1 {
        margin: 0;
        width: 100%;
        max-width: 100%;
        font-size: var(--fs-h1-mobile);
        line-height: 1.2;
        white-space: normal;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding-top: 10px !important;
    }

    .content-header h1 {
        line-height: 45px; /* Align with smaller sidebar toggle button (45px at top: 10px) */
    }
}

/* Hero Section */
.hero-section {
    position: relative;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero-bg-img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    filter: brightness(0.4) grayscale(100%);
}

.navbar {
    position: absolute;
    top: 0;
    width: 100%;
    padding: 20px 20px; /* Reintrodotto un leggero padding orizzontale */
    box-sizing: border-box;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Desktop Navigation */
.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    flex-grow: 1; /* Assicura che i link occupino lo spazio disponibile */
    justify-content: flex-start; /* Allinea i link a sinistra */
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    padding: 8px 0;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #ff6600;
}

.login-btn {
    background: #ff6600;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.login-btn:hover {
    background-color: #e65c00;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.3);
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 6px;
    z-index: 1000;
}

.hamburger span {
    width: 30px;
    height: 3px;
    background: white;
    border-radius: 3px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .navbar {
        padding: 20px 20px;
    }
    
    .hamburger {
        display: flex;
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        width: 200px;
        background: rgba(0, 0, 0, 0.95);
        flex-direction: column;
        justify-content: center;
        gap: 30px;
        padding: 20px;
        box-sizing: border-box;
        z-index: 999;
        transform: translateX(100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .nav-links.active {
        transform: translateX(0);
    }
    
    .login-btn {
        display: flex;
        padding: 8px 20px;
        font-size: 14px;
    }
    
    /* Animazione hamburger in X */
    .hamburger.active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }
    
    .hamburger.active span:nth-child(2) {
        opacity: 0;
        transform: translateX(-20px);
    }
    
    .hamburger.active span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }
}

/* Hero Content Styles */
.hero-content h1 {
    font-size: clamp(40px, 8vw, 80px);
    margin-bottom: 20px;
    font-weight: 300;
    text-transform: capitalize;
    letter-spacing: 2px;
    padding: 0 20px;
}

.hero-content p {
    font-size: clamp(16px, 2.5vw, 24px); /* Leggermente più grande */
    margin-bottom: 40px;
    opacity: 0.9;
    line-height: 1.6;
    padding: 0 20px;
}

.hero-content .cta-btn {
    background-color: #ff6600;
    color: white;
    border: none;
    padding: clamp(12px, 2vw, 20px) clamp(30px, 5vw, 50px);
    border-radius: 50px;
    cursor: pointer;
    font-size: clamp(16px, 2vw, 20px);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.3);
}

/* Responsive Hero Section - Semplificato grazie a clamp */
@media (max-width: 768px) {
    .hero-section {
        height: 80vh; /* Ridotta altezza su mobile per focus */
    }
}

.hero-content .cta-btn:hover {
    background-color: #e65c00;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 102, 0, 0.4);
}

/* Features Overview Section */
.features-overview {
    padding: 80px 20px 100px; /* Aumentato padding inferiore */
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.features-header {
    text-align: center;
    margin-bottom: 50px;
}

.feature-number {
    font-size: 82px;
    font-weight: 800;
    color: #ff6600;
    line-height: 1;
    text-shadow: 0 0 20px rgba(255, 102, 0, 0.3);
}

.feature-suffix {
    display: block;
    font-size: 20px;
    color: #ff6600;
    font-weight: 700;
    margin-top: 10px;
    letter-spacing: 2px;
}

.features-grid {
    display: flex;
    gap: 20px;
    width: 100%;
    justify-content: center;
}

.feature-small-card {
    flex: 1;
    background: #252525;
    padding: 30px 20px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid #333;
    transition: transform 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    will-change: transform; /* Ottimizzazione GPU */
}

.feature-small-card:hover {
    transform: translateY(-5px);
    border-color: #ff6600;
}

.feature-small-card i {
    font-size: 40px;
    color: #ff6600;
    margin-bottom: 20px;
}

.feature-small-card h3 {
    font-size: 16px;
    margin-bottom: 12px;
    font-weight: 700;
}

.feature-small-card p {
    font-size: 14px;
    color: #aaa;
    line-height: 1.5;
}

/* Responsive: Keep side-by-side */
@media (max-width: 768px) {
    .features-overview {
        padding: 20px 20px 40px; /* Ridotto per spostare il counter su e avvicinare le card sotto */
    }

    .features-header {
        margin-bottom: 30px;
    }

    .feature-number {
        font-size: clamp(36px, 10vw, 48px);
    }
    
    .feature-suffix {
        font-size: clamp(10px, 3vw, 14px);
    }
    
    .features-grid {
        gap: 12px;
        padding: 0 10px;
    }
    
    .feature-small-card {
        padding: 20px 10px;
        border-radius: 15px;
    }
    
    .feature-small-card i {
        font-size: clamp(24px, 6vw, 32px);
        margin-bottom: 12px;
    }
    
    .feature-small-card h3 {
        font-size: clamp(10px, 2.5vw, 14px);
        margin-bottom: 8px;
    }
    
    .feature-small-card p {
        font-size: clamp(9px, 2.2vw, 12px);
        line-height: 1.4;
    }
}

/* Skeleton Loader Animation */
@keyframes skeleton-loading {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

.skeleton {
    background: linear-gradient(90deg, #252525 25%, #333 50%, #252525 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite linear;
    border-radius: 12px;
}

.exercise-skeleton-card {
    height: 300px;
    width: 100%;
    border-radius: 20px;
    background: #252525;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.skeleton-img { height: 180px; width: 100%; border-radius: 12px; }
.skeleton-title { height: 24px; width: 70%; border-radius: 4px; }
.skeleton-text { height: 16px; width: 90%; border-radius: 4px; }

/* Info Section */
.info-section {
    padding: 60px 20px;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    gap: 60px;
    max-width: 1200px;
    margin: 0 auto;
}

.info-divider {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, #333, transparent);
    width: 100%;
    margin: 0;
}

.info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 80px;
    width: 100%;
}

.info-row.reverse {
    flex-direction: row-reverse;
}

.info-text {
    flex: 1;
    text-align: left;
}

.info-text h2 {
    font-size: 38px;
    color: white;
    margin-bottom: 25px;
    line-height: 1.2;
    font-weight: 700;
}

.info-text p {
    font-size: 18px;
    color: #ccc;
    line-height: 1.7;
    margin-bottom: 20px;
}

.cta-link-simple,
.cta-link-simple:visited {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 18px;
    transition: gap 0.3s ease;
}

.cta-link-simple:hover {
    gap: 15px;
}

.cta-link-simple i {
    font-size: 16px;
}

.info-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-placeholder {
    padding: 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    position: relative;
    max-width: 500px;
    width: 100%;
    height: 400px; /* Altezza fissa per uniformità tra PC e Smartphone */
}

.image-placeholder img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 10px 30px rgba(0,0,0,0.5)); /* Ritorno al drop-shadow per far risaltare l'immagine nuda */
}

.image-placeholder:hover img {
    transform: scale(1.05);
}

/* Effetti rimosi per pulizia */

/* Responsive: NO stacking, keep side-by-side as requested */
@media (max-width: 992px) {
    .info-text h2 {
        font-size: 28px;
    }
    
    .info-text p {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .info-section {
        padding: 20px 15px; /* Ridotto da 40px */
        gap: 30px; /* Ridotto da 50px */
    }
    
    .info-row {
        gap: 20px;
    }
    
    .info-text h2 {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .info-text p {
        font-size: 12px;
        line-height: 1.5;
    }
    
    .image-placeholder {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .info-section {
        padding: 30px 10px;
        gap: 40px;
    }
    
    .info-row {
        gap: 15px;
    }
    
    .info-text h2 {
        font-size: 15px;
    }
    
    .info-text p {
        font-size: 10px;
    }

    .image-placeholder {
        height: 180px;
    }
}

/* Showcase Section */
.exercise-showcase-section {
    height: 100dvh;
    padding: 2vh 20px;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    content-visibility: auto; /* Ottimizzazione rendering browser */
    contain-intrinsic-size: 1px 1000px;
}

.exercise-showcase-section .section-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.exercise-showcase {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.exercise-showcase h3 {
    font-size: clamp(1.5rem, 4vh, 2.5rem);
    color: #ff6600;
    margin-bottom: 1vh;
    flex-shrink: 0;
    text-align: center;
}

/* Search Bar - Ripristinata Intera */
.search-container {
    margin-bottom: 2vh;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
}

.search-bar {
    width: 100%;
    max-width: 500px;
    padding: clamp(10px, 1.5vh, 15px) 25px;
    border-radius: 50px;
    border: 2px solid #333;
    background: #252525;
    color: white;
    font-size: clamp(0.9rem, 1.8vh, 1.1rem);
    outline: none;
    transition: all 0.3s ease;
}

.search-bar:focus {
    border-color: #ff6600;
    box-shadow: 0 0 15px rgba(255, 102, 0, 0.2);
}

/* Grid 3x3 Rigorous */
.exercise-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 1.5vh;
    flex-grow: 1;
    width: 100%;
    overflow: hidden;
    margin-bottom: 2vh;
}

.exercise-item {
    background: #1E1E1E;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    width: 100%;
    max-width: 180px; /* Ridotta larghezza massima per renderli meno larghi */
    justify-self: center; /* Centra la card nella sua cella di griglia */
    position: relative;
    will-change: transform; /* Ottimizzazione GPU */
}

.exercise-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 102, 0, 0.2);
}

.exercise-image {
    width: 100%;
    height: 70%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white; /* Ripristinato Sfondo Bianco */
    padding: 0;
}

.exercise-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.exercise-info {
    height: 30%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5vh 1vh;
    background: rgba(0, 0, 0, 0.2);
}

.exercise-info h4 {
    color: #ff6600;
    margin: 0;
    font-size: clamp(0.8rem, 1.8vh, 1.1rem);
    text-align: center;
    font-weight: 600;
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Pagination Modernized */
.pagination {
    margin-top: auto;
    padding: 1vh 0;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
}

.pagination-controls {
    display: flex;
    gap: 1vh;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.page-btn {
    background: #252525;
    color: #888;
    border: 1px solid #333;
    width: clamp(30px, 5vh, 45px);
    height: clamp(30px, 5vh, 45px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: clamp(0.7rem, 1.5vh, 0.9rem);
    padding: 0;
}

.page-btn.prev-btn,
.page-btn.next-btn {
    width: auto;
    border-radius: 20px;
    padding: 0 2vh;
}

.page-btn.prev-btn i {
    margin-right: 8px;
}

.page-btn.next-btn i {
    margin-left: 8px;
}

.page-btn:hover:not(:disabled) {
    background: #333;
    color: #ff6600;
    border-color: #ff6600;
}

.page-btn.active {
    background: #ff6600;
    color: white;
    border-color: #ff6600;
    box-shadow: 0 0 15px rgba(255, 102, 0, 0.3);
}

.page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-ellipsis {
    color: #666;
    font-size: clamp(0.7rem, 1.5vh, 0.9rem);
    padding: 0 0.5vh;
}

.results-info {
    color: #666;
    font-size: clamp(0.7rem, 1.4vh, 0.8rem);
    text-align: center;
    margin-bottom: 1vh;
    flex-shrink: 0;
}

/* Responsività Griglia 3x3 per Mobile */
@media (max-width: 768px) {
    .exercise-showcase-section {
        padding: 2vh 15px;
    }
    
    .exercise-grid {
        gap: 1.5vh;
        padding: 0 5px; /* Aggiunto padding per rimpicciolire leggermente la griglia */
    }
    
    .exercise-info {
        padding: 0.3vh 0.5vh;
    }
    
    .page-btn {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
    }

    .pagination-controls {
        gap: 8px;
    }

    .page-btn.prev-btn,
    .page-btn.next-btn {
        padding: 0 12px;
    }
}

@media (max-width: 480px) {
    .pagination-controls {
        gap: 5px;
    }

    .page-btn {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .page-btn.prev-btn,
    .page-btn.next-btn {
        padding: 0;
        width: 30px;
        height: 30px;
        border-radius: 50%;
    }

    .page-btn.prev-btn .btn-text,
    .page-btn.next-btn .btn-text,
    .page-btn.prev-btn i,
    .page-btn.next-btn i {
        margin: 0;
    }

    .page-btn.prev-btn .btn-text,
    .page-btn.next-btn .btn-text {
        display: none;
    }
    
    .page-ellipsis {
        padding: 0 2px;
    }
}


/* Exercise Detail Popup Styles - Unique Classes */
.ex-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: none; /* Torniamo a none per performance */
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ex-popup-overlay.active {
    display: flex;
    opacity: 1;
}

.ex-popup-card {
    background: #1a1a1a;
    border: 1px solid rgba(255, 102, 0, 0.3);
    border-radius: 24px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.9);
    transform: scale(0.98); /* Meno scatto iniziale */
    transition: transform 0.25s ease;
    position: relative;
    pointer-events: auto;
}

.ex-popup-overlay.active .ex-popup-card {
    transform: scale(1);
}

.ex-popup-header {
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.3);
}

.ex-popup-exercise-name {
    color: #ff6600;
    margin: 0;
    font-size: clamp(1.2rem, 3vh, 1.6rem);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ex-close-popup-btn {
    /* Styles are now handled by universal rules in popup.css */
}

.ex-popup-image-container {
    width: 100%;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2vh;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 102, 0, 0.1);
}

.ex-popup-exercise-gif {
    max-width: 100%;
    max-height: 35vh;
    object-fit: contain;
    
    /* Force GPU Acceleration to prevent the GIF from pausing on some mobile devices */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    perspective: 1000px;
}

.ex-popup-content {
    padding: 2vh 25px;
    overflow-y: auto;
    flex-grow: 1;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(255,102,0,0.02) 100%);
    display: flex;
    flex-direction: column;
}

.ex-guide-section {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.ex-guide-separator {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 1.5vh;
    flex-shrink: 0;
}

.ex-guide-separator span {
    color: #ff6600;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.85rem;
}

.ex-guide-separator::after {
    content: '';
    flex-grow: 1;
    height: 1px;
    background: linear-gradient(to right, rgba(255, 102, 0, 0.4), transparent);
}

.ex-stepper-container {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-grow: 1;
    min-height: 100px;
}

.ex-nav-btn {
    background: #252525;
    border: 1px solid #333;
    color: #ff6600;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ex-nav-btn:hover:not(:disabled) {
    background: #ff6600;
    color: white;
}

.ex-nav-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    border-color: #222;
}

.ex-popup-exercise-description {
    color: #eee;
    line-height: 1.6;
    font-size: clamp(0.9rem, 1.8vh, 1.05rem);
    flex-grow: 1;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.ex-step-counter {
    text-align: center;
    color: #666;
    font-size: 0.8rem;
    margin-top: 1.5vh;
    font-weight: 600;
    letter-spacing: 1px;
}

/* Popup Mobile Responsiveness */
@media (max-width: 768px) {
    .ex-popup-card {
        max-height: 85vh;
        width: 95%;
        border-radius: 20px;
        margin: auto;
    }
    
    .ex-popup-header {
        padding: 12px 15px;
    }
    
    .ex-popup-exercise-name {
        font-size: 1.1rem;
    }
    
    .ex-popup-image-container {
        padding: 1vh;
    }
    
    .ex-popup-exercise-gif {
        max-height: 25vh;
    }
    
    .ex-popup-content {
        padding: 15px;
    }
    
    .ex-stepper-container {
        gap: 10px;
    }
    
    .ex-nav-btn {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
}

.loading, .error {
    font-size: clamp(1rem, 2vh, 1.5rem);
    color: #ff6600;
    margin: auto;
    text-align: center;
    padding: 2vh;
}

.error {
    color: #ff4444;
}

hr {
    border: 0;
    border-top: 1px solid #333;
}

/* Utility class to hide elements */
.hidden {
    display: none !important;
}

/* Pricing Section */
.pricing-section {
    padding: 80px 20px;
    background: #121212;
    width: 100%;
    margin: 0 auto;
    overflow: hidden;
    box-sizing: border-box;
}

.section-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.section-title {
    font-size: clamp(28px, 5vw, 42px);
    color: white;
    text-align: center;
    margin-bottom: 12px;
    font-weight: 800;
}

.section-subtitle {
    font-size: clamp(14px, 2vw, 16px);
    color: #888;
    text-align: center;
    margin-bottom: 40px;
    font-weight: 400;
    padding: 0 15px;
}

/* Pricing Toggle */
.pricing-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    margin: 0 auto 50px;
    width: fit-content;
    padding: 12px 35px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toggle-label {
    font-size: 14px;
    color: #888;
    font-weight: 700;
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
}

.toggle-label.active {
    color: white;
}

.discount-badge {
    background: rgba(255, 102, 0, 0.2);
    color: #ff6600;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 800;
    margin-left: 10px;
    box-shadow: 0 2px 8px rgba(255, 102, 0, 0.2);
}

/* The switch */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #ff6600;
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Pricing Grid */
.pricing-grid {
    display: flex;
    gap: 25px;
    justify-content: center;
    align-items: stretch;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    flex-wrap: wrap; /* Permette di andare a capo su schermi piccoli */
}

.pricing-card {
    flex: 1 1 320px;
    max-width: 360px;
    background: #1c1c1c;
    border: 1px solid #2a2a2a;
    border-radius: 24px;
    padding: clamp(10px, 2vw, 15px) clamp(20px, 3vw, 30px) clamp(25px, 4vw, 35px); /* Ridotto ulteriormente il top padding */
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.pricing-card:hover {
    transform: translateY(-8px);
    border-color: #3a3a3a;
}

.pricing-card.popular {
    border: 2px solid #ff6600;
    background: linear-gradient(180deg, #1c1c1c 0%, #252525 100%);
    box-shadow: 0 20px 50px rgba(255, 102, 0, 0.15);
    transform: scale(1.05);
    z-index: 2;
}

.pricing-card.popular::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #ff6600, transparent, #ff6600);
    border-radius: 24px;
    z-index: -1;
    opacity: 0.3;
    animation: border-glow 3s linear infinite;
}

@keyframes border-glow {
    0% { opacity: 0.2; }
    50% { opacity: 0.5; }
    100% { opacity: 0.2; }
}

.pricing-card.popular:hover {
    transform: scale(1.05) translateY(-8px);
}

.popular-badge {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff6600;
    color: white;
    padding: 6px 18px;
    border-radius: 50px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
    z-index: 2;
    box-shadow: 0 4px 10px rgba(255, 102, 0, 0.4);
}

.card-header {
    text-align: center;
    margin-bottom: 2px; /* Ridotto ulteriormente */
}

.card-header h3 {
    font-size: clamp(18px, 2.5vw, 24px);
    color: white;
    margin: 0; /* Reset margins */
    font-weight: 700;
    text-transform: uppercase;
}

.card-tagline {
    font-size: clamp(12px, 1.5vw, 14px);
    color: #888;
    margin: 0; /* Reset margins */
}

.price {
    font-size: clamp(28px, 4.5vw, 40px);
    font-weight: 800;
    color: #ff6600;
    display: flex;
    align-items: baseline;
    justify-content: center;
    margin: 5px 0 0 0; /* Ridotto margin superiore */
    padding-top: 0; 
    border-top: none;
}

.price span {
    font-size: 14px;
    color: #888;
    font-weight: 400;
    margin-left: 5px;
}

.billing-info {
    font-size: 12px;
    color: #888;
    margin: -5px 0 5px 0; /* Ridotto margin bottom */
    text-align: center;
    font-weight: 400;
}

.savings-info {
    font-size: 0.85rem;
    color: #ff6600; /* Arancione */
    font-weight: 600;
    margin: 0 0 12px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
}

.savings-info:empty {
    display: none;
}

.savings-info .discount-text {
    background: rgba(255, 102, 0, 0.1); /* Sfondo arancione leggero */
    padding: 2px 8px;
    border-radius: 4px;
}

.savings-info .total-savings {
    font-size: 0.75rem;
    opacity: 0.9;
}

.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.features {
    list-style: none;
    padding: 0;
    margin: 0 0 clamp(20px, 3vw, 30px) 0;
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 1.5vw, 14px);
}

.features li {
    font-size: clamp(12px, 1.5vw, 14px);
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ccc;
    line-height: 1.4;
}

.features i {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ff6600;
    color: white;
    font-size: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.features li.not-included {
    color: #666;
}

.features li.not-included i {
    background: #333;
    color: #666;
}

.card-footer-info {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 12px;
    margin-top: auto;
    margin-bottom: 30px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.card-footer-info p {
    font-size: 12px;
    color: #777;
    margin: 0;
    line-height: 1.4;
}

.pricing-btn {
    width: 100%;
    padding: 16px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #ff6600;
    background: transparent;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.pricing-btn:hover {
    background: #ff6600;
    box-shadow: 0 5px 15px rgba(255, 102, 0, 0.3);
}

.popular .pricing-btn {
    background: #ff6600;
    box-shadow: 0 4px 15px rgba(255, 102, 0, 0.4);
    animation: pulse-button 2.5s infinite;
    position: relative;
    overflow: hidden;
}

.popular .pricing-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 20%;
    height: 200%;
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(30deg);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -60%; }
    20% { left: 120%; }
    100% { left: 120%; }
}

@keyframes pulse-button {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

/* Loading State for Buttons */
.btn-loading {
    position: relative !important;
    pointer-events: none !important;
    opacity: 0.8 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    overflow: hidden !important;
}

.btn-loading .btn-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.4);
    width: 100%;
    animation: btn-progress-loading 2s cubic-bezier(0.1, 0, 0.1, 1) forwards;
}

@keyframes btn-progress-loading {
    from { width: 0%; }
    to { width: 100%; }
}

.btn-loading i.fa-spinner {
    animation: fa-spin 1s linear infinite;
}

.popular .pricing-btn:hover {
    background: #e65c00;
    transform: scale(1.05) !important;
    animation: none;
}

/* Mobile Layout Controls */
.mobile-plan-selector {
    display: none;
    justify-content: center;
    gap: 12px;
    margin-bottom: 35px;
    padding: 0 15px;
}

.mobile-plan-btn {
    flex: 1;
    min-width: 90px;
    max-width: 110px;
    background: #1c1c1c;
    border: 1px solid #2a2a2a;
    color: #888;
    padding: 15px 10px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.mobile-plan-btn .plan-name {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.mobile-plan-btn .plan-price {
    font-size: 14px;
    font-weight: 700;
}

.mobile-plan-btn.active {
    background: #252525;
    color: white;
    border-color: #444;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Evidenzia il bottone PT nel selettore mobile */
.mobile-plan-btn[data-plan="pt"] {
    border-color: rgba(255, 102, 0, 0.4);
    background: linear-gradient(145deg, #222, #1c1c1c);
    border-width: 1.5px;
}

.mobile-plan-btn[data-plan="pt"].active {
    background: #ff6600;
    border-color: #ff6600;
    color: white;
    box-shadow: 0 0 20px rgba(255, 102, 0, 0.4);
    animation: pulse-orange 2s infinite;
}

@keyframes pulse-orange {
    0% { box-shadow: 0 0 0 0 rgba(255, 102, 0, 0.5); }
    70% { box-shadow: 0 0 0 10px rgba(255, 102, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 102, 0, 0); }
}

.mobile-plan-btn[data-plan="pt"]::after {
    content: 'BEST';
    position: absolute;
    top: 0;
    right: 0;
    background: #ff6600;
    color: white;
    font-size: 7px;
    font-weight: 900;
    padding: 2px 6px;
    border-bottom-left-radius: 8px;
    opacity: 0.8;
}

/* Rimuovi evidenziazione da PRO */
.mobile-plan-btn[data-plan="pro"] {
    border-color: #2a2a2a;
    background: #1c1c1c;
}

.mobile-plan-btn[data-plan="pro"].active {
    background: #ff6600;
    border-color: #ff6600;
    color: white;
}

@media (max-width: 768px) {
    .pricing-toggle-container {
        gap: 15px;
        padding: 10px 20px;
        width: fit-content;
        max-width: 100%;
    }

    .toggle-label {
        font-size: 13px;
    }

    .discount-badge {
        padding: 3px 8px;
        font-size: 9px;
        margin-left: 6px;
    }

    .switch {
        width: 40px;
        height: 20px;
        flex-shrink: 0;
    }

    .slider:before {
        height: 14px;
        width: 14px;
        left: 3px;
        bottom: 3px;
    }

    input:checked + .slider:before {
        transform: translateX(20px);
    }
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
    .pricing-grid {
        gap: 20px;
        padding: 0 15px;
    }
    .pricing-card {
        padding: 35px 20px;
    }
}

@media (max-width: 860px) {
    .pricing-grid {
        gap: 15px;
    }
    .pricing-card {
        min-width: 250px;
        padding: 30px 15px;
    }
}

@media (max-width: 768px) {
    .pricing-section {
        padding: 40px 0; /* Rimosso padding orizzontale per gestire margini card manualmente */
    }

    .section-title {
        font-size: clamp(24px, 6vw, 28px);
        margin-bottom: 10px;
        padding: 0 20px;
    }

    .section-subtitle {
        margin-bottom: 30px;
    }

    .mobile-plan-selector {
        display: flex;
        margin-bottom: 35px;
        justify-content: center;
        padding: 0 15px;
        gap: 12px;
    }

    .mobile-plan-btn {
        min-width: 90px;
        padding: 15px 10px;
        border-radius: 16px;
    }

    .pricing-grid {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0;
        min-height: auto;
        padding: 0 20px; /* Padding laterale per evitare che tocchino i bordi */
    }

    .pricing-card {
        display: none;
        width: 100%;
        max-width: 340px;
        margin: 0 auto;
        opacity: 0;
        transform: translateY(10px);
        transition: all 0.4s ease;
        padding: 20px 20px 30px; /* Ridotto top padding su mobile */
        background: #1c1c1c;
        border: 1px solid #2a2a2a;
    }

    .pricing-card.active {
        display: flex;
        opacity: 1;
        transform: translateY(0);
    }

    .pricing-card.popular {
        border: 2px solid #ff6600;
        transform: translateY(10px); /* Reset desktop scale */
        box-shadow: 0 10px 30px rgba(255, 102, 0, 0.15);
    }

    .pricing-card.popular.active {
        transform: translateY(0); /* Rimosso scale su mobile per evitare ritagli */
    }

    .price {
        font-size: 32px;
        padding-top: 0; /* Rimossa padding per avvicinare tagline */
        margin-top: 0;
    }

    .card-header {
        margin-bottom: 8px; /* Ridotto da 12px */
    }

    .card-header h3 {
        font-size: 18px;
    }

    .features {
        gap: 12px;
        margin-bottom: 25px;
    }

    .features li {
        font-size: 13px;
    }

    .card-footer-info {
        padding: 15px;
        margin-bottom: 25px;
    }
}

@media (max-width: 480px) {
    .pricing-section {
        padding: 30px 0;
    }
    
    .pricing-grid {
        padding: 0 15px;
    }

    .pricing-card {
        padding: 25px 15px;
        max-width: 100%; /* Permette alla card di occupare lo spazio disponibile con il padding del grid */
    }
    
    .price {
        font-size: 28px;
    }
    
    .mobile-plan-selector {
        gap: 6px;
    }
    
    .mobile-plan-btn {
        min-width: 70px;
        font-size: 11px;
    }
}

/* FAQ Section */
.faq-section {
    padding: 80px 20px;
    background: #1a1a1a;
}

.faq-grid {
    max-width: 800px;
    margin: 40px auto 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.faq-item {
    background: #252525;
    border-radius: 15px;
    border: 1px solid #333;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item:hover {
    border-color: #ff6600;
}

.faq-question {
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.faq-question h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
    transition: color 0.3s ease;
}

.faq-question i {
    color: #ff6600;
    transition: transform 0.3s ease;
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-item.active .faq-question h3 {
    color: #ff6600;
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease;
    background: rgba(0, 0, 0, 0.1);
}

.faq-item.active .faq-answer {
    max-height: 500px; /* Sufficient height */
    padding: 0 25px 20px;
}

.faq-answer p {
    margin: 0;
    color: #aaa;
    line-height: 1.6;
    font-size: 16px;
}

@media (max-width: 768px) {
    .faq-section {
        padding: 40px 15px;
    }
    
    .faq-question h3 {
        font-size: 16px;
    }
    
    .faq-answer p {
        font-size: 14px;
    }
}
