/* ===================================
   VARIABILI COLORE TEMA (da home page)
   =================================== */
:root {
    --color-primary: #ebd35b;        /* Giallo principale */
    --color-primary-dark: #e3bd2c;   /* Giallo scuro */
    --color-text-light: #fefefe;     /* Testo chiaro */
    --color-text-dark: #526354;      /* Verde scuro testo */
    --color-bg-light: #f3faf6;       /* Sfondo chiaro verde */
    --color-bg-white: #FFFFFF;       /* Bianco */
    --color-border: #dfe2e2;         /* Bordi grigi */
    --color-heading: #183030;        /* Titoli verde scuro */
    --color-text-black: #111111;     /* Nero testo */
    --color-accent-green: #28b061;   /* Verde accento per card */
}

/* ===================================
   Hero section iniettato dagli shortcode [area_riservata_login] e
   [area_riservata_content]. Si estende fino al top della viewport
   (sotto il transparent header di Astra) in modo che il menu sia
   sovrapposto alla foto, non separato sopra.
   =================================== */

/* Azzera padding/margin top di TUTTI i possibili wrapper sopra l'hero
   sulle pagine Login e Area Riservata. */
body.page-id-1028,
body.page-id-1029,
body.page-id-1519,
body.page-id-1528,
body.page-id-1028 #page,
body.page-id-1029 #page,
body.page-id-1519 #page,
body.page-id-1528 #page,
body.page-id-1028 .hfeed,
body.page-id-1029 .hfeed,
body.page-id-1519 .hfeed,
body.page-id-1528 .hfeed,
body.page-id-1028 .site,
body.page-id-1029 .site,
body.page-id-1519 .site,
body.page-id-1528 .site,
body.page-id-1028 #wrapper,
body.page-id-1029 #wrapper,
body.page-id-1519 #wrapper,
body.page-id-1528 #wrapper,
body.page-id-1028 #content,
body.page-id-1029 #content,
body.page-id-1519 #content,
body.page-id-1528 #content,
body.page-id-1028 .site-content,
body.page-id-1029 .site-content,
body.page-id-1519 .site-content,
body.page-id-1528 .site-content,
body.page-id-1028 #primary,
body.page-id-1029 #primary,
body.page-id-1519 #primary,
body.page-id-1528 #primary,
body.page-id-1028 .ast-container,
body.page-id-1029 .ast-container,
body.page-id-1519 .ast-container,
body.page-id-1528 .ast-container,
body.page-id-1028 .entry-content,
body.page-id-1029 .entry-content,
body.page-id-1519 .entry-content,
body.page-id-1528 .entry-content,
body.page-id-1028 .ast-no-sidebar,
body.page-id-1029 .ast-no-sidebar,
body.page-id-1519 .ast-no-sidebar,
body.page-id-1528 .ast-no-sidebar,
body.page-id-1028 main#main,
body.page-id-1029 main#main,
body.page-id-1519 main#main,
body.page-id-1528 main#main,
body.page-id-1028 article,
body.page-id-1029 article,
body.page-id-1519 article,
body.page-id-1528 article {
    padding-top: 0 !important;
    margin-top: 0 !important;
    border-top: 0 !important;
}

/* Mostra background solo dell'hero in alto: rimuovi qualsiasi sfondo bianco
   sui parent che potrebbe creare la striscia bianca sopra la foto. */
body.page-id-1028 .ast-no-sidebar,
body.page-id-1029 .ast-no-sidebar,
body.page-id-1519 .ast-no-sidebar,
body.page-id-1528 .ast-no-sidebar,
body.page-id-1028 .entry-content,
body.page-id-1029 .entry-content,
body.page-id-1519 .entry-content,
body.page-id-1528 .entry-content,
body.page-id-1028 article.post,
body.page-id-1029 article.post,
body.page-id-1519 article.post,
body.page-id-1528 article.post,
body.page-id-1028 article.page,
body.page-id-1029 article.page,
body.page-id-1519 article.page,
body.page-id-1528 article.page {
    background: transparent !important;
}

/* Forza header trasparente sopra l'hero, indipendentemente dall'opzione Astra.
   #masthead diventa position:absolute così non occupa spazio verticale,
   tutti i wrapper interni (incluso site-primary-header-wrap) sono trasparenti. */
