/**
 * Scuola dell'Acqua - Attività Plugin
 * Frontend Styles
 * Version: 1.0.0
 */

/* ========================================
   Gallery Wrapper
   ======================================== */

.saa-gallery-wrapper {
    width: 100%;
    margin: 0 auto;
}

.saa-gallery-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px 0;
}

/* Tablet: 2 colonne */
@media (min-width: 768px) {
    .saa-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
}

/* Laptop: 3 colonne */
@media (min-width: 1024px) {
    .saa-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 28px;
    }
}

/* Desktop: 4 colonne */
@media (min-width: 1440px) {
    .saa-gallery-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
}

/* ========================================
   Gallery Item
   ======================================== */

.saa-gallery-item {
    position: relative;
    border-radius: 25px;
    overflow: hidden;
    background: #FFFFFF;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    width: 100%;
    aspect-ratio: 1 / 1;
}

.saa-gallery-item-inner {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ========================================
   Category Badge
   ======================================== */

.saa-category-badge {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    width: 100%;
    height: 25px;
    display: flex;
    align-items: center;
    padding-left: 20px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.26px;
    border-radius: 0 25px 25px 0;
    background-color: #0067e5;
    color: #FFFFFF;
    box-shadow: none;
}

/* ========================================
   Gallery Item Image
   ======================================== */

.saa-gallery-item-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #F5F5F5;
}

.saa-gallery-item-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
    z-index: 1;
}

.saa-gallery-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========================================
   Gallery Item Content
   ======================================== */

.saa-gallery-item-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px 25px 25px 25px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2;
}

.saa-gallery-item-title {
    font-size: 24px;
    font-weight: 900;
    color: #FFFFFF;
    text-transform: uppercase;
    letter-spacing: -0.48px;
    margin: 0;
    line-height: 1.2;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.saa-gallery-item-subtitle {
    font-size: 15px;
    font-weight: 700;
    color: #FFFFFF;
    text-transform: uppercase;
    letter-spacing: -0.3px;
    margin: 0;
    line-height: 1.3;
    opacity: 0.95;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.saa-gallery-item-hashtag {
    font-size: 14px;
    font-weight: 400;
    color: #FFFFFF;
    margin: 0;
    font-style: italic;
    opacity: 0.8;
}

.saa-gallery-item-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 0;
    margin-top: 5px;
    width: 100%;
    max-width: 377px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.26px;
    color: #FFFFFF;
    background-color: transparent;
    border: 1.5px solid #FFFFFF;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    text-align: center;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.saa-gallery-item-button:hover {
    background-color: #FFFFFF;
    border-color: #FFFFFF;
    color: #1A1A1A;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.4);
    text-decoration: none;
}

/* ========================================
   Responsive Typography and Spacing
   ======================================== */

/* Tablet adjustments */
@media (max-width: 768px) {
    .saa-gallery-item-content {
        padding: 25px 20px 20px 20px;
    }

    .saa-category-badge {
        height: 22px;
        padding-left: 16px;
        font-size: 11px;
    }

    .saa-gallery-item-title {
        font-size: 20px;
    }

    .saa-gallery-item-subtitle {
        font-size: 13px;
    }

    .saa-gallery-item-button {
        font-size: 11px;
    }
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .saa-gallery-item-content {
        padding: 20px 18px 18px 18px;
    }

    .saa-gallery-item-title {
        font-size: 18px;
    }

    .saa-gallery-item-subtitle {
        font-size: 13px;
    }

    .saa-gallery-item-button {
        font-size: 10px;
    }
}

/* ========================================
   Single Attività Page
   ======================================== */

.single-attivita .entry-header {
    margin-bottom: 40px;
}

.single-attivita .saa-activity-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 20px 0;
    padding: 20px;
    background: #F9F9F9;
    border-radius: 10px;
}

.single-attivita .saa-activity-subtitle {
    font-size: 16px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.single-attivita .saa-activity-hashtag {
    font-size: 14px;
    color: #999;
    font-style: italic;
}

/* ========================================
   Utilities
   ======================================== */

.saa-loading {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.saa-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
}

/* ========================================
   MODAL SYSTEM - RESPONSIVE
   ======================================== */

/* Blocca scroll body quando modal aperto */
body.saa-modal-open {
    overflow: hidden;
    padding-right: var(--scrollbar-width, 0);
}

/* Modal Container */
.saa-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
}

.saa-modal.is-open {
    opacity: 1;
    visibility: visible;
}

/* Modal Overlay (Background sfocato/scuro) */
.saa-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Modal Container Box */
.saa-modal-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    z-index: 1;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.saa-modal.is-open .saa-modal-container {
    transform: scale(1);
}

