﻿/* =================================================================
   STILI CSS PER PAGINA SEGNALETICA / BLOG - CARTELLI.IT
   ================================================================= */

/* -----------------------------------------------------------------
   0. VARIABILI ROOT & BASE UTILITY
   ----------------------------------------------------------------- */
:root {
    --cs-primary: #2e7d32;        
    --cs-primary-dark: #1b5e20;
    --cs-primary-light: #e8f5e9;
    --cs-dark: #666666;
    --cs-grey-bg: #f8f9fa;
    --cs-border: #e0e0e0;
    --cs-border-hover: #999999;
    --cs-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --cs-shadow-lg: 0 12px 20px -5px rgba(0, 0, 0, 0.08);
    --cs-radius: 0px;
    --cs-text-color: #666666;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* -----------------------------------------------------------------
   1. LAYOUT GENERALE
   ----------------------------------------------------------------- */
.cs-container {
    color: var(--cs-text-color);
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 25px 10px 25px;
    line-height: 1.6;
    box-sizing: border-box;
}

.cs-container *, 
.cs-container *::before, 
.cs-container *::after {
    box-sizing: border-box;
}

.cs-section {
    margin-bottom: 5px;
}

.cs-section-title {
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    color: #666666;
    margin-bottom: 15px;
    position: relative;
    padding-bottom: 0;
}

.cs-responsive-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

/* -----------------------------------------------------------------
   2. HERO BLOCK
   ----------------------------------------------------------------- */
.cs-about-alternate {
    background-color: #ffffff;
    padding: 0 0 5px 0;
}

.cs-hero-block {
    margin-top: 0;
    margin-bottom: 20px;
    width: 100%;
}

.cs-hero-img-wrapper {
    width: 100%;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--cs-border);
    border-radius: 0 !important;
    margin-bottom: 25px;
}

.cs-hero-img-wrapper .cs-responsive-img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
}

.cs-hero-title {
    font-size: 32px !important;
}

.cs-hero-content {
    text-align: left;
}

.cs-hero-content p {
    font-size: 15px;
    color: var(--cs-text-color);
    line-height: 1.7;
    margin-bottom: 0;
}

.cs-hero-content p:last-child {
    margin-bottom: 0;
}

.cs-row-title {
    font-size: 22px;
    font-weight: 700;
    color: #666666;
    margin-top: 0;
    margin-bottom: 15px;
    text-align: left;
}

/* -----------------------------------------------------------------
   3. CARDS CLICCABILI (Spaziatura Aumentata tra Immagine e Testo)
   ----------------------------------------------------------------- */
#settore-wrapper {
    width: 100%;
    display: block;
    clear: both;
}

.filtro-wrapper {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

.cards-wrapper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    padding: 0.5rem 0;
    margin: 0.5rem auto 1rem auto;
    max-width: 1200px;
    width: 100%;
}

.card {
    border: 1px solid var(--cs-border) !important;
    width: 100%;
    max-width: 100% !important;
    overflow: hidden;
    margin: 0;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    transition: all 0.25s ease;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--cs-border-hover) !important;
    box-shadow: var(--cs-shadow-lg);
}

.card-body {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 0;
    box-sizing: border-box;
    flex-grow: 1;
}

/* Immagine a filo bordo superiore/laterale e senza fondo grigio */
.card .img-wrapper {
    width: 100%;
    max-width: 100%;
    height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
    margin: 0 !important;
    background-color: transparent;
}

.card .img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.card:hover .img-wrapper img {
    transform: scale(1.04);
}

/* Aumentato il margine superiore del testo (20px) per staccarlo dall'immagine */
.card .text-wrapper {
    width: 100%;
    padding: 30px 14px 0 14px !important;
    margin: 0 !important;
    max-width: 100% !important;
    text-align: left !important;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    box-sizing: border-box;
}

.card .text-wrapper h4 {
    margin: 0 0 0.5rem 0 !important;
    text-align: left !important;
    font-size: 0.95rem;
    font-weight: 700;
    color: #666666; 
    line-height: 1.25;
}

.card .text-wrapper p {
    margin: 0 !important;
    font-size: 0.88rem;
    line-height: 1.4;
    color: #666666;
    flex-grow: 1;
    text-align: left !important;
}

/* Footer Card "Dettagli" */
.card .card-footer {
    padding: 12px 14px 14px 14px;
    margin-top: auto;
    font-size: 0.9rem !important;
    font-weight: 600;
    color: #666666;
    display: flex;
    align-items: center;
    gap: 4px;
    text-align: left;
    transition: color 0.2s ease;
}

.card:hover .card-footer {
    color: #333333;
}

.card .card-footer i {
    color: #4caf50;
}

/* Il codice prodotto sopra il titolo */
.card .text-wrapper .card-code {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #999999;
    margin-bottom: 4px;
}

/* Gli elementi nascosti da script non devono occupare spazio */
.card[hidden],
.cards-wrapper [hidden],
.blog-btn[hidden],
.blog-empty[hidden],
.blog-search-clear[hidden] {
    display: none !important;
}

/* Badge sull'immagine (tipo e "Nuovo") */
.card .img-wrapper {
    position: relative;
}

.card-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 6px;
    pointer-events: none;
}

