@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;700&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
    /* --- PALETTE ULTRA PREMIUM --- */
    --bg-deep: #050505;
    --bg-card: rgba(30, 30, 30, 0.6); /* Più trasparente */
    --bg-card-border: rgba(255, 255, 255, 0.08);
    
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    
    --accent-gold: #d4af37; /* Oro più classico/ricco */
    --accent-gold-dim: rgba(212, 175, 55, 0.15);
    
    --glass-blur: blur(12px);
    --shadow-soft: 0 10px 40px -10px rgba(0,0,0,0.7);
    
    --font-serif: 'Playfair Display', serif;
    --font-sans: 'DM Sans', sans-serif;
    
    --radius-lg: 16px;
    --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    /* Ottimizzazione Scroll */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-deep);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(212, 175, 55, 0.03) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(255, 255, 255, 0.02) 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
}

a, button { transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
ul { list-style: none; }

/* --- HEADER --- */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(5, 5, 5, 0.85);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--bg-card-border);
    padding: 15px 0;
    will-change: transform; /* Performance hint */
}

.header-content {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
}

.header-logo { height: 45px; width: auto; }
.header-title {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    letter-spacing: 1px;
    color: white;
    font-weight: 600;
}

/* --- NAV CONTROLS --- */
.breadcrumb {
    max-width: 1300px;
    margin: 20px auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
}

.btn-icon {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--bg-card-border);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon:hover {
    background: var(--accent-gold);
    color: #000;
    border-color: var(--accent-gold);
}

/* --- CATEGORIES GRID (TILES) --- */
.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px 80px;
}

.section-header {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    color: var(--accent-gold);
    margin: 40px 0 20px;
    font-style: italic;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    /* Improve grid performance */
    contain: content; 
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    height: 200px; /* Fixed height for better image display */
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    /* No padding here, content wrapper handles it */
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    will-change: transform; /* Optimization */
    transform: translateZ(0); /* Force GPU layer */
}

.category-card:hover {
    border-color: var(--accent-gold);
    transform: translateY(-5px);
    box-shadow: 0 15px 30px -10px rgba(212, 175, 55, 0.2);
}

/* Background Layer with Image */
.category-bg-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    /* Background image handled by img tag now */
    transition: transform 0.6s ease;
    z-index: 1;
    background-color: rgba(30,30,30,0.8);
    will-change: transform;
}

.category-bg-img {
    width: 100%; height: 100%;
    object-fit: cover;
    /* Img inherits transform from parent layer or we apply to img if needed, 
       but applying to layer scales the container. 
       Wait, if layer scales, img scales. Correct. */
}

.category-card:hover .category-bg-layer {
    transform: scale(1.15);
}

/* Overlay Layer for Contrast */
.category-overlay-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.85));
    z-index: 2;
    transition: background 0.3s ease;
}

.category-card:hover .category-overlay-layer {
    background: linear-gradient(to bottom, rgba(0,0,0,0.4), rgba(0,0,0,0.95));
}

/* Content Wrapper */
.category-content-wrapper {
    position: relative;
    z-index: 3;
    height: 100%;
    width: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    justify-content: center;
}

.category-icon-wrapper {
    font-size: 3rem;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.5));
    transition: transform 0.3s;
    will-change: transform;
}

.category-card:hover .category-icon-wrapper {
    transform: scale(1.2) rotate(5deg);
}

.category-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    line-height: 1.3;
    margin-bottom: 5px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.category-count {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.8);
    font-weight: 500;
}

.category-arrow {
    margin-top: auto;
    padding-top: 10px;
    opacity: 0;
    transform: translateY(10px);
    transition: 0.3s;
    color: var(--accent-gold);
    font-weight: bold;
    font-size: 1.2rem;
}

.category-card:hover .category-arrow {
    opacity: 1;
    transform: translateY(0);
}

/* --- PRODUCTS GRID --- */
.beer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    contain: content;
}

/* COMPACT VIEW (LIST) */
.beer-grid.compact-view {
    grid-template-columns: 1fr;
    gap: 15px;
}

.section-title {
    font-family: var(--font-serif);
    font-size: 3rem;
    text-align: center;
    margin: 30px 0 50px;
    background: linear-gradient(to right, #fff, #ccc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- PREMIUM CARD DESIGN --- */
.beer-card {
    background: rgba(20, 20, 20, 0.7);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: 0.4s ease;
    position: relative;
    will-change: transform;
    transform: translateZ(0);
}

.beer-card:hover {
    background: rgba(30, 30, 30, 0.9);
    border-color: rgba(212, 175, 55, 0.3);
    transform: translateY(-6px);
    box-shadow: var(--shadow-soft);
}

/* Card Header & Image */
.card-image-container {
    height: 220px;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.card-image-container::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; width: 100%; height: 60%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}

.beer-image {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.6s;
    will-change: transform;
}

.beer-card:hover .beer-image { transform: scale(1.08); }

/* Card Content */
.beer-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

/* Logo Styling - Left Side */
.beer-logo {
    width: 45px; height: 45px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%; /* Circle */
    padding: 2px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.title-group {
    display: flex;
    flex-direction: column;
}

.tiny-category {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-gold);
    margin-bottom: 2px;
}

.beer-name {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    line-height: 1.2;
    color: #fff;
    font-weight: 600;
}

.price-tag {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    margin-left: 10px;
}

.beer-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Tags & Footer */
.card-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 12px;
}

.card-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.badge {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.08);
    color: #ccc;
    display: flex;
    align-items: center;
    gap: 4px;
}