/* Modal Content */
.saa-modal-content {
    position: relative;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 25px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
}

/* Bottone Chiusura (X) */
.saa-modal-close {
    position: absolute;
    top: 45px;
    right: 20px;
    z-index: 20;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    border: 1px solid #E0E0E0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.saa-modal-close:hover {
    background: #F5F5F5;
    border-color: #CCCCCC;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.saa-modal-close svg {
    width: 18px;
    height: 18px;
    color: #000000;
}

/* Modal Body (Scrollabile) */
.saa-modal-body {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 40px;
    -webkit-overflow-scrolling: touch;
}

.saa-modal-body::-webkit-scrollbar {
    width: 8px;
}

.saa-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.saa-modal-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.saa-modal-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Loading Spinner */
.saa-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.saa-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2459CF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.saa-modal-loading p {
    color: #666;
    font-size: 16px;
    margin: 0;
}

/* Modal Activity Content */
.saa-modal-activity-content {
    display: none;
}

/* Modal Badge Top - Full Width (come card) */
.saa-modal-badge-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 28px;
    display: flex;
    align-items: center;
    padding-left: 20px;
    padding-bottom: 2px;
    background-color: #FFD200;
    border-radius: 25px 25px 0 0;
    z-index: 10;
    font-size: 16px;
    font-weight: 700;
    color: #000000;
    letter-spacing: -0.32px;
    text-transform: uppercase;
}

.saa-modal-badge-top .saa-category-badge {
    position: static;
    background-color: transparent;
    padding: 0;
    height: auto;
    width: auto;
    color: #000000;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.32px;
}

/* Modal Header */
.saa-modal-header {
    margin-top: 45px;
    margin-bottom: 30px;
}

.saa-modal-title {
    font-size: 45px;
    font-weight: 900;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #13162B;
    text-transform: uppercase;
    letter-spacing: -0.9px;
    margin: 0 0 10px 0;
    line-height: 1.2;
    padding-right: 60px;
}

.saa-modal-subtitle {
    font-size: 14px;
    font-weight: 700;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #0067E5;
    text-transform: uppercase;
    letter-spacing: -0.28px;
    margin: 0 0 20px 0;
    line-height: 1.4;
}

.saa-modal-hashtag {
    font-size: 15px;
    font-weight: 400;
    color: #999999;
    margin: 0;
    font-style: italic;
}

.saa-modal-subtitle-blue {
    font-size: 18px;
    font-weight: 700;
    color: #2459CF;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 25px 0;
    line-height: 1.4;
}

/* Modal Image Container */
.saa-modal-image-container {
    position: relative;
    margin: 0 0 30px 0;
    width: 100%;
}

/* Modal Image */
.saa-modal-image {
    overflow: hidden;
    border-radius: 21px;
    width: 100%;
    max-height: 210px;
    aspect-ratio: 1037 / 210;
}

.saa-modal-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
}

/* Modal Logo */
.saa-modal-logo {
    position: absolute;
    top: 20px;
    left: 30px;
    z-index: 10;
    max-width: 120px;
    pointer-events: none;
}

.saa-modal-logo img {
    width: auto;
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

/* Logo VISITE GUIDATE più grande */
.saa-modal-logo img[src*="logo-visite-guidate"] {
    max-width: 200px;
}

/* Modal Content Text */
.saa-modal-content-text {
    font-size: 16px;
    line-height: 1.7;
    color: #444;
    margin-bottom: 30px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

.saa-modal-content-text p {
    margin-bottom: 15px;
    max-width: 100%;
}

.saa-modal-content-text h2,
.saa-modal-content-text h3,
.saa-modal-content-text h4 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: #1A1A1A;
    word-wrap: break-word;
}

.saa-modal-content-text ul,
.saa-modal-content-text ol {
    margin-bottom: 20px;
    padding-left: 30px;
    max-width: 100%;
}

.saa-modal-content-text li {
    margin-bottom: 8px;
    word-wrap: break-word;
}

.saa-modal-content-text img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px 0;
}

.saa-modal-content-text table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

/* Modal Info Strutturate */
.saa-modal-info-strutturate {
    margin-top: 30px;
    margin-bottom: 30px;
    padding: 20px 0;
}

.saa-modal-info-item {
    margin-bottom: 20px;
}

.saa-modal-info-item:last-child {
    margin-bottom: 0;
}

.saa-modal-info-label {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #1A1A1A;
    margin-bottom: 8px;
}

.saa-modal-info-value {
    font-size: 16px;
    line-height: 1.6;
    color: #444;
    margin: 0;
}

/* Modal Actions (Bottoni) */
.saa-modal-actions {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #E0E0E0;
}

.saa-modal-buttons-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
}

