:root {
    --primary-color: #1a3a6c;
    --secondary-color: #e63946;
    --accent-color: #f4a261;
    --light-color: #f8f9fa;
    --dark-color: #343a40;

    /* Nuove variabili di supporto (non rompono nulla) */
    --text-color: #444;
    --muted-color: #6c757d;
    --border-color: rgba(26, 58, 108, 0.12);
    --shadow-sm: 0 5px 15px rgba(0,0,0,0.08);
    --shadow-md: 0 10px 25px rgba(0,0,0,0.10);
    --radius-sm: 8px;
    --radius-md: 12px;
}

/* ------------------------------
   Base & Typography
   ------------------------------ */
.slogan { color:#fff;}

/* Evita che la navbar cambi altezza quando si apre un dropdown */
.navbar-nav .dropdown-menu {
    position: absolute;
    top: 100%;
    margin-top: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.7;
    color: var(--text-color);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

a {
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

/* Layout generale: rende le pagine più “respirate” */
.site-main,
main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 60px 20px;
}

/* Gutenberg / contenuti */
.entry-content,
.wp-block-post-content {
    font-size: 1.05rem;
    line-height: 1.8;
}

/* Titoli: gerarchia visiva chiara */
h1 {
    font-size: 2.4rem;
    line-height: 1.2;
    font-weight: 800;
    margin-bottom: 1.1rem;
    color: var(--primary-color);
}

h2 {
    font-size: 1.7rem;
    line-height: 1.25;
    font-weight: 800;
    margin-top: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

h3 {
    font-size: 1.3rem;
    line-height: 1.3;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    color: var(--primary-color);
}

p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-color);
    margin-bottom: 1.2rem;
}

/* Liste più belle */
ul, ol {
    padding-left: 1.2rem;
    margin-bottom: 1.2rem;
}

ul li, ol li {
    margin-bottom: 0.55rem;
}

/* Focus accessibile */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    box-shadow: 0 0 0 0.25rem rgba(26, 58, 108, 0.25);
}

/* ------------------------------
   Reusable UI blocks (nuovi)
   ------------------------------ */

/* Box informativo per sezioni importanti dentro le pagine */
.content-box {
    background: var(--light-color);
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--primary-color);
    padding: 30px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin: 40px 0;
}

.content-box h2,
.content-box h3 {
    margin-top: 0;
}

/* CTA finale riutilizzabile nei servizi */
.cta-box {
    background: linear-gradient(135deg, var(--primary-color) 0%, #2c5282 100%);
    color: #fff;
    padding: 40px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-top: 60px;
}

.cta-box h2,
.cta-box h3 {
    color: #fff;
    margin-top: 0;
}

.cta-box p {
    color: rgba(255,255,255,0.88);
}

/* ------------------------------
   Navbar
   ------------------------------ */

.navbar {
    background-color: var(--primary-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.nav-link {
    color: white !important;
    font-weight: 600;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--accent-color) !important;
}

/* Dropdown */
.navbar .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 9999;
    min-width: 260px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    padding: 10px 0;
}

.navbar .dropdown-menu li {
    white-space: normal;
}

@media (min-width: 992px) {
    .navbar .dropdown:hover > .dropdown-menu {
        display: block;
    }
}

.navbar .dropdown-menu.show {
    display: block;
    position: static; /* su mobile meglio in flow */
}

/* ------------------------------
   Hero
   ------------------------------ */

.hero-section {
    background: linear-gradient(rgba(0,0,0,0.68), rgba(0,0,0,0.68)), url('../images/bg.png');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 150px 0;
    text-align: center;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 20px;
    color: #fff;
}

/* ------------------------------
   Buttons
   ------------------------------ */

.btn-primary {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    padding: 10px 30px;
    font-weight: 700;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background-color: #c1121f;
    border-color: #c1121f;
    transform: translateY(-2px);
}

.btn-outline-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ------------------------------
   Section titles
   ------------------------------ */

.section-title {
    color: var(--primary-color);
    font-weight: 800;
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 15px;
}

.section-title:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 3px;
    background-color: var(--secondary-color);
}