body.page-id-1028 #masthead,
body.page-id-1029 #masthead,
body.page-id-1519 #masthead,
body.page-id-1528 #masthead {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 999 !important;
    background: transparent !important;
    background-image: none !important;
}

body.page-id-1028 #masthead *,
body.page-id-1029 #masthead *,
body.page-id-1519 #masthead *,
body.page-id-1528 #masthead * {
    background-color: transparent !important;
}

body.page-id-1028 #masthead .site-primary-header-wrap,
body.page-id-1029 #masthead .site-primary-header-wrap,
body.page-id-1519 #masthead .site-primary-header-wrap,
body.page-id-1528 #masthead .site-primary-header-wrap,
body.page-id-1028 #masthead .ast-above-header,
body.page-id-1029 #masthead .ast-above-header,
body.page-id-1519 #masthead .ast-above-header,
body.page-id-1528 #masthead .ast-above-header,
body.page-id-1028 #masthead .ast-above-header-wrap,
body.page-id-1029 #masthead .ast-above-header-wrap,
body.page-id-1519 #masthead .ast-above-header-wrap,
body.page-id-1528 #masthead .ast-above-header-wrap,
body.page-id-1028 #masthead .ast-main-header-wrap,
body.page-id-1029 #masthead .ast-main-header-wrap,
body.page-id-1519 #masthead .ast-main-header-wrap,
body.page-id-1528 #masthead .ast-main-header-wrap,
body.page-id-1028 #masthead .main-header-bar,
body.page-id-1029 #masthead .main-header-bar,
body.page-id-1519 #masthead .main-header-bar,
body.page-id-1528 #masthead .main-header-bar,
body.page-id-1028 #masthead .ast-below-header,
body.page-id-1029 #masthead .ast-below-header,
body.page-id-1519 #masthead .ast-below-header,
body.page-id-1528 #masthead .ast-below-header,
body.page-id-1028 #masthead .ast-below-header-wrap,
body.page-id-1029 #masthead .ast-below-header-wrap,
body.page-id-1519 #masthead .ast-below-header-wrap,
body.page-id-1528 #masthead .ast-below-header-wrap {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    border: 0 !important;
}

/* Menu / logo bianchi sopra la foto */
body.page-id-1028 #masthead .menu-item > a,
body.page-id-1029 #masthead .menu-item > a,
body.page-id-1519 #masthead .menu-item > a,
body.page-id-1528 #masthead .menu-item > a,
body.page-id-1028 #masthead .ast-builder-menu-1 .menu-link,
body.page-id-1029 #masthead .ast-builder-menu-1 .menu-link,
body.page-id-1519 #masthead .ast-builder-menu-1 .menu-link,
body.page-id-1528 #masthead .ast-builder-menu-1 .menu-link,
body.page-id-1028 #masthead .site-title a,
body.page-id-1029 #masthead .site-title a,
body.page-id-1519 #masthead .site-title a,
body.page-id-1528 #masthead .site-title a {
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.ar-page-hero {
    position: relative;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-top: 0;
    min-height: 65vh;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-color: #5a6e5a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ar-page-hero-inner {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 40px 20px;
    width: 100%;
}

.ar-page-hero-title {
    color: #ffffff !important;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 700;
    line-height: 1.15;
    margin: 0;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

@media (max-width: 768px) {
    .ar-page-hero {
        min-height: 45vh;
    }
}

/* Pagine Login: rimuovi lo sfondo verde chiaro sotto il form */
body.page-id-1028 .area-riservata-login-container,
body.page-id-1528 .area-riservata-login-container {
    background: transparent !important;
}

/* Spazio fra form e footer */
body.page-id-1028 .area-riservata-login-container,
body.page-id-1528 .area-riservata-login-container,
body.page-id-1029 .area-riservata-content,
body.page-id-1519 .area-riservata-content,
body.page-id-1028 .scheda-catalogo-form,
body.page-id-1029 .scheda-catalogo-form,
body.page-id-1519 .scheda-catalogo-form,
body.page-id-1528 .scheda-catalogo-form {
    margin-bottom: 30px !important;
}

/* Area Riservata - Login Form */
.area-riservata-login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 40px 20px;
    background: var(--color-bg-light);
}

.area-riservata-login-box {
    background: var(--color-bg-white);
    border-radius: 8px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    padding: 40px;
    max-width: 450px;
    width: 100%;
    border-top: 4px solid var(--color-primary);
}