.badge-novità {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

/* Stile specifico per tag "Più venduto" */
.badge-più-venduto {
    background: rgba(255, 69, 0, 0.2); /* Arancione/Rosso */
    color: #ff4500;
    border: 1px solid rgba(255, 69, 0, 0.3);
    font-weight: 700;
}

.availability-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #333;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    margin-left: auto; /* Spinge il punto a destra in un contenitore flex */
}

.availability-dot.available { background: #10b981; box-shadow: 0 0 8px #10b981; }
.availability-dot.unavailable { background: #ef4444; }

/* --- NO IMAGE VARIANT --- */
.beer-card.no-image-card {
    align-self: start; /* Prevent stretching to fill grid row height */
    background: linear-gradient(145deg, rgba(30,30,30,0.8), rgba(20,20,20,0.9));
}

.beer-card.no-image-card .beer-content {
    padding: 25px;
}

/* --- COMPACT VIEW STYLES --- */
.beer-grid.compact-view .beer-card {
    flex-direction: row;
    align-items: center;
    min-height: auto;
}

.beer-grid.compact-view .card-image-container {
    width: 120px;
    height: 100%;
    min-height: 120px;
    flex-shrink: 0;
}

.beer-grid.compact-view .beer-content {
    padding: 15px 20px;
}

.beer-grid.compact-view .beer-description {
    -webkit-line-clamp: 1;
    line-clamp: 1;
    margin-bottom: 10px;
}

/* --- MODAL --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    /* Use dynamic viewport height for mobile */
    height: 100dvh;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(15px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.active { display: flex; animation: fadeIn 0.3s ease; }

.modal-content {
    background: #121212;
    border: 1px solid var(--bg-card-border);
    border-radius: 20px;
    width: 100%; max-width: 550px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 50px 100px -20px rgba(0,0,0,0.9);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--accent-gold);
    color: black;
    transform: rotate(90deg);
}

.modal-hero-wrapper {
    height: 250px;
    width: 100%;
    flex-shrink: 0;
}

.modal-hero-img {
    width: 100%; height: 100%; object-fit: cover;
}

.modal-content-scroll {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    padding-right: 30px; /* Spazio per evitare sovrapposizione con la X */
}

.modal-title {
    font-family: var(--font-serif);
    font-size: 2rem;
    line-height: 1.1;
    color: white;
    flex: 1;
}

.modal-price-big {
    font-family: var(--font-sans);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-gold);
}

.modal-logo-small {
    width: 50px; margin-bottom: 15px; border-radius: 50%;
}

.modal-desc-text {
    font-size: 1rem;
    line-height: 1.7;
    color: #d4d4d8;
    margin-bottom: 20px;
}

.modal-tags-list {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px;
}

.modal-tag {
    background: rgba(255,255,255,0.1);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    display: flex; align-items: center; gap: 6px;
}

.modal-allergens-section {
    background: rgba(20, 20, 20, 0.5);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
}

.modal-allergens-section h4 {
    font-size: 0.8rem; text-transform: uppercase; color: #666; margin-bottom: 10px; letter-spacing: 1px;
}

.allergens-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}

.allergen-item {
    display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: #ccc;
}

.allergen-icon { font-size: 1.2rem; }

.modal-close-btn-wrapper {
    padding: 15px 25px;
    background: #121212;
    border-top: 1px solid var(--bg-card-border);
    flex-shrink: 0;
    /* Added for webnovis link */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.modal-close-action {
    width: 100%;
    padding: 12px;
    background: var(--accent-gold);
    color: #000;
    border: none;
    font-weight: 700;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}

.modal-close-action:hover { background: white; }

/* --- WEB NOVIS LINK --- */
.webnovis-link {
    display: inline-block;
    margin-top: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 2px;
    text-decoration: none;
    border: 1px solid rgba(212, 175, 55, 0.3);
    padding: 10px 20px;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.3);
}

.webnovis-link:hover {
    color: #000000 !important;
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
    transform: translateY(-2px);
    font-weight: 700;
}

/* Center alignment wrapper for injected links */
.webnovis-center-wrapper {
    width: 100%;
    text-align: center;
    padding: 20px 0;
    clear: both;
}

/* --- ANIMATIONS --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- FOOTER SITE (MENU PAGE) --- */
.site-footer {
    position: relative;
    margin-top: 50px;
    padding: 2rem;
    text-align: center;
    color: rgba(255,255,255,0.5);
    font-size: 0.9rem;
    background: transparent;
}

.site-footer a.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.site-footer a.footer-link:hover {
    color: var(--accent-gold);
    border-color: var(--accent-gold);
}

/* --- MOBILE --- */
@media (max-width: 768px) {
    .categories-grid { grid-template-columns: repeat(2, 1fr); }
    .section-title { font-size: 2rem; }
    .beer-grid { grid-template-columns: 1fr; }
    
    .beer-card { margin-bottom: 15px; }
    .beer-card.no-image-card { padding: 0; }
    
    .card-image-container { height: 180px; }
    
    /* Fix Modal mobile style */
    .modal-content { 
        max-height: 85dvh; /* Limit height to avoid touching edges */
        height: auto; 
        border-radius: 20px; /* Keep rounded corners */
        width: 95%; /* Slight spacing from sides */
    }

    /* Center Header on Mobile */
    .header-content { justify-content: center; }
}