/* ------------------------------
   Services
   ------------------------------ */

.service-card {
    border: 1px solid rgba(0,0,0,0.03);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
}

.service-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
}

.service-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 18px;
}

/* ------------------------------
   About / Stats / Testimonials
   ------------------------------ */

.about-section {
    background-color: var(--light-color);
}

.stats-section {
    background-color: var(--primary-color);
    color: white;
    padding: 80px 0;
}

.stat-number {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.testimonial-card {
    background-color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 30px;
    margin: 15px 0;
}

.testimonial-text {
    font-style: italic;
    margin-bottom: 20px;
}

.client-logo {
    max-width: 150px;
    filter: grayscale(100%);
    opacity: 0.7;
    transition: all 0.2s ease;
}

.client-logo:hover {
    filter: grayscale(0);
    opacity: 1;
}

/* ------------------------------
   Footer
   ------------------------------ */

.footer {
    background-color: var(--dark-color);
    color: white;
    padding: 60px 0 30px;
}

.footer h5 {
    color: var(--accent-color);
    margin-bottom: 20px;
}

.footer a {
    color: #ddd;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: var(--accent-color);
}

.social-icons a {
    display: inline-block;
    width: 40px;
    height: 40px;
    background-color: rgba(255,255,255,0.1);
    border-radius: 50%;
    text-align: center;
    line-height: 40px;
    margin-right: 10px;
    transition: all 0.2s ease;
}

.social-icons a:hover {
    background-color: var(--secondary-color);
    transform: translateY(-3px);
}

.copyright {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    margin-top: 40px;
}

/* ------------------------------
   WordPress specific styles
   ------------------------------ */

.alignwide {
    margin-left: -100px;
    margin-right: -100px;
    max-width: calc(100% + 200px);
}

.alignfull {
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    max-width: 100vw;
    width: 100vw;
}

.wp-block-image img {
    height: auto;
    max-width: 100%;
}

/* ------------------------------
   Top Bar per verifica attestati
   ------------------------------ */

.top-bar {
    background: linear-gradient(90deg, #1a3a6c 0%, #2c5282 100%);
    font-size: 0.85rem;
    border-bottom: 2px solid var(--accent-color);
}

.certificate-form .form-control {
    border: 1px solid #495057;
    background-color: rgba(255,255,255,0.1);
    color: white;
}

.certificate-form .form-control::placeholder {
    color: rgba(255,255,255,0.6);
}

.certificate-form .btn-warning {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--primary-color);
    font-weight: 700;
}

.certificate-form .btn-warning:hover {
    background-color: #e76f51;
    border-color: #e76f51;
}

/* ------------------------------
   News Section Styles
   ------------------------------ */

.news-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md) !important;
}