.area-riservata-login-box h2 {
    margin: 0 0 10px;
    color: var(--color-heading);
    font-size: 28px;
    text-align: center;
}

.area-riservata-login-box .subtitle {
    margin: 0 0 30px;
    color: var(--color-text-dark);
    text-align: center;
    font-size: 14px;
}

.area-riservata-login-box .form-group {
    margin-bottom: 20px;
}

.area-riservata-login-box label {
    display: block;
    margin-bottom: 8px;
    color: var(--color-text-dark);
    font-weight: 500;
    font-size: 14px;
}

.area-riservata-login-box input[type="text"],
.area-riservata-login-box input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.area-riservata-login-box input[type="text"]:focus,
.area-riservata-login-box input[type="password"]:focus {
    outline: none;
    border-color: var(--color-primary-dark);
    box-shadow: 0 0 0 3px rgba(235, 211, 91, 0.2);
}

.area-riservata-login-box .checkbox-group {
    margin-bottom: 25px;
}

.area-riservata-login-box .checkbox-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
}

.area-riservata-login-box .checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.area-riservata-login-box .btn-login {
    width: 100%;
    padding: 14px;
    background: var(--color-primary);
    color: var(--color-heading);
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.area-riservata-login-box .btn-login:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(227, 189, 44, 0.3);
}

.area-riservata-login-box .btn-login:active {
    transform: translateY(1px);
}

.area-riservata-login-box .form-message {
    margin: 15px 0;
    padding: 12px;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    display: none;
}

.area-riservata-login-box .form-message.error {
    background: #fee;
    color: #c00;
    border: 1px solid #fcc;
    display: block;
}

.area-riservata-login-box .form-message.success {
    background: #efe;
    color: #060;
    border: 1px solid #cfc;
    display: block;
}

/* Area Riservata - Content */
.area-riservata-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.area-riservata-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #ecf0f1;
    flex-wrap: wrap;
    gap: 20px;
}

.area-riservata-header h1 {
    margin: 0;
    color: #2c3e50;
    font-size: 32px;
}

.area-riservata-header .user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.area-riservata-header .welcome {
    color: #34495e;
    font-size: 15px;
}

.area-riservata-header .welcome strong {
    color: #27ae60;
}

.area-riservata-header .btn-logout {
    padding: 10px 20px;
    background: #e74c3c;
    color: #ffffff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s;
}

.area-riservata-header .btn-logout:hover {
    background: #c0392b;
}

.reserved-content {
    background: #ffffff;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.placeholder-content {
    text-align: center;
    padding: 60px 20px;
}

.placeholder-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.7;
}

.placeholder-content h2 {
    margin: 0 0 15px;
    color: #2c3e50;
    font-size: 28px;
}

