/* --- STILE INTEGRATO --- */
:root {
    --primary-dark: #1e1e2f;
    --secondary-dark: #2c2c3a;
    --accent-color: #00e676;
    --text-color: #e0e0e0;
    --border-color: #444;
    --gold-color: #ffc107;
    --blue-btn: #007bff;
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: "Heebo", sans-serif; }

body {
    background-color: var(--primary-dark);
    color: var(--text-color);
    padding-bottom: 120px; /* Spazio extra per bottoni mobile */
}

header {
    position: sticky; top: 0; z-index: 1000;
    background-color: #2c2c3a;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.contenitore-catalogo {
    width: 80%; 
    max-width: 1600px;
    margin: 0 auto;
    padding-top: 20px;
}
h1.titolo-catalogo { 
    color: #fff; text-align: center; margin-bottom: 30px; margin-top: 65px;
    text-transform: uppercase; border-bottom: 2px solid var(--border-color); 
    padding-bottom: 15px; padding-top: 40px; 
    font-size: 24px; letter-spacing: 1px;
}
/* Form Ricerca Flottante */
.form_cerca_fisso {
    position: fixed; top: 170px; left: 440px; z-index: 9999;
    background-color: rgba(44, 44, 58, 0.95); /* Leggermente più opaco */
    backdrop-filter: blur(8px);
    padding: 5px 8px; /* Un po' meno padding verticale per allineare tutto */
    border-radius: 50px; border: 1px solid #555;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5); display: flex; align-items: center;
    transition: all 0.3s ease;
    gap: 5px; /* Spazio tra gli elementi */
}

.form_cerca_fisso:hover { border-color: var(--gold-color); box-shadow: 0 6px 20px rgba(255, 193, 7, 0.2); }

/* NUOVO STILE PER LA SELECT */
.select_cerca_fisso {
    background-color: transparent;
    color: #ffcc00; /* Colore giallo/oro per distinguerlo */
    border: none;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    font-weight: bold;
    max-width: 40px; /* Mostra solo l'icona inizialmente se vuoi compattare, o togli per vedere testo */
    -webkit-appearance: none; /* Rimuove la freccia standard su alcuni browser */
    appearance: none; 
    text-align: center;
}

/* Se vuoi vedere tutto il testo della select, cambia max-width sopra in 'auto' */
.select_cerca_fisso option {
    background-color: #2c2c3a; /* Sfondo scuro per le opzioni aperte */
    color: #fff;
}

.input_cerca_fisso {
    background: transparent; border: none; color: #fff; padding: 5px 5px;
    width: 120px; /* Leggermente ridotto per far spazio alla select */
    font-size: 14px; outline: none; margin: 0;
    border-left: 1px solid #555; /* Separatore tra select e input */
    padding-left: 10px;
}
/*
.btn_cerca_fisso {
    width: 32px; height: 32px; border-radius: 50%; border: none;
    background: #0070ba url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>') no-repeat center center;
    background-size: 18px; cursor: pointer; transition: transform 0.2s;
}
.btn_cerca_fisso:hover { transform: scale(1.1); }

@media (max-width: 799px) { 
    .form_cerca_fisso {top: 120px; left: 20px; } 
}
    */
/* Filtri */
.filter-bar {
    display: flex; justify-content: center; flex-wrap: wrap;
    gap: 10px; margin-bottom: 30px; padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}