.saa-modal-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 28px 16px 32px;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    text-transform: none;
    letter-spacing: 0;
    color: #F6ECC8;
    background-color: #13162B;
    border: none;
    border-radius: 15px;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
}

.saa-modal-button:hover {
    background-color: #1F2340;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(36, 89, 207, 0.3);
    color: #FFFFFF;
    text-decoration: none;
}

.saa-button-arrow {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    color: #F6ECC8;
}

/* Modal Banner Footer */
.saa-modal-banner-footer {
    position: relative;
    margin-top: 35px;
    padding: 25px 30px;
    background-color: rgba(255, 210, 0, 0.25);
    border-radius: 25px;
    font-size: 16px;
    line-height: 1.6;
    color: #000000;
    overflow: visible;
}

.saa-modal-banner-footer a {
    color: #2459CF;
    text-decoration: underline;
    font-weight: 600;
}

.saa-modal-banner-footer a:hover {
    color: #1A45A0;
}

/* Modal Decorative Graphic */
.saa-modal-decorative-graphic {
    position: absolute;
    top: -80px;
    right: 30px;
    z-index: 5;
}

.saa-modal-decorative-graphic img {
    max-width: 150px;
    height: auto;
    opacity: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Modal Next Activity (Scheda successiva) */
.saa-modal-next-activity {
    margin-top: 30px;
    display: flex;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid #E0E0E0;
}

.saa-next-activity-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 13px;
    font-weight: 600;
    color: #1A1A1A;
    background-color: transparent;
    border: 2px solid #E0E0E0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.saa-next-activity-button:hover {
    border-color: #2459CF;
    color: #2459CF;
    background-color: #F0F8FF;
    transform: translateX(4px);
}

.saa-next-activity-button svg {
    transition: transform 0.3s ease;
}

.saa-next-activity-button:hover svg {
    transform: translateX(4px);
}

/* Modal Error State */
.saa-modal-error {
    text-align: center;
    padding: 40px 20px;
}

.saa-modal-error p {
    color: #d63638;
    font-size: 16px;
    margin-bottom: 20px;
}

/* ========================================
   RESPONSIVE MODAL - MOBILE FIRST
   ======================================== */

/* Mobile (< 768px) */
@media (max-width: 767px) {
    .saa-modal {
        padding: 0;
    }

    .saa-modal-container {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .saa-modal-content {
        border-radius: 0;
        max-height: 100vh;
    }

    .saa-modal-close {
        top: 40px;
        right: 15px;
        width: 40px;
        height: 40px;
    }

    .saa-modal-body {
        padding: 60px 20px 30px 20px;
    }

    .saa-modal-title {
        font-size: 24px;
        padding-right: 50px;
    }

    .saa-modal-subtitle {
        font-size: 14px;
    }

    .saa-modal-hashtag {
        font-size: 13px;
    }

    .saa-modal-image {
        margin: 0 0 20px 0;
        max-height: 180px;
        aspect-ratio: 3 / 1;
    }

    .saa-modal-content-text {
        font-size: 15px;
    }

    .saa-modal-actions {
        flex-direction: column;
    }

    .saa-modal-button {
        width: 100%;
        justify-content: center;
    }

    .saa-modal-logo {
        max-width: 80px;
        top: 20px;
        left: 20px;
    }

    .saa-modal-decorative-graphic {
        padding-right: 15px;
        margin-top: 20px;
    }

    .saa-modal-decorative-graphic img {
        max-width: 100px;
    }
}

/* Tablet (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .saa-modal-container {
        max-width: 700px;
    }

    .saa-modal-body {
        padding: 50px 30px;
    }

    .saa-modal-title {
        font-size: 28px;
    }

    .saa-modal-image {
        margin: 0 -30px 25px -30px;
    }
}

/* Desktop (> 1024px) */
@media (min-width: 1025px) {
    .saa-modal-container {
        max-width: 900px;
    }
}

/* Large Desktop (> 1440px) */
@media (min-width: 1441px) {
    .saa-modal-container {
        max-width: 1000px;
    }

    .saa-modal-body {
        padding: 50px;
    }
}

/* Landscape Mobile */
@media (max-height: 600px) and (orientation: landscape) {
    .saa-modal-container {
        max-height: 100vh;
    }

    .saa-modal-close {
        top: 38px;
        right: 10px;
    }

    .saa-modal-body {
        padding: 50px 20px 20px 20px;
    }
}

/* Accessibility - Riduzione animazioni per chi preferisce */
@media (prefers-reduced-motion: reduce) {
    .saa-modal,
    .saa-modal-container,
    .saa-modal-close,
    .saa-modal-button {
        transition: none;
    }

    .saa-spinner {
        animation: none;
    }
}