.placeholder-content p {
    margin: 10px 0;
    color: #7f8c8d;
    font-size: 16px;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    .area-riservata-login-box {
        padding: 30px 20px;
    }

    .area-riservata-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .area-riservata-header .user-info {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .reserved-content {
        padding: 30px 20px;
    }
}

/* Scheda Catalogo Form */
.scheda-catalogo-form {
    background: #ffffff;
    border-radius: 8px;
    padding: 0;
}

.scheda-catalogo-form .form-title {
    margin: 0 0 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #ecf0f1;
    color: #2c3e50;
    font-size: 28px;
}

.form-section {
    margin-bottom: 40px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #27ae60;
}

.form-section .section-title {
    margin: 0 0 25px;
    color: #27ae60;
    font-size: 22px;
    font-weight: 600;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    flex: 1 1 100%;
}

.form-group.half-width {
    flex: 1 1 calc(50% - 10px);
}

.form-group.third-width {
    flex: 1 1 calc(33.333% - 14px);
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #34495e;
    font-weight: 600;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="url"],
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
    background: #ffffff;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.form-actions {
    margin-top: 30px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.btn-save {
    padding: 15px 40px;
    background: #27ae60;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
    min-width: 200px;
}

.btn-save:hover {
    background: #229954;
}

.btn-save:active {
    transform: translateY(1px);
}

.btn-save:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.form-actions .form-message {
    width: 100%;
    padding: 12px;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    display: none;
}

.form-actions .form-message.error {
    background: #fee;
    color: #c00;
    border: 1px solid #fcc;
    display: block;
}

.form-actions .form-message.success {
    background: #efe;
    color: #060;
    border: 1px solid #cfc;
    display: block;
}

/* Responsive Form */
@media (max-width: 768px) {
    .form-section {
        padding: 20px;
    }

    .form-group.half-width,
    .form-group.third-width {
        flex: 1 1 100%;
    }

    .form-row {
        gap: 15px;
    }

    .btn-save {
        width: 100%;
    }

    .form-actions {
        padding: 20px;
    }
}

/* Admin Interface - Area Riservata */
.admin-schede-container {
    display: flex;
    gap: 30px;
    min-height: 600px;
}

.admin-sidebar {
    width: 350px;
    flex-shrink: 0;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

.admin-sidebar h3 {
    margin: 0 0 20px;
    color: #2c3e50;
    font-size: 20px;
}

/* Ricerca interna fra le aziende iscritte (area riservata) */
.ricerca-schede {
    position: relative;
    margin-bottom: 14px;
}

.ricerca-schede-input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 38px 11px 14px;
    font-size: 14px;
    line-height: 1.5;
    color: #2c3e50;
    background: #fff;
    border: 1.5px solid #dee2e6;
    border-radius: 8px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
    /* Safari disegna un campo di ricerca con stile proprio */
    -webkit-appearance: none;
    appearance: none;
}

.ricerca-schede-input::placeholder {
    color: #9aa5b1;
}

.ricerca-schede-input:focus {
    border-color: #2f7d4f;
    box-shadow: 0 0 0 3px rgba(47, 125, 79, 0.12);
}

/* Pulsante per azzerare: compare solo quando c'e' testo */
.ricerca-schede-clear {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #e9ecef;
    color: #495057;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
}

.ricerca-schede-clear:hover {
    background: #dee2e6;
}

.ricerca-schede-esito {
    margin: -6px 0 14px;
    font-size: 13px;
    color: #6c757d;
}

.ricerca-nessun-risultato {
    margin: 10px 0 0;
    font-size: 14px;
    color: #6c757d;
}

.filtri-stato {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #dee2e6;
}

.filtri-stato label {
    display: block;
    margin-bottom: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
}

.filtri-stato input[type="radio"] {
    margin-right: 8px;
}

.lista-schede {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.scheda-item {
    padding: 15px;
    background: #ffffff;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.scheda-item:hover {
    border-color: #27ae60;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.1);
}

.scheda-item.active {
    border-color: #27ae60;
    background: #f0f8f4;
}

.scheda-nome {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 15px;
}

.scheda-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.stato-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.stato-badge.stato-pubblicato {
    background: #d4edda;
    color: #155724;
}

.stato-badge.stato-non-pubblicato {
    background: #fff3cd;
    color: #856404;
}

.data {
    color: #6c757d;
    font-size: 12px;
}

.no-schede {
    text-align: center;
    color: #6c757d;
    padding: 20px;
    font-style: italic;
}

.admin-content {
    flex: 1;
    background: #ffffff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.scheda-dettagli .placeholder-message {
    text-align: center;
    color: #6c757d;
    padding: 60px 20px;
    font-size: 16px;
}

.scheda-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 2px solid #ecf0f1;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.scheda-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 26px;
}

.scheda-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.stato-corrente {
    color: #6c757d;
    font-size: 14px;
}

.stato-corrente strong {
    color: #2c3e50;
}

.btn-pubblica {
    padding: 10px 25px;
    background: #27ae60;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-pubblica:hover {
    background: #229954;
}

.btn-pubblica:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.pubblicato-badge {
    padding: 8px 16px;
    background: #d4edda;
    color: #155724;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
}

.scheda-body {
    margin-bottom: 30px;
}

.dettagli-sezione {
    margin-bottom: 30px;
}

.dettagli-sezione h3 {
    margin: 0 0 15px;
    color: #27ae60;
    font-size: 18px;
    font-weight: 600;
    border-left: 4px solid #27ae60;
    padding-left: 12px;
}

.dettagli-list {
    margin: 0;
    display: grid;
    gap: 15px;
}

.dettagli-list dt {
    font-weight: 600;
    color: #495057;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.dettagli-list dd {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 15px;
    line-height: 1.6;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 4px;
}

.scheda-footer {
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.scheda-footer small {
    color: #6c757d;
    font-size: 12px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.error {
    text-align: center;
    padding: 40px;
    color: #c00;
}

/* Form pubblico - Styling extra */
.form-pubblico .form-subtitle {
    text-align: center;
    color: #6c757d;
    margin: -10px 0 30px;
    font-size: 16px;
}

/* Upload foto e video */
.form-help {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
}

input[type="file"].foto-upload {
    padding: 10px;
    border: 2px dashed #ddd;
    border-radius: 4px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s;
}

input[type="file"].foto-upload:hover {
    border-color: #27ae60;
    background: #f0f8f4;
}

.foto-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
}

.foto-preview-item {
    flex: 0 0 calc(25% - 12px);
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px;
    background: #fff;
    text-align: center;
}

.foto-preview-item img {
    max-width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
}

.foto-preview-item .foto-name {
    display: block;
    font-size: 11px;
    color: #6c757d;
    word-wrap: break-word;
}

input.video-url-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
    background: #ffffff;
}

input.video-url-input:focus {
    outline: none;
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

/* Responsive foto preview */
@media (max-width: 768px) {
    .foto-preview-item {
        flex: 0 0 calc(50% - 8px);
    }
}

@media (max-width: 480px) {
    .foto-preview-item {
        flex: 0 0 100%;
    }
}

/* Admin - Visualizzazione foto e video */
.admin-foto-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.admin-foto-item {
    flex: 0 0 calc(25% - 12px);
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 5px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.admin-foto-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.3s;
}

.admin-foto-item img:hover {
    transform: scale(1.05);
}

.admin-video-embed {
    margin-top: 10px;
    margin-bottom: 10px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.admin-video-embed iframe {
    max-width: 100%;
    border-radius: 6px;
}

/* Responsive admin foto */
@media (max-width: 768px) {
    .admin-foto-item {
        flex: 0 0 calc(50% - 8px);
    }
}

@media (max-width: 480px) {
    .admin-foto-item {
        flex: 0 0 100%;
    }
}

/* Responsive Admin */
@media (max-width: 992px) {
    .admin-schede-container {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        max-height: 400px;
    }

    .scheda-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .scheda-actions {
        width: 100%;
        justify-content: space-between;
    }
}

/* ===================================
   ELENCO ASSOCIATI - Grid Layout
   =================================== */

.elenco-associati-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.associati-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.associato-card {
    background: var(--color-bg-white);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    border-top: 4px solid var(--color-accent-green);
}

.associato-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(40, 176, 97, 0.3);
    border-top-color: #22965a;
}

.associato-content {
    padding: 25px;
    flex: 1;
}

.associato-nome {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-heading);
    margin: 0 0 15px 0;
}

.associato-info {
    color: var(--color-text-dark);
    font-size: 15px;
}

.associato-regione {
    color: var(--color-accent-green);
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
}

.associato-descrizione {
    line-height: 1.6;
    color: var(--color-text-dark);
    margin: 0;
}

.associato-actions {
    padding: 0 25px 25px 25px;
}

.btn-apri-azienda {
    display: inline-block;
    width: 100%;
    padding: 12px 24px;
    background: var(--color-accent-green);
    color: var(--color-bg-white);
    text-align: center;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid var(--color-accent-green);
}

.btn-apri-azienda:hover {
    background: #22965a;
    color: var(--color-bg-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 176, 97, 0.4);
}

/* ===================================
   DETTAGLIO AZIENDA
   =================================== */

.dettaglio-azienda-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

.azienda-header {
    /* Stesso fondo della regola in style-modern.css: allineato qui perche'
       questo foglio non dipenda dall'ordine di caricamento. */
    background: #172e2e;
    color: #fff;
    padding: 40px;
    border-radius: 12px;
    margin-bottom: 30px;
    border-top: 5px solid var(--color-primary);
}

.azienda-titolo {
    font-size: 36px;
    font-weight: 700;
    margin: 0 0 15px 0;
    color: #fff;
}

.azienda-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 16px;
    opacity: 0.95;
}

