:root {
    --bg-dark: #121217;
    --bg-card: #1e1e24;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --gold: #d4af37;
    --gold-hover: #f9d768;
    --accent-red: #8a1c1c;
    --font-heading: 'Cinzel', serif;
    --font-body: 'Lato', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
}

/* Typography */
h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    color: var(--gold);
    margin-bottom: 1rem;
}

a {
    color: var(--gold);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--gold-hover);
}

/* Header & Hero */
header {
    background: linear-gradient(135deg, #0f0f13 0%, #1a1a20 100%);
    padding: 4rem 2rem;
    text-align: center;
    border-bottom: 1px solid var(--gold);
}

.header-content {
    max-width: 1000px;
    margin: 0 auto;
}

.header-logo {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--gold);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
    margin-bottom: 2rem;
    object-position: 85% 35%;
}

.header-content h1 {
    font-size: 3.5rem;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-style: italic;
}

.cta-button {
    display: inline-block;
    padding: 1rem 2rem;
    background: transparent;
    color: var(--gold);
    font-family: var(--font-heading);
    font-weight: bold;
    border: 1px solid var(--gold);
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.cta-button:hover {
    background: var(--gold);
    color: var(--bg-dark);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

/* Navigation */
.sticky-nav {
    position: sticky;
    top: 0;
    background: rgba(18, 18, 23, 0.95);
    padding: 1rem 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    backdrop-filter: blur(5px);
}

.sticky-nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    gap: 2rem;
    flex-wrap: wrap;
}

.sticky-nav a {
    color: var(--text-main);
    font-weight: bold;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sticky-nav a:hover {
    color: var(--gold);
}

/* Hamburger Menu - Hidden on Desktop */
.hamburger {
    display: none;
}

/* Mobile Navigation */
@media (max-width: 768px) {

    /* Hide only the desktop nav list, keep container for hamburger */
    .sticky-nav {
        background: transparent;
        border-bottom: none;
        position: relative;
        padding: 0;
        backdrop-filter: none;
        /* Crucial: backdrop-filter creates a new containing block for fixed elements */
    }

    .sticky-nav ul {
        display: none;
    }

    /* Show hamburger as fixed overlay button */
    .hamburger {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 1.5rem;
        right: 1.5rem;
        background: rgba(18, 18, 23, 0.95);
        border: 2px solid var(--gold);
        border-radius: 8px;
        padding: 0.8rem;
        cursor: pointer;
        z-index: 1001;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(10px);
    }

    .hamburger span {
        width: 24px;
        height: 2.5px;
        background: var(--gold);
        margin: 3px 0;
        transition: 0.3s;
        border-radius: 2px;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }

    /* Mobile menu */
    #nav-menu {
        display: flex;
        position: fixed;
        right: -100%;
        flex-direction: column;
        background: rgba(18, 18, 23, 0.98);
        width: 75%;
        max-width: 280px;
        height: auto;
        border-bottom-left-radius: 12px;
        transition: 0.3s ease-in-out;
        box-shadow: -2px 2px 15px rgba(0, 0, 0, 0.6);
        padding: 0;
        top: 4.5rem;
        /* Posiziona il menu sotto l'hamburger */
        gap: 0;
        overflow-y: auto;
        z-index: 1000;
    }

    #nav-menu.active {
        right: 0;
    }

    #nav-menu li {
        padding: 0;
        border-bottom: 1px solid rgba(212, 175, 55, 0.15);
    }

    #nav-menu li:last-child {
        border-bottom: none;
    }

    #nav-menu a {
        display: block;
        padding: 1.3rem 2rem;
        font-size: 1.1rem;
        text-align: left;
        color: var(--text-main);
        font-weight: 600;
    }

    #nav-menu a:hover {
        background: rgba(212, 175, 55, 0.1);
        color: var(--gold);
    }
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

section {
    padding: 4rem 0;
    border-bottom: 1px solid #2a2a35;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    position: relative;
    color: var(--text-main);
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: var(--gold);
    margin: 1rem auto;
}

