/* =========================================
   1. VARIABILI E RESET GLOBALE
   ========================================= */
:root {
  --bg-dark: #1b1b1b;
  --bg-card: #2a2a2a;
  --bg-darker: #111111;
  --accent-orange: #e58b47;
  --accent-olive: #838563;
  --text-main: #ffffff;
  --text-muted: #a0a0a0;
  --font-body: 'Roboto', sans-serif;
  --font-title: 'Oswald', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
}

h1, h2, h3, .logo {
    font-family: var(--font-title);
    text-transform: uppercase;
}

/* =========================================
   2. HEADER E NAVIGAZIONE
   ========================================= */
header {
    background-color: var(--bg-darker);
    border-bottom: 1px solid #333;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Contenitore principale del logo (immagine + blocco testo) */
.logo a.logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

/* Immagine del logo ingrandita per pareggiare le due righe di testo */
.logo-img {
    height: 55px; /* Portato da 40px a 55px per adattarsi alle due righe */
    width: auto;
}

/* Contenitore che impila le parole una sopra l'altra */
.logo-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.1; /* Avvicina le due parole per farle sembrare un blocco unico */
}

/* Stile della scritta unificata col colore del logo */
.logo-text span {
    color: #e4dabc; /* Il colore sabbia campionato dal tuo logo */
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    font-family: var(--font-title);
    text-transform: uppercase;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links li a, .dropbtn {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: color 0.3s;
}

.nav-links li a:hover, .dropdown:hover .dropbtn {
    color: var(--accent-orange);
}

/* Dropdown Menu */
.dropdown { position: relative; display: inline-block; }
.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--bg-darker);
    min-width: 160px;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.5);
    z-index: 1;
    border: 1px solid #333;
    border-radius: 4px;
    overflow: hidden;
}
.dropdown-content a {
    color: white;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
}
.dropdown-content a:hover { background-color: #333; }
.dropdown:hover .dropdown-content { display: block; }
.badge, .badge-small {
    background-color: #ff4d4d; color: white; border-radius: 50%;
    padding: 2px 6px; font-size: 0.8rem; font-weight: bold; margin-left: 5px;
}

/* =========================================
   3. BOTTONI GLOBALI
   ========================================= */
.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background-color: var(--accent-orange);
    color: white;
}
.btn-primary:hover {
    background-color: #c97539;
}

.btn-secondary {
    background-color: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}
.btn-secondary:hover {
    background-color: rgba(255,255,255,0.2);
}

/* =========================================
   4. HERO SECTION
   ========================================= */
.hero {
    background-image: linear-gradient(rgba(27, 27, 27, 0.7), rgba(27, 27, 27, 0.9)), url('img/sfondo-soldati.jpg'); 
    background-size: cover;
    background-position: center;
    padding: 80px 20px;
    text-align: center;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Titolo principale "MERCATINO TATTICO" al centro */
.hero-content h1 {
    font-size: 4.5rem; /* Reso bello grande come nella bozza */
    margin-bottom: 0px;
    letter-spacing: 3px;
    color: #e4dabc; /* Stesso colore sabbia del tuo logo */
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.8); /* Ombra per farlo staccare dallo sfondo */
}

/* Sottotitolo "GEAR & SURPLUS" */
.hero-content h2 {
    font-size: 2.2rem;
    color: #838563; /* Verde oliva tattico */
    margin-bottom: 30px;
    letter-spacing: 4px;
    font-family: var(--font-title);
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.8);
}

/* Sottotitolo "GEAR & SURPLUS" */
.hero-content h3 {
    font-size: 2.2rem;
    color: #838563; /* Verde oliva tattico */
    margin-bottom: 30px;
    letter-spacing: 4px;
    font-family: var(--font-title);
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.8);
}

.hero-btns {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* =========================================
   5. SEZIONE RICERCA E CATEGORIE
   ========================================= */
.search-bar-section {
    padding: 40px 20px;
    background-color: var(--bg-darker);
    border-bottom: 1px solid #333;
}

.category-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
}

.category-btn input[type="radio"] { display: none; }

.category-btn .btn-content {
    background-color: var(--accent-olive);
    color: white;
    border-radius: 8px;
    padding: 15px 10px;
    width: 140px;
    height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-title);
}

.category-btn .btn-content i {
    font-size: 2.2rem;
    margin-bottom: 12px;
}

.category-btn .btn-content span {
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.category-btn input[type="radio"]:checked + .btn-content,
.category-btn:hover .btn-content {
    background-color: var(--accent-orange);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(229, 139, 71, 0.4);
}

/* =========================================
   6. GRIGLIA ANNUNCI E CARD PRODOTTI
   ========================================= */
.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 30px;
    letter-spacing: 1px;
}

/* La Griglia Automatica */
.annunci-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 25px;
}

.scheda-item {
    background-color: var(--bg-card);
    border-radius: 8px;
    border: 1px solid #333;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}

.scheda-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    border-color: #555;
}

/* Card Partner */
.scheda-item[style*="border: 1px solid #e67e22"] {
    border-color: var(--accent-orange) !important;
}

