/* Hero Section */
.hero {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, var(--panel) 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--muted);
    margin-bottom: 2rem;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--muted);
}

.hero p {
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto 1rem;
    color: var(--text-secondary);
}

.total-codes-badge {
    display: inline-block;
    background: var(--muted);
    color: #000;
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* Console Table Section */
.console-table-section {
    margin: 3rem 0;
    padding: 0 1rem;
}

.console-table-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--muted);
}

.console-table {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--panel);
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.manufacturer-row {
    background: #1a1a1a;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--muted);
}

.console-row {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.3s ease;
}

.console-row:hover {
    background: #1a1a1a;
}

.console-row:last-child {
    border-bottom: none;
}

.console-name {
    flex: 2;
    color: #fff;
    font-weight: bold;
}

.console-name a {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.console-name a:hover {
    color: var(--muted);
    text-decoration: underline;
}

.console-codes {
    flex: 1;
    text-align: right;
    color: var(--muted);
    font-weight: bold;
}

/* Carousel Section */
.carousel-section {
    margin: 3rem 0;
    padding: 0 1rem;
}

.carousel-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--muted);
}

.carousel {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 8px;
    background: var(--panel);
    border: 1px solid var(--border);
}

.carousel-inner {
    display: flex;
    transition: transform 0.5s ease;
}

.carousel-item {
    min-width: 100%;
    padding: 2rem;
    box-sizing: border-box;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.game-image-container {
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #333;
}

.game-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.no-image-placeholder {
    color: #666;
    text-align: center;
    padding: 1rem;
}

.no-image-placeholder .icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

.no-image-placeholder p {
    font-size: 0.9rem;
    margin: 0;
}

.carousel-item h3 {
    color: var(--muted);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.carousel-item p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.carousel-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    padding: 1rem;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 10;
    transition: background 0.3s ease;
}

.carousel-control:hover {
    background: rgba(0,0,0,0.9);
}

.carousel-control.prev {
    left: 0;
    border-radius: 0 8px 8px 0;
}

.carousel-control.next {
    right: 0;
    border-radius: 8px 0 0 8px;
}

.carousel-indicators {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
    gap: 0.5rem;
}

.carousel-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #333;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.carousel-indicator.active {
    background: var(--muted);
}

/* Latest Codes Section */
.latest-codes-section {
    margin: 3rem 0;
    padding: 0 1rem;
}

.latest-codes-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--muted);
}

.console-codes-container {
    max-width: 1200px;
    margin: 0 auto;
}

.console-codes-group {
    background: var(--panel);
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    overflow: hidden;
}

.console-header {
    background: #1a1a1a;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.console-header h3 {
    color: var(--muted);
    margin: 0;
    font-size: 1.3rem;
}

.codes-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* CORREZIONE COMPLETA: Nuova struttura FlexBox */
.code-item {
    display: flex; /* Flex sul list item stesso */
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    transition: all 0.3s ease;
}

.code-item:last-child {
    border-bottom: none;
}

.code-item:hover {
    background: #1a1a1a;
}

/* Link per gioco/codice (occupa spazio principale) */
.game-code-link {
    display: flex;
    align-items: center;
    flex: 3; /* Occupa più spazio */
    color: inherit;
    text-decoration: none;
}

.game-code-link:hover {
    text-decoration: none; /* Rimuove sottolineatura su hover */
}

/* Nome gioco */
.game-name {
    color: #ffffff;
    font-weight: bold;
    flex: 1;
    min-width: 150px;
}

/* Titolo codice */
.code-title {
    color: var(--muted);
    flex: 2;
    text-align: center;
    padding: 0 15px;
}

/* Container uploader (a destra) */
.uploader {
    color: var(--text-secondary);
    flex: 1;
    text-align: right;
    min-width: 180px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
}

.uploader .uploader-label {
    color: var(--text-secondary);
}

/* Link uploader - ora funzionerà correttamente! */
.uploader .uploader-link {
    color: var(--muted);
    text-decoration: none;
    font-weight: normal;
    transition: color 0.3s ease;
}

.uploader .uploader-link:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* Barra di Ricerca */
.search-section {
    margin: 3rem 0;
    padding: 0 1rem;
}

.search-section h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--muted);
}

.search-form {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.search-input-group {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
    padding: 1rem 1.5rem;
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--muted);
}

.search-btn {
    padding: 1rem 2rem;
    white-space: nowrap;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.search-suggestions.show {
    display: block;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.suggestion-item:hover {
    background: #1a1a1a;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-name {
    color: var(--text);
    font-weight: bold;
}

.suggestion-console {
    color: var(--muted);
    font-size: 0.9rem;
}

/* Menu a tendina Console - MODIFICATO */
.console-dropdown-section {
    margin: 3rem 0;
    padding: 0 1rem;
}

.console-dropdown-section h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--muted);
}

.dropdown-wrapper {
    display: flex;
    justify-content: center;
}

.dropdown-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    width: 100%;
}

.dropdown-toggle {
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.dropdown-toggle:hover {
    border-color: var(--muted);
}

.dropdown-toggle.open {
    border-color: var(--muted);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.dropdown-toggle.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-arrow {
    transition: transform 0.3s ease;
    color: var(--muted);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--panel);
    border: 2px solid var(--border);
    border-top: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.dropdown-menu.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.manufacturer-group {
    border-bottom: 1px solid var(--border);
}

.manufacturer-group:last-child {
    border-bottom: none;
}

.manufacturer-header {
    padding: 1rem 1.5rem;
    background: #1a1a1a;
    color: var(--muted);
    font-weight: bold;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border);
}

.dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid #222;
    transition: background 0.3s ease;
}