.news-card .card-img-top {
    height: 200px;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.news-card:hover .card-img-top {
    transform: scale(1.04);
}

.news-card .card-title {
    font-size: 1.1rem;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.news-card .card-title a:hover {
    color: var(--secondary-color) !important;
}

.news-card .post-meta {
    font-size: 0.85rem;
    color: var(--muted-color);
}

/* ------------------------------
   Contact Section Styles
   ------------------------------ */

.contact-info-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.contact-icon {
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, #2c5282 100%);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.contact-icon:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(26, 58, 108, 0.2);
}

.contact-form-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.contact-form-card .form-control,
.contact-form-card .form-select {
    border: 1px solid #dee2e6;
    border-radius: var(--radius-sm);
    padding: 1rem 0.75rem;
    transition: all 0.2s ease;
}

.contact-form-card .form-floating > .form-control,
.contact-form-card .form-floating > .form-select {
    height: calc(3.5rem + 2px);
    line-height: 1.25;
}

.contact-form-card .form-floating > label {
    padding: 1rem 0.75rem;
    color: var(--muted-color);
}

.contact-form-card .form-control:focus,
.contact-form-card .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(26, 58, 108, 0.25);
}

.contact-info-card .social-icon {
    width: 40px;
    height: 40px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.contact-info-card .social-icon:hover {
    background-color: var(--secondary-color) !important;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(230, 57, 70, 0.3);
}

/* Success message */
.contact-success {
    display: none;
    padding: 2rem;
    text-align: center;
    background-color: #d1e7dd;
    border-radius: var(--radius-md);
    border: 1px solid #badbcc;
    color: #0f5132;
}

.contact-success i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #0f5132;
}

/* Loading state per il form */
.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid white;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Focus states per form-floating */
.form-floating.focused label {
    color: var(--primary-color);
    font-weight: 600;
}

/* ------------------------------
   Contact Form 7 styles
   ------------------------------ */

.wpcf7-form {
    margin-top: 20px;
}

.wpcf7-form .wpcf7-form-control {
    width: 100%;
    padding: 1rem 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.wpcf7-form .wpcf7-form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(26, 58, 108, 0.25);
}

.wpcf7-form .wpcf7-text,
.wpcf7-form .wpcf7-email,
.wpcf7-form .wpcf7-tel,
.wpcf7-form .wpcf7-textarea,
.wpcf7-form .wpcf7-select {
    background-color: #fff;
}

.wpcf7-form .wpcf7-textarea {
    min-height: 150px;
    resize: vertical;
}

.wpcf7-form .wpcf7-submit {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    margin-top: 1rem;
}

.wpcf7-form .wpcf7-submit:hover {
    background-color: #c1121f;
    border-color: #c1121f;
    transform: translateY(-2px);
}

.wpcf7-form label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.wpcf7-form .wpcf7-not-valid-tip {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.wpcf7-form .wpcf7-response-output {
    margin: 1rem 0 0 0;
    padding: 1rem;
    border-radius: 0.375rem;
}

.wpcf7-form .wpcf7-mail-sent-ok {
    background-color: #d1e7dd;
    border-color: #badbcc;
    color: #0f5132;
}

.wpcf7-form .wpcf7-mail-sent-ng,
.wpcf7-form .wpcf7-aborted,
.wpcf7-form .wpcf7-spam-blocked,
.wpcf7-form .wpcf7-validation-errors {
    background-color: #f8d7da;
    border-color: #f5c2c7;
    color: #842029;
}

.wpcf7-form p {
    margin-bottom: 1.5rem;
}

.wpcf7-form br {
    display: none;
}

.wpcf7-form .row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.75rem;
    margin-left: -0.75rem;
}

.wpcf7-form .half {
    width: 50%;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
    box-sizing: border-box;
}

.wpcf7-form .full {
    width: 100%;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
    box-sizing: border-box;
}

/* ------------------------------
   Layout overrides: CPT Servizi full-width
   ------------------------------ */

body.single-servizi .col-lg-4,
body.post-type-archive-servizi .col-lg-4 {
    display: none !important;
}

body.single-servizi .col-lg-8,
body.post-type-archive-servizi .col-lg-8 {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
}

body.single-servizi .site-main,
body.post-type-archive-servizi .site-main {
    width: 100% !important;
}

/* ------------------------------
   Responsive adjustments (unificato)
   ------------------------------ */

@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2.2rem;
    }

    .hero-section {
        padding: 100px 0;
    }

    .top-bar .row {
        text-align: center;
    }

    .top-bar .col-md-8,
    .top-bar .col-md-4 {
        width: 100%;
        margin-bottom: 10px;
    }

    .certificate-form {
        max-width: 300px;
        margin: 0 auto;
    }

    .contact-info-card,
    .contact-form-card {
        padding: 1.5rem !important;
    }

    .contact-item {
        flex-direction: column;
        text-align: center;
    }

    .contact-icon {
        margin: 0 auto 1rem !important;
    }

    .wpcf7-form .half {
        width: 100%;
    }

    /* Titoli più compatti su mobile */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.45rem; }
}

/* Dropdown: overlay su desktop, non allunga la navbar */
@media (min-width: 992px) {
  .navbar .dropdown { position: relative; }

  .navbar .navbar-nav .dropdown-menu {
    position: absolute !important;
    top: 100%;
    left: 0;
    margin-top: 0;
    display: none;
  }

  .navbar .navbar-nav .dropdown-menu.show {
    display: block;
  }
}