.meta-item {
    display: inline-flex;
    align-items: center;
}

.meta-item a {
    color: #fff;
    text-decoration: underline;
}

.azienda-section {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.azienda-section h2 {
    font-size: 28px;
    color: #2c3e50;
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 3px solid #3498db;
}

.azienda-section h3 {
    font-size: 20px;
    color: #34495e;
    margin: 0 0 15px 0;
}

.azienda-section p {
    line-height: 1.8;
    color: #555;
    font-size: 16px;
}

/* Galleria Foto */
.foto-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.foto-item {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.foto-item:hover {
    transform: scale(1.05);
}

.foto-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

/* Video Embed */
.video-embed-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
}

.video-embed-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

/* Details Grid - DEPRECATO (usato nelle vecchie versioni) */
.azienda-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Details Vertical - Layout verticale per migliore leggibilità */
.azienda-details-vertical {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.azienda-details-vertical .detail-box {
    width: 100%;
    max-width: 100%;
}

.detail-box {
    background: #f7f9fa;
    padding: 25px;
    border-radius: 8px;
    border-left: 4px solid var(--color-accent-green);
    transition: all 0.3s ease;
}

.detail-box:hover {
    border-left-color: #22965a;
    box-shadow: 0 4px 12px rgba(40, 176, 97, 0.15);
    transform: translateX(4px);
}

.detail-box h3 {
    color: var(--color-heading);
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
}

.detail-box p,
.detail-box-text p {
    margin: 0;
    color: var(--color-text-dark);
    line-height: 1.6;
}

/* Contatti */
.azienda-contatti {
    background: #f7f9fa;
    padding: 30px;
    border-radius: 8px;
    border-left: 4px solid var(--color-accent-green);
}

.azienda-contatti h2 {
    padding-bottom: 15px;
    border-bottom: 3px solid var(--color-accent-green);
    display: inline-block;
    margin-bottom: 25px;
}

.contatti-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.contatto-item {
    font-size: 15px;
    color: #555;
}

.contatto-item strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 5px;
}

.contatto-item a {
    color: #3498db;
    text-decoration: none;
}

.contatto-item a:hover {
    text-decoration: underline;
}

/* Actions */
.azienda-actions {
    text-align: center;
    margin-top: 40px;
}

.btn-torna-elenco {
    display: inline-block;
    padding: 14px 32px;
    background: var(--color-primary);
    color: var(--color-heading);
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid var(--color-primary);
}

.btn-torna-elenco:hover {
    background: var(--color-primary-dark);
    color: var(--color-heading);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(227, 189, 44, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .associati-grid {
        grid-template-columns: 1fr;
    }

    .azienda-titolo {
        font-size: 28px;
    }

    .azienda-meta {
        flex-direction: column;
        gap: 10px;
    }

    .foto-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .azienda-details-grid {
        grid-template-columns: 1fr;
    }

    .contatti-grid {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   FORM EDIT SCHEDA (Area Riservata)
   =================================== */

.scheda-edit-form .input-denominazione {
    width: 100%;
    font-size: 24px;
    font-weight: 700;
    border: 2px solid #ddd;
    padding: 8px 12px;
    border-radius: 4px;
    transition: border-color 0.3s;
}

.scheda-edit-form .input-denominazione:focus {
    outline: none;
    border-color: #3498db;
}

.dettagli-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.dettagli-form-grid .form-group {
    display: flex;
    flex-direction: column;
}

.dettagli-form-grid .form-group.full-width {
    grid-column: 1 / -1;
}

.dettagli-form-grid label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 14px;
}

.dettagli-form-grid input[type="text"],
.dettagli-form-grid input[type="email"],
.dettagli-form-grid input[type="url"],
.dettagli-form-grid textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.dettagli-form-grid input:focus,
.dettagli-form-grid textarea:focus {
    outline: none;
    border-color: #3498db;
}

.dettagli-form-grid textarea {
    resize: vertical;
    min-height: 80px;
}

/* Footer actions */
.scheda-footer {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #ecf0f1;
}

.scheda-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.scheda-form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-start;
}

.btn-aggiorna {
    padding: 12px 30px;
    background: #27ae60;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-aggiorna:hover {
    background: #229954;
}

.btn-aggiorna:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.btn-elimina {
    padding: 12px 30px;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-elimina:hover {
    background: #c0392b;
}

.btn-elimina:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.scheda-footer .form-message {
    padding: 15px;
    border-radius: 6px;
    font-weight: 600;
    display: none;
}

.scheda-footer .form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.scheda-footer .form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive */
@media (max-width: 768px) {
    .dettagli-form-grid {
        grid-template-columns: 1fr;
    }

    .scheda-form-actions {
        flex-direction: column;
    }

    .btn-aggiorna,
    .btn-elimina {
        width: 100%;
    }
}

/* ===================================
   MODAL GESTIONE UTENTI (solo Caterina)
   =================================== */

/* Pulsante "Gestisci Utenti" nell'header */
.btn-gestisci-utenti {
    padding: 10px 20px;
    background: #3498db;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-gestisci-utenti:hover {
    background: #2980b9;
}

/* Modal overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    overflow-y: auto;
    padding: 20px;
}

.modal-container {
    position: relative;
    max-width: 500px;
    margin: 50px auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: #fff;
    padding: 25px 30px;
    position: relative;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.modal-body {
    padding: 30px;
}

.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body .form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 14px;
}

.modal-body .form-group input[type="text"],
.modal-body .form-group input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}

.modal-body .form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1);
}

.modal-body .form-help {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #7f8c8d;
    font-style: italic;
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.btn-crea-utente {
    flex: 1;
    padding: 14px 24px;
    background: #27ae60;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
}

.btn-crea-utente:hover {
    background: #229954;
}

.btn-crea-utente:active {
    transform: translateY(1px);
}

.btn-crea-utente:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.btn-annulla {
    padding: 14px 24px;
    background: #95a5a6;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-annulla:hover {
    background: #7f8c8d;
}

.modal-body .form-message {
    margin-top: 20px;
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    display: none;
}

.modal-body .form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.modal-body .form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal-container {
        margin: 20px auto;
        max-width: 90%;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-header h2 {
        font-size: 20px;
        padding-right: 40px;
    }

    .modal-body {
        padding: 20px;
    }

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

    .btn-crea-utente,
    .btn-annulla {
        width: 100%;
    }
}
/* ============================================================================
   AREA RISERVATA v1.5 - CSS ADDITIONS
   Aggiungere questo CSS alla fine del file assets/style.css
   ============================================================================ */

/* Counter caratteri */
.has-counter {
    position: relative;
}

.char-counter {
    display: block;
    text-align: right;
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.char-counter.warning {
    color: #ff9800;
    font-weight: bold;
}

.char-counter.danger {
    color: #f44336;
    font-weight: bold;
}

/* Altre sedi dinamiche */
#altre-sedi-container {
    margin-bottom: 10px;
}

.altra-sede-item {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.altra-sede-item input[type="text"] {
    flex: 1;
    min-width: 0;
}

.btn-remove-sede {
    background: #f44336;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.btn-remove-sede:hover {
    background: #d32f2f;
}

.btn-add-sede {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-add-sede:hover {
    background: #45a049;
}

/* Profili social */
.social-links-grid {
    display: grid;
    gap: 12px;
}

.social-link-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.social-icon {
    font-size: 24px;
    width: 40px;
    text-align: center;
    color: #555;
}

.social-link-item input {
    flex: 1;
}

/* File allegati dinamici */
#file-allegati-container {
    margin-bottom: 10px;
}

.file-allegato-item {
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 12px;
    border-radius: 4px;
    background: #f9f9f9;
    position: relative;
}

.file-allegato-item input[type="text"],
.file-allegato-item input[type="url"],
.file-allegato-item input[type="file"],
.file-allegato-item textarea {
    width: 100%;
    margin-bottom: 8px;
}

.btn-remove-file {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f44336;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.btn-remove-file:hover {
    background: #d32f2f;
}

.btn-add-file {
    background: #2196F3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-add-file:hover {
    background: #1976D2;
}

/* Recapiti compilatore */
.recapiti-compilatore {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 20px;
    margin-bottom: 20px;
}

.recapiti-compilatore h3 small {
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

/* Form intro */
.form-intro {
    background: #e3f2fd;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    border-left: 4px solid #2196F3;
}

.btn-regolamento {
    background: #2196F3;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
}

.btn-regolamento:hover {
    background: #1976D2;
    color: white;
}

/* Select regioni */
select#regione {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .altra-sede-item {
        flex-wrap: wrap;
    }

    .altra-sede-item input[type="text"] {
        width: 100% !important;
        flex: 1 1 100%;
    }

    .social-link-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .social-icon {
        width: 100%;
    }
}

/* No items placeholders */
.no-sedi,
.no-files {
    color: #999;
    font-style: italic;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
}
