/* =====================================================================
   themes/default/css/components.css
   Stili componenti Page Builder per il tema Default — CMS SEO/AEO
   Copia di converted-sections.css associata al tema default.
   ===================================================================== */

/* ── SEZIONE GENERICA ───────────────────────────────────────────── */
.cms-section {
    padding: 60px 0;
    position: relative;
    overflow: hidden;
}
.cms-section .section-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
.cms-section.full-width .section-container {
    max-width: 100%;
    padding: 0;
}

/* ── GRID COLONNE ───────────────────────────────────────────────── */
.cms-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    box-sizing: border-box;
    align-items: flex-start;
}
.cms-col-100 { flex: 0 0 100%; }
.cms-col-50  { flex: 0 0 calc(50% - 15px); max-width: calc(50% - 15px); }
.cms-col-33  { flex: 0 0 calc(33.333% - 20px); max-width: calc(33.333% - 20px); }
.cms-col-25  { flex: 0 0 calc(25% - 22.5px); max-width: calc(25% - 22.5px); }
.cms-col-66  { flex: 0 0 calc(66.666% - 15px); max-width: calc(66.666% - 15px); }
.cms-col-75  { flex: 0 0 calc(75% - 7.5px); max-width: calc(75% - 7.5px); }

.cms-columns.valign-center { align-items: center; }
.cms-columns.valign-bottom { align-items: flex-end; }

/* ── HERO SECTION ───────────────────────────────────────────────── */
.cms-section.hero {
    min-height: 500px;
    display: flex;
    align-items: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.cms-section.hero .section-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 0;
}
.cms-section.hero .section-container {
    position: relative;
    z-index: 1;
    width: 100%;
}