.immagine-item {
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.tag-categoria {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}

.tag-categoria.softair { background-color: var(--accent-orange); }
.tag-categoria.lasertag { background-color: var(--accent-olive); }

.info-item {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.info-item h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.location {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.footer-item {
    margin-top: auto;
    padding-top: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #333;
}

.prezzo {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--text-main);
    font-family: var(--font-title);
}

.btn-view {
    background-color: #444;
    color: white;
    padding: 6px 15px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: bold;
}

.scheda-item:hover .btn-view {
    background-color: var(--accent-orange);
}

/* =========================================
   7. FOOTER
   ========================================= */
footer {
    background-color: var(--bg-darker);
    text-align: center;
    padding: 20px;
    border-top: 1px solid #333;
    color: var(--text-muted);
    font-size: 0.9rem;
}
footer a {
    color: var(--accent-orange);
    text-decoration: none;
}

/* =========================================
   8. FORM E CONTENITORI (Login, Annunci, ecc.)
   ========================================= */
.auth-container {
    background: var(--bg-card, rgba(25, 25, 25, 0.70));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    max-width: 950px;
    width: 100%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    position: relative;
    flex-wrap: wrap;
    overflow: hidden;
    margin: 50px auto;
}

.auth-box { 
    flex: 1; 
    padding: 45px; 
    min-width: 320px; 
}

.auth-box h2 { 
    color: var(--accent-orange, #e58b47); 
    margin-bottom: 25px; 
    font-size: 1.8rem; 
    border-bottom: 2px solid #333; 
    padding-bottom: 10px; 
    text-align: center; 
}

.auth-box p { 
    font-size: 0.95rem; 
    color: var(--text-muted, #aaa); 
    margin-bottom: 25px; 
    text-align: center; 
}

.input-group { 
    margin-bottom: 20px; 
}

.input-group label { 
    display: block; 
    color: #e4dabc; /* Colore sabbia per riprendere il logo */
    font-weight: bold; 
    font-size: 0.8rem; 
    margin-bottom: 8px; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
}

.input-group input, 
.input-group select, 
.input-group textarea { 
    width: 100%; 
    padding: 12px; 
    background: rgba(0, 0, 0, 0.7); 
    border: 1px solid #555; 
    color: white; 
    border-radius: 4px; 
    font-family: var(--font-body, 'Roboto', sans-serif); 
}

.input-group input:focus, 
.input-group select:focus, 
.input-group textarea:focus { 
    border-color: var(--accent-orange, #e58b47); 
    outline: none; 
    background: rgba(20, 20, 20, 0.9);
}

.checkbox-group { 
    display: flex; 
    gap: 10px; 
    margin-bottom: 25px; 
    font-size: 0.85rem; 
    color: #ccc; 
    line-height: 1.3; 
}

.full-width { 
    width: 100%; 
}

/* =========================================
   9. MOBILE RESPONSIVE (SMARTPHONE)
   ========================================= */
@media (max-width: 768px) {
    /* 0. Sblocca l'header su mobile (lo fa scorrere verso l'alto) */
    header {
        position: relative;
        top: auto;
    }
    /* 1. Header e Navigazione in colonna */
    .navbar {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .nav-links {
        flex-direction: column;
        width: 100%;
        gap: 5px;
    }

    .nav-links li {
        width: 100%;
        text-align: center;
        border-bottom: 1px solid #333;
    }

    .nav-links li:last-child {
        border-bottom: none;
    }

    .nav-links a, .dropbtn {
        display: block;
        padding: 12px 0;
        width: 100%;
    }

    /* Fix menu a tendina su mobile: si apre spingendo in giù, senza sovrapporsi */
    .dropdown-content {
        position: relative;
        width: 100%;
        box-shadow: none;
        background-color: #222;
        border: none;
        border-radius: 0;
    }

    /* 2. Ridimensionamento testi Hero Section */
    .hero {
        padding: 50px 15px;
        min-height: auto;
    }

    .hero-content h1 {
        font-size: 2.4rem; /* Molto più piccolo rispetto ai 4.5rem del PC */
        letter-spacing: 1px;
    }

    .hero-content h2 {
        font-size: 1.4rem; /* Proporzionato al nuovo h1 */
        letter-spacing: 1.5px;
        margin-bottom: 20px;
    }

    /* Forziamo il rimpicciolimento dell'h3 inline che abbiamo appena creato */
    .hero-content h3 {
        font-size: 0.95rem !important;
        margin-bottom: 25px !important;
    }

    /* 3. Pulsanti in colonna larghi quanto lo schermo */
    .hero-btns {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
        max-width: 300px;
        box-sizing: border-box;
    }
}

/* =========================================
   10. ANIMAZIONE TATTICA (HUD REVEAL)
   ========================================= */

/* Creiamo l'effetto di comparsa dal basso con sfocatura (tipo schermo che si accende) */
@keyframes tacticalReveal {
    0% {
        opacity: 0;
        transform: translateY(25px);
        filter: blur(5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* Applichiamo l'animazione a cascata (staggered) agli elementi della Hero */

.hero-content h1 {
    opacity: 0; /* Partono invisibili */
    animation: tacticalReveal 0.8s cubic-bezier(0.2, 1, 0.3, 1) forwards;
}

.hero-content h2 {
    opacity: 0;
    /* Il ritardo (0.3s) fa sì che parta poco dopo il titolo principale */
    animation: tacticalReveal 0.8s cubic-bezier(0.2, 1, 0.3, 1) 1.0s forwards;
}

.hero-content h3 {
    opacity: 0;
    /* Ritardo maggiore (0.6s) */
    animation: tacticalReveal 0.8s cubic-bezier(0.2, 1, 0.3, 1) 1.9s forwards;
}

.hero-btns {
    opacity: 0;
    /* I bottoni compaiono per ultimi (0.9s) */
    animation: tacticalReveal 0.8s cubic-bezier(0.2, 1, 0.3, 1) 2.6s forwards;
}