.card-badge {
    display: inline-block;
    padding: 3px 9px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.4;
    color: #ffffff;
    background-color: #555555;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.card-badge--guida      { background-color: var(--cs-primary); }
.card-badge--prodotto   { background-color: #455a64; }
.card-badge--stagionale { background-color: #c62828; }
.card-badge--nuovo      { background-color: #fdd835; color: #222222; }

/* -----------------------------------------------------------------
   3b. BARRA DI RICERCA, FILTRI, CONTATORE, "MOSTRA ALTRI"
   ----------------------------------------------------------------- */
.blog-sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

.blog-toolbar {
    background-color: var(--cs-grey-bg);
    border: 1px solid var(--cs-border);
    padding: 16px;
    margin: 10px 0 0 0;
}

.blog-search {
    position: relative;
    display: flex;
    align-items: center;
}

.blog-search > .fa-magnifying-glass {
    position: absolute;
    left: 14px;
    color: #999999;
    pointer-events: none;
}

.blog-search input[type="search"] {
    width: 100%;
    height: 46px;
    padding: 0 44px 0 42px;
    font-size: 15px;
    color: #333333;
    background-color: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.blog-search input[type="search"]::-webkit-search-cancel-button { display: none; }

.blog-search input[type="search"]:focus {
    border-color: var(--cs-primary);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}

.blog-search-clear {
    position: absolute;
    right: 6px;
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    color: #888888;
    cursor: pointer;
    font-size: 16px;
}

.blog-search-clear:hover { color: #333333; }

.blog-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
}

.blog-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.blog-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    color: #555555;
    background-color: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 0;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.blog-pill:hover:not(:disabled) {
    border-color: #333333;
    color: #333333;
}

.blog-pill[aria-pressed="true"] {
    background-color: #333333;
    border-color: #333333;
    color: #ffffff;
}

.blog-pill:disabled {
    opacity: 0.45;
    cursor: default;
}

.blog-pill-n {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0 6px;
    background-color: rgba(0, 0, 0, 0.07);
}

.blog-pill[aria-pressed="true"] .blog-pill-n {
    background-color: rgba(255, 255, 255, 0.25);
}

.blog-selects {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.blog-select {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #666666;
}

.blog-select select {
    height: 36px;
    padding: 0 10px;
    font-family: inherit;
    font-size: 0.88rem;
    color: #333333;
    background-color: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 0;
    cursor: pointer;
    max-width: 280px;
}

.blog-select select:focus {
    outline: none;
    border-color: var(--cs-primary);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}

.blog-count {
    margin: 12px 0 0 0;
    font-size: 0.85rem;
    color: #888888;
    min-height: 1.2em;
}

.blog-empty {
    text-align: center;
    padding: 40px 20px;
    border: 1px dashed #cccccc;
    margin: 10px 0 20px 0;
}

.blog-empty p {
    margin: 0 0 16px 0;
    font-size: 15px;
}

/* Paginazione */
.blog-pager {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 15px 0 30px 0;
}

.blog-pager[hidden] {
    display: none !important;
}

.blog-page {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    color: #555555;
    background-color: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 0;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.blog-page:hover:not(:disabled):not([aria-current="page"]) {
    border-color: #333333;
    color: #333333;
}

.blog-page[aria-current="page"] {
    background-color: #333333;
    border-color: #333333;
    color: #ffffff;
    cursor: default;
}

.blog-page:disabled {
    opacity: 0.4;
    cursor: default;
}

.blog-page--nav i {
    font-size: 0.75rem;
}

.blog-page-dots {
    padding: 0 4px;
    color: #999999;
}

.blog-page:focus-visible {
    outline: 3px solid rgba(46, 125, 50, 0.5);
    outline-offset: 2px;
}

.blog-btn {
    display: inline-block;
    padding: 11px 26px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    background-color: var(--cs-primary);
    border: 0;
    border-radius: 0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.blog-btn:hover { background-color: #333333; }

/* Focus visibile da tastiera */
.blog-pill:focus-visible,
.blog-btn:focus-visible,
.blog-search-clear:focus-visible,
.card:focus-visible {
    outline: 3px solid rgba(46, 125, 50, 0.5);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .card, .card .img-wrapper img { transition: none; }
    .card:hover { transform: none; }
    .card:hover .img-wrapper img { transform: none; }
}

/* -----------------------------------------------------------------
   4. MEDIA QUERIES & RESPONSIVE
   ----------------------------------------------------------------- */
@media only screen and (max-width: 1050px) {
    .cards-wrapper {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media only screen and (max-width: 768px) {
    .cs-container {
        padding: 0 15px 10px 15px !important;
    }

    .cs-hero-title,
    .cs-row-title {
        font-size: 20px !important;
        line-height: 1.35 !important;
        margin-bottom: 12px !important;
    }

    .cards-wrapper {
        grid-template-columns: repeat(2, 1fr);
    }

    .blog-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .blog-selects {
        flex-direction: column;
        width: 100%;
        min-width: 0;
    }

    /* Su telefono l'etichetta va sopra il menu, che occupa tutta la larghezza
       senza allargarsi in base alla voce piu' lunga */
    .blog-select {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        width: 100%;
        min-width: 0;
    }

    .blog-select select {
        flex: none;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        height: 44px;
        text-overflow: ellipsis;
    }

    .blog-pills {
        min-width: 0;
    }
}

@media only screen and (max-width: 576px) {
    /* Su telefono restano solo le frecce, senza le parole */
    .blog-page--nav {
        font-size: 0;
        min-width: 40px;
        padding: 0;
    }

    .blog-page--nav i {
        font-size: 0.85rem;
    }
}

@media only screen and (max-width: 576px) {
    /* Rimosso il margine extra di 16px: le schede ora sono allineate
       alla barra di ricerca, con gli stessi 15px delle altre pagine */

    .cards-wrapper {
        grid-template-columns: repeat(1, 1fr);
    }
}