.subsection-title {
    color: var(--text-muted);
    font-size: 1.5rem;
    margin-top: 3rem;
    border-bottom: 1px solid #333;
    padding-bottom: 0.5rem;
}

/* Accordion / Details */
details {
    background: var(--bg-card);
    margin-bottom: 1.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

summary {
    padding: 1.5rem;
    cursor: pointer;
    background: rgba(30, 30, 36, 0.8);
    font-family: var(--font-heading);
    color: var(--gold);
    font-size: 1.4rem;
    font-weight: bold;
    list-style: none;
    /* Hide default triangle */
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s;
}

summary:hover {
    background: rgba(212, 175, 55, 0.1);
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: '+';
    font-size: 1.8rem;
    font-weight: 300;
    color: var(--text-muted);
}

details[open] summary::after {
    content: '-';
    color: var(--gold);
}

details[open] summary {
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.details-content {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.1);
}

/* Regolamento Content Styling */
.details-content h3 {
    color: var(--gold);
    font-family: var(--font-heading);
    font-size: 1.3rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.details-content h3:first-child {
    margin-top: 0;
}

.details-content p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.details-content ul {
    margin: 1rem 0 1.5rem 1.5rem;
    list-style-type: disc;
}

.details-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.details-content strong {
    color: var(--gold);
    font-weight: 600;
}

.details-content a {
    color: var(--gold);
    text-decoration: underline;
}

.details-content a:hover {
    color: #fff;
}

/* Content Box (Regolamento) - Modified to fit in details */
.content-box {
    /* No longer needed main styling if inside details, but keeping for utility */
}

.content-box h3 {
    margin-top: 2rem;
    color: var(--gold);
}

.content-box ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.content-box li {
    margin-bottom: 0.5rem;
}

/* Tables */
.table-container {
    margin-bottom: 0;
    /* Remove margin as it is inside details */
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    /* Contains the border radius */
    border: none;
    background: var(--bg-card);
    /* Ensure background for input area */
}

/* Search Input */
.table-search {
    width: 100%;
    padding: 1rem;
    border: none;
    border-bottom: 1px solid #333;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
}

.table-search::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.table-search:focus {
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid var(--gold);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    font-size: 0.95rem;
    table-layout: fixed;
    /* Forces table to fit container width */
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #333;
    word-wrap: break-word;
    /* Allows long words to break */
}

th {
    background: #0f0f13;
    color: var(--gold);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

/* Specific fix for first column usually being names */
td:first-child {
    font-weight: bold;
    color: var(--gold);
}

tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Resources Cards */
.resource-grid-top {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.card-full-width {
    width: 100%;
}

@media (max-width: 968px) {
    .resource-grid-top {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .resource-grid-top {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.card h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
}

.card p {
    flex-grow: 1;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.link-list {
    list-style: none;
    margin-top: 0;
}

.link-list li {
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #333;
    padding-bottom: 0.5rem;
}

.link-list li:last-child {
    border-bottom: none;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background: transparent;
    color: var(--gold);
    border: 1px solid var(--gold);
    border-radius: 4px;
    font-weight: bold;
    text-align: center;
    transition: all 0.2s;
}

.btn:hover {
    background: var(--gold);
    color: var(--bg-dark);
}

.discord-btn {
    display: inline-block;
    background: #5865F2;
    color: white;
    font-size: 1.1rem;
    padding: 1rem 2rem;
    border-radius: 4px;
    font-weight: bold;
    margin-top: 1rem;
    border: none;
}

.discord-btn:hover {
    background: #4752c4;
    color: white;
    transform: translateY(-2px);
}

/* Footer */
footer {
    text-align: center;
    padding: 3rem 1rem;
    background: #000;
    color: #444;
    font-size: 0.85rem;
    border-top: 1px solid #222;
}

/* Responsive Tables Override */
@media (max-width: 768px) {
    .header-logo {
        width: 100px;
        height: 100px;
    }

    .header-content h1 {
        font-size: 2rem;
    }

    th,
    td {
        padding: 0.8rem 0.5rem;
        font-size: 0.9rem;
    }
}