.dropdown-item:hover {
    background: #1a1a1a;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.console-name {
    font-weight: bold;
}

.console-count {
    color: var(--muted);
    font-size: 0.9rem;
    background: rgba(155, 231, 255, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
}

/* Hero Section Enhancements */
.hero-subtitle {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto 1rem;
    color: var(--text);
    line-height: 1.6;
}

.hero-description {
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto 1rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.hero-signature {
    font-size: 1.2rem;
    font-style: italic;
    color: var(--muted);
    margin: 1.5rem auto 1.5rem;
    max-width: 800px;
    text-align: right;
}

/* Disclaimer Section */
.disclaimer-section {
    margin: 3rem 0;
    padding: 0 1rem;
}

.disclaimer-content {
    background: linear-gradient(135deg, rgba(255, 204, 0, 0.1) 0%, rgba(255, 153, 0, 0.1) 100%);
    border: 2px solid rgba(255, 204, 0, 0.3);
    border-radius: 12px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.disclaimer-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #ffcc00, #ff9900);
}

.disclaimer-content h3 {
    color: #ffcc00;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.disclaimer-content .icon-warning {
    font-size: 1.8rem;
}

.disclaimer-content p {
    color: #ffdd99;
    margin-bottom: 1rem;
    line-height: 1.6;
    font-size: 1.05rem;
}

.disclaimer-content p:last-child {
    margin-bottom: 0;
}

.disclaimer-content strong {
    color: #ffffff;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h2 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
        padding: 0 1rem;
    }
    
    .game-image-container {
        width: 150px;
        height: 150px;
    }
    
    .console-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }
    
    .console-codes {
        text-align: left;
        width: 100%;
    }
    
    .carousel-control {
        padding: 0.75rem;
        font-size: 1.2rem;
    }
    
    .carousel-item {
        padding: 1.5rem;
    }
    
    /* Versione mobile per .code-item */
    .code-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }
    
    .game-code-link {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        width: 100%;
    }
    
    .game-name, 
    .code-title {
        text-align: left;
        width: 100%;
        padding: 0;
        flex: none;
    }
    
    .code-title {
        order: 2; /* Mette il titolo codice sotto al nome gioco */
    }
    
    .uploader {
        text-align: left;
        width: 100%;
        justify-content: flex-start;
        min-width: unset;
        margin-top: 0.5rem;
        border-top: 1px solid #333;
        padding-top: 0.75rem;
    }
    
    .search-input-group {
        flex-direction: column;
    }
    
    .search-btn {
        width: 100%;
    }
    
    /* DROPDOWN MOBILE - MODIFICATO */
    .dropdown-menu {
        position: fixed !important;
        left: 1rem !important;
        right: 1rem !important;
        max-height: 60vh;
        width: calc(100% - 2rem) !important;
        margin-top: 5px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    }
    
    .dropdown-toggle {
        font-size: 0.95rem;
        padding: 0.9rem 1.2rem;
    }
}

@media (max-width: 480px) {
    .hero h2 {
        font-size: 1.8rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .disclaimer-content {
        padding: 1rem;
    }
    
    .disclaimer-content h3 {
        font-size: 1.2rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .disclaimer-content .icon-warning {
        font-size: 1.5rem;
    }
    
    .dropdown-menu {
        max-height: 50vh;
    }
}

/* Forum Section (semplificata) */
.forum-section {
    margin: 3rem 0;
    padding: 0 1rem;
}

.forum-section h2 {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--muted);
}

.forum-intro {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.forum-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    text-align: center;
    min-width: 120px;
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    display: block;
    color: var(--muted);
    font-size: 1.5rem;
    font-weight: bold;
}

/* Latest Topics */
.latest-topics {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    margin-top: 2rem;
}

.latest-topics h3 {
    color: var(--muted);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.topics-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.topic-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: all 0.3s ease;
    gap: 1rem;
}

.topic-item:hover {
    border-color: var(--muted);
    transform: translateY(-2px);
}

.topic-status {
    flex-shrink: 0;
    width: 40px;
    text-align: center;
}

.sticky-icon, .locked-icon, .normal-icon {
    font-size: 1.2rem;
}

.sticky-icon {
    color: #ffd43b;
}

.locked-icon {
    color: #ff6b6b;
}

.normal-icon {
    color: var(--text-secondary);
}

.topic-details {
    flex: 1;
    min-width: 0;
}

.topic-details h4 {
    margin: 0 0 0.5rem 0;
}

.topic-details h4 a {
    color: var(--text);
    text-decoration: none;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.topic-details h4 a:hover {
    color: var(--muted);
    text-decoration: underline;
}

.topic-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.topic-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.topic-meta .meta-item .icon {
    font-size: 0.9rem;
}

.topic-meta .meta-item a {
    color: var(--muted);
    text-decoration: none;
}

.topic-meta .meta-item a:hover {
    text-decoration: underline;
}

.topic-last-post {
    flex-shrink: 0;
    width: 60px;
    text-align: right;
}

.last-post-date {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.view-all-topics {
    text-align: center;
    margin-top: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .topic-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .topic-status {
        align-self: flex-start;
    }
    
    .topic-details {
        width: 100%;
    }
    
    .topic-last-post {
        width: 100%;
        text-align: left;
    }
    
    .forum-stats {
        gap: 1rem;
    }
    
    .stat-item {
        flex: 1;
        min-width: 100px;
    }
}

@media (max-width: 480px) {
    .topic-meta {
        gap: 0.5rem;
    }
    
    .topic-meta .meta-item {
        font-size: 0.8rem;
    }
}