:root {
    --colore-primario: #3fa9f5;
    --colore-secondario: #1195f4;
    --colore-testo: #333;
    --colore-sfondo: #f4f7f9;
    --colore-card: #ffffff;
    --colore-coupon: #28a745;
    --ombra-card: 0 8px 25px -10px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--colore-sfondo);
    color: var(--colore-testo);
    margin: 0;
    padding: 15px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

h1 {
    margin-bottom: 25px;
}

/* FILTRI */
.filtri {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 35px;
}

.filtro-btn {
    background-color: var(--colore-card);
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filtro-btn:hover {
    background-color: #e9ecef;
}

.filtro-btn.active {
    background-color: var(--colore-secondario);
    color: white;
    border-color: var(--colore-secondario);
}

/* GRID OFFERTE */
.offerte-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* CARD OFFERTA */
.offerta-card {
    background-color: var(--colore-card);
    border-radius: 12px;
    box-shadow: var(--ombra-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-align: left;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.offerta-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.2);
}

.store-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 6px;
    text-transform: uppercase;
    z-index: 1;
}

.offerta-immagine {
    width: 100%;
    height: 180px;
    object-fit: scale-down;
    padding: 10px;
    background-color: #fff;
}

.offerta-corpo {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.offerta-titolo {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 10px;
    line-height: 1.4;
}

.dettagli-extra-badge {
    font-size: 12px;
    font-weight: 700;
    color: var(--colore-secondario);
    background-color: #e7f5ff;
    border-radius: 10px;
    padding: 5px 10px;
    margin-top: auto;
    margin-bottom: 15px;
    text-align: center;
    cursor: pointer;
}

.prezzi {
    font-size: 26px;
    font-weight: 700;
    color: var(--colore-primario);
    margin-bottom: 15px;
}

.prezzo-vecchio {
    font-size: 15px;
    color: #999;
    text-decoration: line-through;
    margin-left: 8px;
    font-weight: 400;
}

.offerta-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.btn-acquista {
    background-color: var(--colore-primario);
    color: white;
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 700;
    transition: background-color 0.2s ease;
    text-align: center;
    flex-grow: 1;
}

.btn-acquista:hover {
    background-color: var(--colore-secondario);
}

.offerta-data {
    font-size: 11px;
    color: #aaa;
    white-space: nowrap;
}

/* LOADER */
.loader {
    display: none;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--colore-primario);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* MODAL */
.modal-container {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff;
    margin: auto;
    padding: 30px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    position: relative;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-close {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal-close:hover {
    color: #000;
}

.modal-testo p {
    margin-bottom: 10px;
}

.codice-sconto {
    background-color: #f8f9fa;
    border-radius: 6px;
    padding: 8px;
    font-family: monospace;
    font-size: 16px;
    font-weight: 700;
    border: 1px solid #ddd;
    width: 100%;
    text-align: center;
    cursor: pointer;
    box-sizing: border-box;
}

.codice-sconto:hover {
    background-color: #e9ecef;
}

/* MEDIA QUERY */
@media (max-width: 480px) {
    body { padding: 10px; }
    .offerte-grid { grid-template-columns: 1fr; gap: 15px; }
    h1 { font-size: 24px; }
}

/* CARICA ALTRO */
.carica-altro-container {
    padding: 40px 0;
    text-align: center;
}

.carica-altro-btn {
    display: none; /* JS gestisce la visibilità */
    position: relative;
    background-color: var(--colore-secondario);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.carica-altro-btn::before {
  content: url("data:image/svg+xml,%3Csvg width='16' height='16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 12 L4 8h2V4h4v4h2z' fill='%23fff'/%3E%3C/svg%3E");
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: middle;
}

.carica-altro-btn:hover {
    background-color: var(--colore-primario);
    transform: scale(1.05);
}

.carica-altro-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: scale(1);
}