/* ── ICON BOX ───────────────────────────────────────────────────── */
.cms-icon-box {
    text-align: center;
    padding: 20px;
}
.cms-icon-box.icon-left {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    text-align: left;
}
.cms-icon-box .icon {
    font-size: 48px;
    margin-bottom: 15px;
    color: var(--color-primary, #2563eb);
    line-height: 1;
    flex-shrink: 0;
}
.cms-icon-box.icon-left .icon { margin-bottom: 0; }
.cms-icon-box h3 { margin-bottom: 10px; font-size: 1.2rem; }
.cms-icon-box p { color: #555; font-size: 0.95rem; line-height: 1.6; margin-bottom: 0; }

/* ── BOTTONE ────────────────────────────────────────────────────── */
.cms-btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 4px;
    text-decoration: none !important;
    font-weight: 600;
    transition: opacity 0.3s, transform 0.2s;
    background: var(--color-primary, #2563eb);
    color: #fff !important;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1.4;
}
.cms-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
    color: #fff !important;
    text-decoration: none !important;
}
.cms-btn-outline {
    background: transparent !important;
    border: 2px solid var(--color-primary, #2563eb);
    color: var(--color-primary, #2563eb) !important;
}
.cms-btn-outline:hover {
    background: var(--color-primary, #2563eb) !important;
    color: #fff !important;
}
.cms-btn-secondary { background: var(--color-secondary, #1e40af); }
.cms-btn-sm { padding: 8px 18px; font-size: 0.82rem; }
.cms-btn-lg { padding: 16px 42px; font-size: 1.1rem; }
.cms-btn-wrap { margin-top: 20px; }

/* ── COUNTER ────────────────────────────────────────────────────── */
.cms-counter {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
}
.cms-counter .counter-icon { margin-bottom: 10px; }
.cms-counter .counter-number {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    display: block;
    margin-bottom: 6px;
    color: var(--color-primary, #2563eb);
}
.cms-counter .counter-prefix,
.cms-counter .counter-suffix { font-size: 0.7em; font-weight: 400; }
.cms-counter .counter-label {
    font-size: 0.9rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
}

/* ── TESTIMONIAL ────────────────────────────────────────────────── */
.cms-testimonial {
    text-align: center;
    padding: 30px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}
.cms-testimonial blockquote {
    font-size: 1.05rem;
    font-style: italic;
    color: #495057;
    border: none;
    padding: 0 0 20px;
    margin: 0 0 15px;
    position: relative;
    line-height: 1.7;
    background: none;
}
.cms-testimonial blockquote::before {
    content: '\201C';
    font-size: 4rem;
    color: var(--color-primary);
    opacity: 0.3;
    position: absolute;
    top: -20px;
    left: 0;
    font-family: Georgia, serif;
    line-height: 1;
}
.cms-testimonial .author { font-weight: 700; font-size: 0.95rem; color: var(--color-text); }
.cms-testimonial .author-title { font-size: 0.8rem; color: #6c757d; margin-top: 3px; }
.cms-testimonial .stars { color: #f59e0b; font-size: 1.1rem; margin-bottom: 12px; }

/* ── IMMAGINE ───────────────────────────────────────────────────── */
.cms-image-wrap { overflow: hidden; border-radius: 6px; }
.cms-image-wrap img { width: 100%; height: auto; display: block; transition: transform 0.4s; }
.cms-image-wrap.has-hover:hover img { transform: scale(1.03); }

/* ── SPACER / DIVIDER ───────────────────────────────────────────── */
.cms-spacer { display: block; }
.cms-divider {
    border: none;
    height: 3px;
    background: var(--color-primary, #2563eb);
    width: 60px;
    margin: 20px auto;
}
.cms-divider.left { margin-left: 0; }
.cms-divider-rule { border: none; display: block; }

/* ── TESTO / EDITOR ─────────────────────────────────────────────── */
.cms-text-content { line-height: 1.75; }
.cms-text-content h2, .cms-text-content h3, .cms-text-content h4 { margin-top: 1.5em; margin-bottom: 0.6em; }
.cms-text-content ul, .cms-text-content ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.cms-text-content ul { list-style: disc; }
.cms-text-content ol { list-style: decimal; }
.cms-text-content li { margin-bottom: 0.35rem; }
.cms-text-content p:last-child { margin-bottom: 0; }

/* ── SEZIONI CON SFONDO ─────────────────────────────────────────── */
.cms-section[style*="background-image"] { background-size: cover; background-position: center; background-repeat: no-repeat; }
.cms-section-dark { color: #fff; }
.cms-section-dark h1, .cms-section-dark h2, .cms-section-dark h3, .cms-section-dark h4, .cms-section-dark p { color: #fff; }

/* ── GALLERY ────────────────────────────────────────────────────── */
.cms-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}
.cms-gallery-item { overflow: hidden; border-radius: 6px; aspect-ratio: 4/3; background: #f3f4f6; }
.cms-gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; display: block; }
.cms-gallery-item:hover img { transform: scale(1.07); }

/* ── GOOGLE MAPS ────────────────────────────────────────────────── */
.cms-map-wrap { border-radius: 8px; overflow: hidden; line-height: 0; }
.cms-map-wrap iframe { width: 100%; height: 400px; border: none; }

/* ── TIPOGRAFIA SEZIONE ─────────────────────────────────────────── */
.cms-section-title { text-align: center; margin-bottom: 40px; }
.cms-section-title h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 15px; }
.cms-section-title p { font-size: 1.05rem; color: #555; max-width: 700px; margin: 0 auto; }

/* ── VIDEO BG FALLBACK ──────────────────────────────────────────── */
.cms-section.video-bg-fallback { background-size: cover; background-position: center; }

/* ── CTA SECTION ────────────────────────────────────────────────── */
.cms-section.cta { text-align: center; }
.cms-section.cta h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 15px; }
.cms-section.cta p { max-width: 600px; margin: 0 auto 25px; font-size: 1.05rem; }

/* ── CARD ───────────────────────────────────────────────────────── */
.cms-card { background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden; transition: box-shadow 0.3s; height: 100%; }
.cms-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,0.12); }
.cms-card-image img { width: 100%; height: auto; display: block; max-height: 220px; object-fit: cover; }
.cms-card-body { padding: 20px; }
.cms-card-title { font-family: var(--font-heading); font-size: 1.15rem; margin: 0 0 10px 0; color: var(--color-text); }
.cms-card-text { font-size: 0.95rem; color: #555; margin: 0 0 15px 0; line-height: 1.6; }

/* ── ALERT / CALLOUT ─────────────────────────────────────────────── */
.cms-alert { padding: 14px 18px; border-radius: 6px; border-left: 4px solid; margin: 16px 0; display: flex; gap: 14px; align-items: flex-start; }
.cms-alert-info    { background: #e8f4fd; border-color: #2196F3; color: #0d47a1; }
.cms-alert-success { background: #e8f5e9; border-color: #4CAF50; color: #1b5e20; }
.cms-alert-warning { background: #fff8e1; border-color: #FF9800; color: #e65100; }
.cms-alert-danger  { background: #ffebee; border-color: #f44336; color: #b71c1c; }
.cms-alert .alert-icon { font-size: 1.25rem; flex-shrink: 0; margin-top: 1px; }
.cms-alert .alert-content h4 { margin: 0 0 5px 0; font-size: 0.95rem; font-weight: 700; }
.cms-alert .alert-content p { margin: 0; font-size: 0.9rem; }

/* ── TABS ───────────────────────────────────────────────────────── */
.cms-tabs { margin: 20px 0; }
.cms-tabs-nav { display: flex; border-bottom: 2px solid #dee2e6; margin-bottom: 20px; gap: 0; flex-wrap: wrap; }
.cms-tab-btn {
    padding: 10px 22px; border: none; background: none; cursor: pointer;
    font-size: 0.95rem; border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: all 0.25s; color: #6c757d;
    font-family: var(--font-body);
}
.cms-tab-btn.active { border-bottom-color: var(--color-primary); color: var(--color-primary); font-weight: 700; }
.cms-tab-btn:hover:not(.active) { color: var(--color-text); background: rgba(0,0,0,0.04); }
.cms-tab-content { display: none; }
.cms-tab-content.active { display: block; }

/* ── NEWS CARD ──────────────────────────────────────────────────── */
.cms-news-card {
    background: #fff; border: 1px solid #e9ecef; border-radius: 8px;
    overflow: hidden; transition: box-shadow 0.3s; height: 100%;
    display: flex; flex-direction: column;
}
.cms-news-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,0.1); }
.cms-news-card .cms-image-wrap { margin: 0; }
.cms-news-card .cms-image-wrap img { width: 100%; height: 200px; object-fit: cover; display: block; }
.cms-news-title { font-family: var(--font-heading); font-size: 1.05rem; margin: 14px 16px 8px; line-height: 1.4; }
.cms-news-title a { color: var(--color-text); text-decoration: none; }
.cms-news-title a:hover { color: var(--color-primary); }
.cms-news-card p { font-size: 0.88rem; color: #6c757d; margin: 0 16px 12px; line-height: 1.5; flex: 1; }
.cms-news-card .post-date { font-size: 0.75rem; color: #adb5bd; padding: 8px 16px 0; display: block; }
.cms-news-card .post-category { display: inline-block; margin: 0 16px 14px; font-size: 0.75rem; color: var(--color-primary); text-decoration: none; font-weight: 600; }

/* ── RESPONSIVE ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .cms-col-25 { width: calc(50% - 15px); }
}

@media (max-width: 768px) {
    .cms-columns { flex-direction: column; gap: 20px; }
    .cms-col-50, .cms-col-33, .cms-col-25, .cms-col-66, .cms-col-75 { width: 100%; }
    .cms-section { padding: 40px 0; }
    .cms-section.hero { min-height: 350px; }
    .cms-icon-box .icon { font-size: 36px; }
    .cms-icon-box.icon-left { flex-direction: column; }
    .cms-map-wrap iframe { height: 280px; }
    .cms-section.cta p, .cms-section-title p { font-size: 0.95rem; }
    .cms-gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 480px) {
    .cms-section { padding: 30px 0; }
    .cms-section.hero { min-height: 280px; }
    .cms-btn { padding: 10px 22px; font-size: 0.9rem; }
}
