/* =========================================
   1. VARIABILI & RESET
   ========================================= */
:root {
    /* Palette Colori */
    --primary: #0f172a;       /* Blu notte (Sfondo Nav/Footer) */
    --secondary: #334155;     /* Grigio scuro (Testo) */
    --accent: #c29d59;        /* Oro (Bottoni, Link attivi) */
    --accent-hover: #b08d4b;  /* Oro scuro (Hover) */
    --bg-light: #f8fafc;      /* Sfondo pagina */
    --white: #ffffff;
    --border: #e2e8f0;        /* Colore bordi leggeri */
    
    /* Effetti */
    --shadow: 0 10px 30px -10px rgba(0,0,0,0.1);
    --shadow-hover: 0 20px 40px -10px rgba(0,0,0,0.15);
    --trans: all 0.3s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--secondary);
    line-height: 1.6;
    overflow-x: hidden; /* Evita scroll orizzontale accidentale */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4 {
    font-family: 'Playfair Display', serif;
    color: var(--primary);
    font-weight: 700;
}

a { text-decoration: none; color: inherit; transition: var(--trans); }
ul { list-style: none; }

/* =========================================
   2. NAVBAR (Menu in alto)
   ========================================= */
nav {
    position: fixed;
    top: 0; width: 100%;
    height: 80px;
    background: rgba(15, 23, 42, 0.95); /* Sfondo semitrasparente */
    backdrop-filter: blur(10px);        /* Effetto vetro */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    z-index: 1000;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.nav-logo {
    color: var(--white);
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.nav-logo span { color: var(--accent); }

.nav-links {
    display: flex;
    gap: 30px;
    height: 100%;
    align-items: center;
}

.nav-links > li { position: relative; height: 100%; display: flex; align-items: center; }

.nav-links > li > a {
    color: #e2e8f0;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0 10px;
    position: relative;
}

/* Linea animata sotto i link */
.nav-links > li > a::after {
    content: '';
    position: absolute;
    width: 0; height: 2px;
    bottom: -5px; left: 0;
    background-color: var(--accent);
    transition: var(--trans);
}
.nav-links > li > a:hover::after { width: 100%; }
.nav-links > li > a:hover { color: var(--accent); }

/* MENU A TENDINA (Dropdown) */
.dropdown {
    position: absolute;
    top: 80px; left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--white);
    min-width: 260px;
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: var(--trans);
    overflow: hidden;
    border-top: 4px solid var(--accent);
    z-index: 1100;
}

.nav-links li:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown li a {
    display: block;
    padding: 12px 20px;
    color: var(--secondary);
    font-size: 0.9rem;
    border-bottom: 1px solid #f1f5f9;
}

.dropdown li a:hover {
    background: #f8fafc;
    color: var(--primary);
    padding-left: 25px; /* Effetto scorrimento a destra */
}

.hamburger { display: none; cursor: pointer; font-size: 1.5rem; color: var(--white); }

/* =========================================
   3. HEADER (Hero Section)
   ========================================= */
/* Stile per la Home Page (Header Grande) */
header {
    position: relative;
    min-height: 80vh; /* Occupa buona parte dello schermo */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: linear-gradient(135deg, var(--primary) 0%, #1e293b 100%);
    color: var(--white);
    padding: 100px 20px 50px; /* Padding top alto per non finire sotto il menu */
    margin-bottom: 30px;
}

/* Sfondo astratto decorativo */
header::before {
    content: '';
    position: absolute;
    width: 100%; height: 100%;
    top: 0; left: 0;
    background: radial-gradient(circle at 20% 50%, rgba(194, 157, 89, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

header h1 {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    margin-bottom: 1.5rem;
    color: var(--white);
    animation: fadeUp 0.8s ease forwards 0.2s;
    opacity: 0;
}

header p {
    font-size: 1.2rem;
    max-width: 700px;
    margin-bottom: 2.5rem;
    color: #cbd5e1;
    animation: fadeUp 0.8s ease forwards 0.4s;
    opacity: 0;
}

/* Stile per le Pagine Interne (Header Piccolo) */
/* Usa questa classe: <header class="header-inner"> nelle pagine utility/guide ecc. */
.header-inner {
    min-height: 40vh;
    margin-bottom: 0;
    justify-content: flex-end;
    padding-bottom: 60px;
}

.header-inner h1 { font-size: 3rem; margin-bottom: 10px; }
.header-inner p { font-size: 1.1rem; max-width: 800px; }

/* Bottoni */
.btn-hero, .btn {
    padding: 12px 30px;
    background: var(--accent);
    color: var(--white);
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 10px 20px rgba(194, 157, 89, 0.3);
    display: inline-block;
    cursor: pointer;
    border: none;
}
.btn-hero { animation: fadeUp 0.8s ease forwards 0.6s; opacity: 0; }
.btn-hero:hover, .btn:hover { background: var(--accent-hover); transform: translateY(-3px); }

/* =========================================
   4. LAYOUT GENERALE & CARDS
   ========================================= */
main {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 20px 80px;
    flex: 1; /* Fa sì che il footer vada sempre in fondo */
}

/* Griglia per le Card (Home, Index Utility, Index Guide) */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: -60px; /* Sovrapposizione all'header (solo se desiderato) */
    position: relative;
    z-index: 10;
}

/* Se non vuoi l'effetto sovrapposizione nelle pagine interne, usa questa classe */
.grid-container.no-overlap { margin-top: 0; }

.card {
    background: var(--white);
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--trans);
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(194, 157, 89, 0.3);
}

.icon-container {
    font-size: 2.5rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px; height: 80px;
    background: #f8fafc;
    border-radius: 50%;
    color: var(--primary);
}

.card h2 { margin-bottom: 15px; font-size: 1.4rem; }
.card p { font-size: 0.95rem; color: #64748b; margin-bottom: 25px; flex-grow: 1; }

.link-card {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 2px;
}
.link-card:hover { color: var(--accent); }

/* =========================================
   5. STILE PER LE NEWS (news.html)
   ========================================= */
.news-section { margin-bottom: 60px; }
.news-section h2 { margin-bottom: 30px; padding-bottom: 10px; border-bottom: 2px solid var(--border); }

.news-item {
    background: var(--white);
    padding: 25px;
    margin-bottom: 20px;
    border-radius: 10px;
    border-left: 5px solid var(--accent); /* Linea colorata a sinistra */
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: var(--trans);
}

.news-item:hover { transform: translateX(5px); box-shadow: 0 8px 15px rgba(0,0,0,0.1); }

.news-date { font-size: 0.8rem; color: #94a3b8; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.news-item h3 { margin: 10px 0; font-size: 1.3rem; }
.news-item a { color: var(--accent); font-weight: 600; }
.news-item a:hover { text-decoration: underline; }

/* =========================================
   6. STILE PER PAGINE CONTENUTO (Guide/Tribunali singoli)
   ========================================= */
.content-container {
    background: var(--white);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    max-width: 900px;
    margin: 0 auto;
}

.content-container h2 { margin-top: 30px; margin-bottom: 15px; color: var(--secondary); }
.content-container p { margin-bottom: 20px; font-size: 1.05rem; text-align: justify; }
.content-container ul { list-style: disc; padding-left: 20px; margin-bottom: 20px; }
.content-container li { margin-bottom: 10px; }

/* TABELLE (Per i Tribunali) */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: var(--white);
}
table th, table td {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
table th { background-color: #f1f5f9; color: var(--primary); font-weight: 700; }
table tr:hover { background-color: #f8fafc; }

/* =========================================
   7. FOOTER
   ========================================= */
footer {
    background: var(--primary);
    color: #94a3b8;
    text-align: center;
    padding: 60px 20px;
    border-top: 5px solid var(--accent);
    margin-top: auto;
}
footer h3 { color: var(--white); margin-bottom: 15px; }
footer a { color: #cbd5e1; transition: 0.3s; }
footer a:hover { color: var(--accent); }

/* =========================================
   8. ANIMAZIONI & RESPONSIVE
   ========================================= */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.reveal { animation: fadeUp 0.8s ease forwards; }

/* MOBILE */
@media (max-width: 992px) {
    .hamburger { display: block; }
    
    /* Menu Mobile */
    .nav-links {
        position: fixed;
        top: 80px; right: -100%;
        width: 100%; height: calc(100vh - 80px);
        background: var(--primary);
        flex-direction: column;
        align-items: flex-start;
        padding: 40px;
        transition: 0.4s ease-in-out;
        overflow-y: auto;
    }
    
    .nav-links.active { right: 0; }
    .nav-links li { width: 100%; height: auto; display: block; margin-bottom: 20px; }
    .nav-links > li > a { font-size: 1.2rem; display: block; padding: 10px 0; }
    
    /* Dropdown Mobile */
    .dropdown {
        position: static;
        opacity: 1; visibility: visible; transform: none;
        background: rgba(255,255,255,0.05);
        box-shadow: none; min-width: 100%;
        margin-top: 10px; border: none;
    }
    .dropdown li a { color: #cbd5e1; border-bottom: 1px solid rgba(255,255,255,0.05); }

    /* Adjust Header */
    header h1 { font-size: 2.5rem; }
    .header-inner { min-height: 30vh; justify-content: center; }
    
    /* Adjust Padding */
    .content-container { padding: 20px; }
}