.filter-btn {
    background-color: var(--secondary-dark); color: #aaa;
    border: 1px solid var(--border-color); padding: 10px 20px;
    border-radius: 20px; text-decoration: none; font-weight: bold;
    font-size: 14px; transition: all 0.3s; text-transform: capitalize;
}
.filter-btn:hover, .filter-btn.active {
    background-color: #00bcd4; color: #fff; border-color: #00bcd4;
    box-shadow: 0 0 10px rgba(0, 188, 212, 0.3);
}
/* Mobile Filters */
.mobile-filters { display: none; }
/* Griglia */
.results-grid {
    display: grid; 
    gap: 15px;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    /* AGGIUNTA FONDAMENTALE: impedisce alle card di allungarsi per copiare l'altezza della vicina */
    align-items: start; 
}
/* Le Media Queries per le colonne restano uguali, assicurati solo che results-grid abbia align-items: start */
@media (min-width: 1400px) { .results-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1100px) and (max-width: 1399px) { .results-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 800px) and (max-width: 1099px) { .results-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 799px) { .results-grid { grid-template-columns: 1fr; } }
/* Card */
.card {
    background-color: var(--secondary-dark); border: 1px solid var(--border-color);
    border-radius: 12px; overflow: hidden;
    transition: transform 0.2s; display: flex; flex-direction: column; position: relative;
}
.card:hover { transform: translateY(-5px); border-color: #00bcd4; }
.a_kit_codice_acquisto, 
.a_kit_codice_acquisto:link, 
.a_kit_codice_acquisto:visited {
    text-decoration: none !important;
}




.id_kit_tipo { 
font-size: 12px; 
color: #fff;  
margin-top: auto; 
display: flex; 
justify-content: space-between;
align-items: center; 
margin-bottom: 12px; 
border-top: 1px solid #444; 
padding-top: 7px; 
}

.id_kit_tipo a{
text-decoration: none !important;
text-transform: uppercase !important;
}

.id_kit_tipo a span {
background-color: #00bcd4;
text-transform: none !important;
color:#fff; font-size: 12px;
z-index: 10;
padding: 2px;    
border-radius: 5px;    
border: #f2e14c; 
}
.id_kit_tipo_span {
color:#ffcc00; 
}
.id_kit_tipo_span_a span:hover {
background-color:  #06a4b9;   
box-shadow: 0 2px 10px rgb(117, 219, 237);
}

.kit_codice_acquisto { 
font-size: 12px; 
color: #fff;  
margin-top: auto; 
display: flex; 
justify-content: space-between;
align-items: center; 
margin-bottom: 12px; 
border-top: 1px solid #444; 
padding-top: 7px; 
}

.kit_codice_acquisto a{
text-decoration: none !important;
text-transform: uppercase !important;
}

.kit_codice_acquisto a span {
background-color:   #00bcd4;
color:#fff; font-size: 12px;
z-index: 10;
padding: 2px;    
border-radius: 5px;    
}
.a_kit_codice_acquisto span:hover {
box-shadow: 0 2px 10px rgb(117, 219, 237);
}


.id_gruppo { 
margin-top: auto; 
display: flex; 
justify-content: space-between; 
align-items: center;
font-size: 13px;  
margin-bottom: 12px; 
border-top: 1px solid #444; 
padding-top: 7px; 
}
.id_gruppo a{ 
margin-bottom: 5px; 

color: #00bcd4 !important; 
text-decoration: none !important;
}
.id_gruppo a span {
background-color: #384954;
text-decoration: none !important;
text-transform: none !important;
color:#fff; font-size: 12px;
z-index: 10;
padding: 2px;    
border-radius: 5px;    
}
.id_gruppo a span:hover {
box-shadow: 0 2px 10px rgb(117, 219, 237);
}

.cat-badge {
    position: absolute; top: 6px; right: 5px;
    background-color: rgba(0,0,0,0.7); color: #fff; font-size: 10px;
    padding: 2px 6px; border-radius: 4px; text-transform: uppercase; z-index: 10;
}
.cat-badge {
    text-decoration: underline;
    background-color: #dc3545; color: #fff; font-size: 12px;
    
}
.cat-home {
    position: absolute; top: 7px; left: 5px;
    background-color: rgba(0,0,0,0.7); color: #fff; font-size: 10px;
    padding: 2px 6px; border-radius: 4px; text-transform: uppercase; z-index: 10;
}
.cat-home {
    text-decoration: underline;
    background-color: #25acef; color: #fff; font-size: 12px;    
}
.id { margin-bottom: 5px; font-size: 13px; }
.id a{ margin-bottom: 5px; font-size: 13px; color: #00bcd4 !important; text-transform: none !important;}
.id span a{ margin-bottom: 5px; font-size: 13px !important; text-transform: uppercase !important; color: #00bcd4 !important;}
.card-img-link { background-color: #fff; display: block; padding: 10px; border-bottom: 1px solid var(--border-color); }
.card-img-top { width: 100%; height: 160px; object-fit: contain; display: block; }
.card-body { padding: 12px; flex: 1; display: flex; flex-direction: column; }
.card-title {text-transform: uppercase; font-size: 15px; font-weight: bold; color: #edbe33; margin-bottom: -15px; line-height: 1.1; height: 40px; overflow: hidden; }
.card-barcode {text-transform: uppercase; font-size: 15px; font-weight: bold; color: #00bcd4; margin-bottom: -15px; line-height: 1.1; height: 40px; overflow: hidden; }
.tech-specs { font-size: 10px; color: #aaa; margin-bottom: 10px; min-height: 20px; display: flex; flex-wrap: wrap; gap: 4px; }
.tech-badge { background: #3a3a50; padding: 2px 6px; border-radius: 8px; color: var(--accent-color); border: 1px solid #444; }

.qta-box { margin-bottom: 10px; font-size: 12px; }
.qta-val-green { color: #28a745; font-weight:bold; }
.qta-val-orange { color: #f79335; font-weight:bold; }
.qta-val-red { color: #dc3545; font-weight:bold; }

.price-row { margin-top: auto; display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; border-top: 1px solid #444; padding-top: 7px; }
.price-row .price-label{font-size: 14px;  }
.price-fornitore { font-size: 15px; font-weight: bold; color: #f4a135; }
.price-tag { font-size: 18px; font-weight: bold; color: #00bcd4; }

.btn-group { display: flex; flex-direction: column; gap: 8px; }
.btn-view { background-color: var(--blue-btn); color: white; text-align: center; padding: 8px; border-radius: 6px; text-decoration: none; font-weight: bold; font-size: 13px; transition: 0.3s; }
.btn-view:hover { background-color: #0056b3; }
.modifica { background-color: #f5ab43; color: white; text-align: center; padding: 8px; border-radius: 6px; text-decoration: none; font-weight: bold; font-size: 13px; transition: 0.3s; }
.modifica:hover { background-color: #ec9b2b; }
/* Selettore Quantità */
.qty-action-container { display: flex; gap: 5px; }
.qty-selector { display: flex; align-items: center; background: #1e1e2f; border: 1px solid #444; border-radius: 6px; overflow: hidden; flex: 0 0 90px; }
.qty-btn { background: #3a3a50; color: #fff; border: none; width: 25px; height: 38px; font-weight: bold; cursor: pointer; transition: 0.2s; }
.qty-btn:hover { background: #505070; }
.qty-input { width: 40px; text-align: center; border: none; background: transparent; color: #fff; font-weight: bold; font-size: 14px; height: 38px; margin: 0; padding: 0; -moz-appearance: textfield; }
.qty-input::-webkit-outer-spin-button, .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.btn-cart-card { flex: 1; background: linear-gradient(135deg, #00c853, #009624); color: white; text-align: center; padding: 0 10px; border-radius: 6px; text-decoration: none; font-weight: bold; font-size: 13px; transition: 0.3s; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; height: 38px; }
.btn-cart-card:hover { filter: brightness(1.01); }

/* Stile del bottone Toggle (l'ingranaggio) */
.btn-toggle-admin {
    width: 100%;
    background-color: transparent;
    border: 1px dashed #555;
    color: #888;
    padding: 6px; /* Padding ridotto per occupare meno spazio */
    margin-top: 10px; /* Spazio minimo dal carrello */
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px; /* Font piccolo per essere discreto */
    text-transform: uppercase;
    font-weight: bold;
    transition: all 0.2s;
}

.btn-toggle-admin:hover {
    background-color: #2c2c3a;
    color: #fff;
    border-color: #aaa;
}

/* Stile del Pannello Strumenti (Il blocco che si apre) */
.admin-tools {
    display: none; /* Nascosto di default */
    flex-direction: column;
    gap: 10px;
    
    /* Spostiamo margini e bordi qui, ma saranno visibili solo quando il JS mette display: flex */
    margin-top: 15px; 
    padding-top: 15px; 
    border-top: 1px dashed #666;
}

/* Animazione fluidità (opzionale) */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Verde - Aggiungi */
.btn-admin-add { 
    background: linear-gradient(135deg, #00c853, #009624) !important; 
}

/* Arancio - Sottrai */
.btn-admin-remove { 
    background: linear-gradient(135deg, #ff9800, #f57c00) !important; 
}

/* Blu - Modifica Costo */
.btn-admin-cost { 
    background: linear-gradient(135deg, #2979ff, #1565c0) !important; 
}

/* Rosso - Elimina */
.btn-admin-delete { 
    background: linear-gradient(135deg, #f44336, #d32f2f) !important; 
}

/* Giallo (#ffca28) - Copia */
/* Aggiungo color #333 perché il bianco sul giallo si legge male */
.btn-admin-copy { 
    background: linear-gradient(135deg, #f1e4bd, #f5c98f) !important; 
    color: #333 !important; 
}
/* --- BOTTONI FISSI --- */
.cart-btn, .cart-btn_vendi, .cart-btn_empty {
    position: fixed !important; right: 20px !important; color: #000 !important;
    padding: 10px 18px !important; border-radius: 50px !important;
    display: flex !important; align-items: center !important; gap: 10px !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5) !important; z-index: 99999 !important;
    text-decoration: none !important; font-weight: bold !important; font-size: 15px !important;
    transition: transform 0.3s !important;
}
.cart-btn { top: 120px !important; background: linear-gradient(135deg, #ffca28, #ffc107) !important; }
.cart-btn_vendi { top: 180px !important; background: linear-gradient(135deg, #00e676, #00c853) !important; }
.cart-btn_empty { top: 240px !important; background: linear-gradient(135deg, #ff9800, #f57c00) !important; color: white !important; }
.cart-btn:hover, .cart-btn_vendi:hover, .cart-btn_empty:hover { transform: scale(1.05); }
.cart-count { background: #d32f2f; color: white; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 0.8em; }
.no-results { text-align: center; padding: 50px; color: #aaa; font-size: 18px; grid-column: 1 / -1; }
        /* CSS PER I BOTTONI ADMIN (Stile Carrello) */
        .admin-tools {
            margin-top: 20px;
            padding-top: 15px;
            border-top: 1px dashed #555;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        
        .admin-label {
            font-size: 11px;
            color: #aaa;
            margin-bottom: -5px;
            margin-left: 2px;
        }
        .row-copy-delete {
            display: flex;
            gap: 10px;
            margin-top: 5px;
        }
        /* Varianti colori bottoni 
        
        .btn-admin-add { background-color: #6f42c1 !important; } 
        .btn-admin-add:hover { background-color: #59359a !important; }

        .btn-admin-remove { background-color: #fd7e14 !important; } 
        .btn-admin-remove:hover { background-color: #e36d0d !important; }

        .btn-admin-cost { background-color: #ffc107 !important; color: #000 !important; } 
        .btn-admin-cost:hover { background-color: #e0a800 !important; }

        .btn-admin-copy { background-color: #17a2b8 !important; width: 100%; text-align:center; padding: 10px; border-radius: 5px; color: white; text-decoration: none; font-weight: bold; }
        .btn-admin-copy:hover { background-color: #138496 !important; }

        .btn-admin-delete { background-color: #dc3545 !important; width: 100%; border:none; padding: 10px; border-radius: 5px; color: white; font-weight: bold; cursor:pointer;}
        .btn-admin-delete:hover { background-color: #c82333 !important; }
        */


/* ========================================== */
/* RESPONSIVE MOBILE (< 850px) */
/* ========================================== */
@media screen and (max-width: 850px) {
    .filter-bar { display: none; }
    .mobile-filters { display: block; text-align: center; margin-bottom: 30px; padding: 15px; background-color: #2e2e44; border-radius: 12px; border: 1px solid #444; }
    .mobile-cat-select { background-color: #222236; color: #fff; border: 2px solid #00bcd4; padding: 12px 20px; border-radius: 30px; font-size: 16px; width: 100%; max-width: 350px; outline: none; appearance: none; font-weight: bold; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
    .mobile-filters label { display: block; margin-bottom: 8px; color: var(--gold-color); font-weight: bold; text-transform: uppercase; letter-spacing: 1px; }
    
    /* Fix Bottoni Flottanti su Mobile */
    .cart-btn, .cart-btn_vendi, .cart-btn_empty {
        width: auto !important; 
        right: 10px !important;
        padding: 8px 12px !important;
        font-size: 12px !important;
        top: auto !important; 
    }
    .cart-btn       { bottom: 130px !important; }
    .cart-btn_vendi { bottom: 80px !important; }
    .cart-btn_empty { bottom: 30px !important; }
    /* Fix Ricerca su Mobile */
    .form_cerca_fisso { 
        top: auto; 
        bottom: 20px; 
        left: 20px; 
        background-color: rgba(0, 0, 0, 0.8); 
        border-color: #777;
        width: auto !important; /* Impedisce larghezza 100% */
        max-width: 200px;
    }
    .input_cerca_fisso { width: 110px; font-size: 12px; }
/* Allarga il contenitore principale al 96% dello schermo */
    .contenitore-catalogo {
        width: 90% !important; 
        padding-top: 10px; /* Un po' meno padding sopra */
    }

    /* (Opzionale) Se vuoi che la griglia usi davvero tutto lo spazio */
    .results-grid {
        gap: 10px; /* Riduce leggermente lo spazio verticale tra le card */
    }
}
/* Stile per il contenitore di ogni riga di azione (Input + Bottone) */
.qty-action-container {
    display: flex;          /* Mette gli elementi uno a fianco all'altro */
    gap: 5px;               /* Spazio tra il selettore +/- e il bottone */
    align-items: center;    /* Allinea tutto verticalmente al centro */
    margin-bottom: 8px;     /* Spazio sotto ogni riga per non farle attaccare */
    width: 100%;            /* Occupa tutto lo spazio disponibile nella card */
}
/* --- STILE PULSANTE TORNA SU --- */
#btn-back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: none; /* Nascosto di default */
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #00e676, #00c853); /* Verde accento */
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 9999; /* Sopra tutto */
    font-size: 24px;
    text-align: center;
    line-height: 50px; /* Centra la freccia verticalmente */
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#btn-back-to-top:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, #00c853, #009624);
}

/* ADATTAMENTO MOBILE: Spostalo un po' più in alto se ci sono altri bottoni fissi */
@media screen and (max-width: 850px) {
    #btn-back-to-top {
        bottom: 110px; /* Per non coprire i bottoni del carrello */
        left: 13px;
        width: 45px;
        height: 45px;
        line-height: 45px;
        font-size: 20px;
    }
}