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

body {
    font-family: 'IBM Plex Sans', sans-serif;
    background: #ffffff;
    color: #1d1d1b;
    line-height: 1.6;
    overflow-x: hidden;
    padding-top: 70px; /* Spazio per header fisso */
}


/* Header Navigation */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #0000ff;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 30px;
    max-width: 100%;
}

.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
}

.header-center {
    gap: 30px;
}

.header-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.header-logo:hover {
    opacity: 0.8;
}

.nav-link {
    color: white !important;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: #00aaff !important;
}

.nav-link:visited {
    color: white !important;
}

.nav-link:link {
    color: white !important;
}

.nav-link.active,
.nav-link.active:visited,
.nav-link.active:link {
    color: #00aaff !important;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: #00aaff;
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}


/* Loading Screen */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.8s ease;
}

.loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-circle {
    width: 60px;
    height: 60px;
    border: 2px solid #e0e0e0;
    border-top-color: #0000ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Hero Section */
.hero-section {
    min-height: 60vh;
    background: linear-gradient(135deg, #fafafa 0%, #f0f0f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 80px 20px;
}

.hero-content {
    text-align: center;
    max-width: 1000px;
    z-index: 2;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #1d1d1b;
    opacity: 0;
    transform: translateY(50px);
    animation: fadeInUp 1.2s ease forwards;
}

.hero-content p {
    font-size: 1.25rem;
    color: #454545;
    line-height: 1.8;
    opacity: 0;
    transform: translateY(50px);
    animation: fadeInUp 1.2s ease forwards;
    animation-delay: 0.3s;
    max-width: 800px;
    margin: 0 auto;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Controls Section */
.controls-section {
    background: #ffffff;
    padding: 40px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.filter-label {
    font-weight: 500;
    color: #1d1d1b;
    font-size: 0.9rem;
    font-family: 'IBM Plex Mono', monospace;
}

.custom-select {
    border: 2px solid #e0e0e0;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.custom-select:hover,
.custom-select:focus {
    border-color: #0000ff;
    box-shadow: 0 4px 12px rgba(0, 0, 255, 0.1);
}

.custom-btn {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.custom-btn:hover,
.custom-btn.active {
    background: #0000ff;
    color: white;
    border-color: #0000ff;
}

/* Legend Section */
.legend-section {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #454545;
    font-family: 'IBM Plex Mono', monospace;
}

.legend-box {
    width: 20px;
    height: 20px;
    border: 1px solid rgba(0,0,0,0.1);
}

.legend-percentage { background: #0000ff; }
.legend-info { 
    background: #0000ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
}

/* Main Container System */
.supply-chain-container-12 {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid #f0f0f0;
    margin: 20px auto;
    width: 100%;
}

/* Grid Systems */
.supply-chain-grid-10 {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    background: #ffffff;
    width: 100%;
}

.supply-chain-grid-4 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: #ffffff;
    width: 100%;
}

.supply-chain-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    background: #ffffff;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.supply-chain-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: #ffffff;
    width: 100%;
}

/* Column System */
.column-12 {
    background: white;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #f0f0f0;
    min-width: 0;
}

.column-12:last-child {
    border-right: none;
}

/* FIXED HEIGHT HEADER */
.column-header-12 {
    font-weight: 600;
    color: #1d1d1b;
    text-align: center;
    padding: 15px 8px;
    background: #f8f9fa;
    font-size: 0.8rem;
    border-bottom: 2px solid #0000ff;
    position: sticky;
    top: 0;
    z-index: 100;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Sans', sans-serif;
    line-height: 1.2;
    hyphens: auto;
    word-break: break-word;
}

.column-content-12 {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Card System */
.card-item-12 {
    background: white;
    padding: 15px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 55px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    position: relative;
    font-size: 0.8rem;
    border-bottom: 1px solid #f0f0f0;
    font-family: 'IBM Plex Sans', sans-serif;
}

.card-item-12:last-child {
    border-bottom: none;
}

.card-item-12:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 10;
}

.card-item-12.selected {
    background: #e6f0ff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 255, 0.3);
    border-color: #0000ff;
}

.card-item-12.connected {
    background: #f0f8ff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 170, 255, 0.25);
    border-color: #00aaff;
}

.card-item-12.dimmed {
    opacity: 0.3;
}

/* Text Elements */
.item-title-12 {
    font-weight: 600;
    color: #1d1d1b;
    margin-bottom: 4px;
    font-size: 0.85rem;
    line-height: 1.2;
    word-break: keep-all;
    hyphens: none;
    overflow-wrap: break-word;
}

.item-subtitle-12 {
    font-size: 0.7rem;
    color: #7f8c8d;
    line-height: 1.2;
    font-family: 'IBM Plex Mono', monospace;
    font-style: italic;
    word-break: keep-all;
    hyphens: none;
    overflow-wrap: break-word;
}

/* Tags - DENTRO I BOX */
.percentage-12 {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #0000ff;
    color: white;
    border-radius: 12px;
    width: 32px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 600;
    font-family: 'IBM Plex Mono', monospace;
    z-index: 5;
    transition: all 0.3s ease;
}

.info-icon-12 {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: #0000ff;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    font-family: 'IBM Plex Mono', monospace;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid white;
    z-index: 5;
}

.info-icon-12:hover {
    background: #00aaff;
    transform: scale(1.1);
}

.sdg-tag-12 {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: #333333;
    color: white;
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 0.55rem;
    font-weight: 500;
    font-family: 'IBM Plex Mono', monospace;
    z-index: 5;
}

.year-tag-12 {
    position: absolute;
    top: 4px;
    left: 4px;
    background: #666666;
    color: white;
    border-radius: 6px;
    padding: 2px 5px;
    font-size: 0.55rem;
    font-weight: 500;
    font-family: 'IBM Plex Mono', monospace;
    z-index: 5;
}


/* Footer */
.main-footer {
    background: #0000ff;
    color: white;
    padding: 40px 0;
    margin-top: 80px;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    padding: 0 30px;
}

.footer-left,
.footer-center,
.footer-right {
    display: flex;
    flex-direction: column;
}

.footer-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 10px;
}

.footer-left p,
.footer-center p,
.footer-right p {
    margin: 3px 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.footer-center a,
.footer-left a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.footer-center a:hover,
.footer-left a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.footer-right {
    align-items: flex-end;
    justify-content: flex-end;
}

.footer-right p {
    font-size: 0.85rem;
    opacity: 0.9;
}



.mobile-warning {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fafafa 0%, #f0f0f0 100%);
    padding: 40px 20px;
}

.mobile-warning-content {
    text-align: center;
    max-width: 500px;
}

.mobile-warning-content h2 {
    font-size: 3rem;
    font-weight: 700;
    color: #1d1d1b;
    margin-bottom: 30px;
}

.mobile-warning-content p {
    font-size: 1.1rem;
    color: #454545;
    line-height: 1.8;
}

.mobile-warning-content .btn-primary {
    background: #0000ff;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
}






/* Responsive Footer */
@media (max-width: 992px) {
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
    
    .footer-right {
        grid-column: 1 / -1;
        align-items: center;
        text-align: center;
        margin-top: 20px;
    }
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 25px;
        text-align: center;
    }
    
    .footer-left,
    .footer-center,
    .footer-right {
        align-items: center;
    }
    
    .header-nav {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .header-center {
        flex-direction: column;
        gap: 10px;
    }
}



/* Bootstrap Responsive Design */
@media (max-width: 1200px) {
    /* La seconda tabella riduce a 3 colonne */
    .supply-chain-grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* La terza tabella mantiene 3 colonne */
    .supply-chain-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .column-header-12 {
        font-size: 0.75rem;
        height: 65px;
    }
}

@media (max-width: 992px) {
    /* La seconda tabella riduce a 2 colonne */
    .supply-chain-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* La terza tabella riduce a 2 colonne */
    .supply-chain-grid-2,
    .supply-chain-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .column-header-12 {
        font-size: 0.7rem;
        height: 60px;
    }
    
    .card-item-12 {
        min-height: 50px;
        padding: 12px 8px;
    }
}

@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 2.5rem;
    }
    
    .hero-content p {
        font-size: 1.1rem;
    }
    
    /* Su mobile tutte le tabelle vanno a singola colonna */
    .supply-chain-grid-10,
    .supply-chain-grid-4,
    .supply-chain-grid-2,
    .supply-chain-grid-3 {
        grid-template-columns: 1fr;
    }
    
    .supply-chain-container-12 {
        margin: 10px;
    }
    
    .column-12 {
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .column-12:last-child {
        border-bottom: none;
    }
    
    .column-header-12 {
        font-size: 0.65rem;
        height: 55px;
        padding: 10px 6px;
    }
    
    .card-item-12 {
        min-height: 45px;
        padding: 10px 6px;
    }
    
    .item-title-12 {
        font-size: 0.75rem;
    }
    
    .item-subtitle-12 {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .supply-chain-container-12 {
        margin: 5px;
        border-radius: 8px;
    }
    
    .column-header-12 {
        font-size: 0.6rem;
        height: 50px;
        padding: 8px 4px;
    }
    
    .card-item-12 {
        min-height: 40px;
        padding: 8px 4px;
    }
    
    .item-title-12 {
        font-size: 0.7rem;
    }
    
    .item-subtitle-12 {
        font-size: 0.6rem;
    }
}

/* Modal */
.modal-content {
    border-radius: 12px;
}

.modal-header {
    border-bottom: 1px solid #f0f0f0;
    background: #f8f9fa;
}

.modal-title {
    font-weight: 600;
    color: #1d1d1b;
}

.modal-body {
    font-family: 'IBM Plex Sans', sans-serif;
    line-height: 1.8;
    padding: 25px;
}

.modal-body strong {
    color: #0000ff;
    font-weight: 600;
}

/* Modal con Immagine */
.modal-xl {
    max-width: 90vw;
    max-height: 90vh;
    margin: 1.75rem auto;
    width: fit-content;
}

.modal-dialog {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}

.modal-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    width: fit-content;
}

.modal-body {
    overflow-y: auto;
    max-height: calc(90vh - 100px);
    padding: 0;
}

.modal-image-container {
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-image-container img {
    max-width: 90vw;
    max-height: calc(90vh - 120px);
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

.modal-placeholder {
    padding: 100px 40px;
    text-align: center;
    background: #f8f9fa;
    color: #7f8c8d;
    font-size: 1.1rem;
    font-style: italic;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
