/* Variabili di Design - Tema Scuro Tecnico */
:root {
    --bg-main: #0b0c0e;
    --bg-card: #16181c;
    --bg-nested: #1e2228;
    --border-color: #2d3139;
    --text-main: #f0f2f5;
    --text-muted: #8a929e;
    --accent-free: #00e676;
    --accent-paid: #3b82f6; /* Colore blu tech per i giochi sotto i 5$ */
    --accent-link: #3b82f6;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'Space Grotesk', ui-monospace, monospace;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-sans);
    margin: 0;
    padding: 0 0 120px 0;
    line-height: 1.5;
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header del Sito */
.site-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.site-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -0.02em;
}

/* Componente Barra di Filtraggio */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 2px;
    margin-bottom: 2rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.filter-group label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.filter-select {
    background: var(--bg-nested);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    border-radius: 2px;
    cursor: pointer;
    outline: none;
}

.filter-select:focus {
    border-color: var(--accent-link);
}

/* Griglia Main e List */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.card {
    border: 1px solid var(--border-color);
    border-radius: 2px;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

.card h3 {
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
    line-height: 1.3;
}

.card h3 a {
    color: var(--text-main);
    text-decoration: none;
}

.card h3 a:hover {
    color: var(--accent-link);
    text-decoration: underline;
}

.card-meta {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem 0;
}

.card-price {
    font-family: var(--font-mono);
    color: var(--accent-free);
    font-weight: 700;
    margin: 0;
}

.card-price.paid {
    color: var(--accent-paid);
}

/* Gestione Immagini nelle Card */
.card-image-container {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Struttura Pagina Singolo Gioco */
.deal-article {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 2.5rem;
    border-radius: 2px;
}

.deal-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.02em;
}

.deal-meta {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.status-active {
    color: var(--accent-free);
    font-weight: 700;
}

.deal-image-container {
    width: 100%;
    max-height: 320px;
    aspect-ratio: 21 / 9;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    overflow: hidden;
    background-color: var(--bg-main);
}

.deal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.deal-content {
    font-size: 1.1rem;
    line-height: 1.7;
    margin: 2rem 0;
}

/* Box di Riscatto */
.redeem-box {
    background: var(--bg-nested);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-free);
    padding: 2rem;
    border-radius: 2px;
    text-align: left;
    margin-top: 2.5rem;
}

.redeem-box.paid {
    border-left-color: var(--accent-paid);
}

.redeem-box h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    color: #fff;
}

.price-row {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.price-free {
    color: var(--accent-free);
    font-weight: 700;
    background: rgba(0, 230, 118, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 2px;
    margin-left: 0.5rem;
}

.price-tag-paid {
    color: var(--accent-paid);
    font-weight: 700;
    background: rgba(59, 130, 246, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 2px;
    margin-left: 0.5rem;
}

.btn-redeem {
    display: inline-block;
    background: var(--accent-free);
    color: #000;
    padding: 1rem 2rem;
    border-radius: 2px;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    letter-spacing: 0.05em;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    transition: background 0.1s ease;
}

.btn-redeem.paid {
    background: var(--accent-paid);
    color: #fff;
}

.btn-redeem:hover {
	opacity: 0.9;
}

/* Contenitori Pubblicità */
.ad-container {
    margin: 2rem 0;
    min-height: 100px;
    background: var(--bg-main);
    border: 1px dashed var(--border-color);
    padding: 10px;
    border-radius: 2px;
}

.sticky-ad {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    z-index: 9999;
    text-align: center;
    padding: 10px 0;
    line-height: 0;
}

.sticky-ad-close {
    position: absolute;
    top: -24px;
    right: 15px;
    background: var(--border-color);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    line-height: 22px;
    padding: 0;
}

.sticky-ad-close:hover {
    background: #ff3b30;
    color: #fff;
}

/* --- SISTEMA DI RICERCA STILE STEAM --- */
.search-container {
    position: relative;
    flex: 1;
    min-width: 280px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    background: var(--bg-nested);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.5rem 2.5rem 0.5rem 0.75rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    border-radius: 2px;
    outline: none;
    height: 38px;
    box-sizing: border-box;
}

.search-input:focus {
    border-color: var(--accent-link);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.2);
}

/* Icona di ricerca inserita nell'input */
.search-icon {
    position: absolute;
    right: 10px;
    color: var(--text-muted);
    pointer-events: none;
}

/* Finestra di sdoppiamento dei suggerimenti (La tendina) */
.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #171a21; /* Colore scuro tipico dell'interfaccia Steam */
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 2px 2px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
    z-index: 1000;
    max-height: 380px;
    overflow-y: auto;
    display: none;
}

/* Singola riga del suggerimento */
.suggestion-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: var(--text-main);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.1s ease;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #1f2430;
}

/* Mini-banner dentro la tendina */
.suggestion-thumb {
    width: 70px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 1px;
    background: var(--bg-main);
    flex-shrink: 0;
}

.suggestion-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    overflow: hidden;
}

.suggestion-title {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-meta {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.suggestion-price {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-free);
    padding-left: 0.5rem;
    flex-shrink: 0;
}

.suggestion-price.paid {
    color: var(--accent-paid);
}