:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --background: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #2b2d42;
    --text-secondary: #6c757d;
    --border-color: #e0e0e0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --map-tile-filter: none;
    --map-bg-color: #f8f9fa;
    --map-border-color: #dee2e6;
}

.text-muted {
    color: var(--text-secondary) !important; /* Usa il colore secondario definito nelle variabili */
}

/* Sovrascrivi il colore per il tema scuro */
[data-theme="dark"] .text-muted {
    color: #ffffff !important; /* Bianco nel tema scuro */
}

/* Se vuoi mantenere il grigio originale nel tema light */
[data-theme="light"] .text-muted {
    color: #6c757d !important; /* Grigio standard di Bootstrap */
}

/* Aggiorna anche il card-footer per ereditare correttamente i colori */
.card-footer {
    padding: 0.75rem 1rem;
    background-color: rgba(0, 0, 0, 0.03);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;,
    transition: all 0.3s ease;
}

[data-theme="dark"] .card-footer {
    background-color: rgba(255, 255, 255, 0.03);
}


[data-theme="dark"] {
    --primary-color: #4cc9f0;
    --secondary-color: #4895ef;
    --background: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --text-secondary: #a0a0a0;
    --border-color: #333333;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --map-tile-filter: brightness(0.6) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3) brightness(0.7);
    --map-bg-color: #343a40;
    --map-border-color: #495057;
}



/* Layout */
body {
    background-color: var(--background);
    color: var(--text-color);
    transition: var(--transition);
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar - Updated Styles */
.sidebar {
    width: 280px;
    background-color: var(--card-bg);
    border-right: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .sidebar {
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.2);
}

.sidebar-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-nav {
    flex-grow: 1;
    padding: 0.5rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s ease-out;
    border-left: 3px solid transparent;
    position: relative;
    cursor: pointer;
}

.nav-item:hover, 
.nav-item.active {
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
}

.nav-dropdown.active > .nav-item {
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.nav-item .mdi {
    margin-right: 0.75rem;
    font-size: 1.25rem;
    min-width: 24px;
    text-align: center;
}

.nav-dropdown {
    position: relative;
}

.dropdown-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding-left: 0.5rem;
}

.nav-dropdown.open .dropdown-items {
    max-height: 500px;
}

.sub-item {
    padding: 0.65rem 1.5rem 0.65rem 3rem !important;
    font-size: 0.9rem;
    background-color: rgba(0, 0, 0, 0.03);
    display: block;
    position: relative;
}

[data-theme="dark"] .sub-item {
    background-color: rgba(255, 255, 255, 0.03);
}

.sub-item::before {
    content: "";
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    background-color: var(--text-secondary);
    border-radius: 50%;
}

.sub-item:hover::before {
    background-color: var(--primary-color);
}

.dropdown-icon {
    margin-left: auto;
    transition: transform 0.3s ease;
    cursor: pointer;
    padding: 0.5rem;
    margin-right: -0.5rem;
}

.nav-dropdown.open .dropdown-icon {
    transform: rotate(180deg);
}

.theme-switcher {
    padding: 1rem;
    display: flex;
    justify-content: center;
    border-top: 1px solid var(--border-color);
}

.btn-theme {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.btn-theme:hover {
    transform: scale(1.05);
}

.light-icon, .dark-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .light-icon {
    opacity: 0;
    transform: translate(-50%, -100%);
}

[data-theme="dark"] .dark-icon {
    opacity: 1;
    transform: translate(-50%, -50%);
}

[data-theme="light"] .light-icon {
    opacity: 1;
    transform: translate(-50%, -50%);
}

[data-theme="light"] .dark-icon {
    opacity: 0;
    transform: translate(-50%, 0%);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    margin-left: 280px;
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.content-header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
}

.content-body {
    flex-grow: 1;
    padding: 1.5rem;
    padding-left: 10px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.sidebar-toggle:hover {
    transform: scale(1.1);
}

/* News Grid */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.news-card {
    background-color: var(--card-bg);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.2s ease-out;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.card-header {
    padding: 1rem;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.card-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    transition: all 0.2s ease-out;
    cursor: pointer;
}

.btn-icon:hover {
    background-color: var(--primary-color);
    transform: scale(1.1);
}

.card-img-top {
    width: 100%;
    height: 180px;
    object-fit: cover;
    object-position: center;
}

.card-body {
    flex-grow: 1;
    padding: 1rem;
}

.card-title {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text-color);
    line-height: 1.4;
}

.card-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.card-footer {
    padding: 0.75rem 1rem;
    background-color: rgba(0, 0, 0, 0.03);
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.publisher-logo {
    height: 20px;
    margin-right: 0.5rem;
    object-fit: contain;
}

/* Modal */
.modal-content {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
}

.modal-image {
    max-height: 400px;
    width: 100%;
    object-fit: contain;
    margin-bottom: 1rem;
    border-radius: 4px;
    background-color: var(--background);
}

.modal-content-text {
    white-space: pre-line;
    line-height: 1.6;
    padding: 0 1rem;
}

/* Data Analysis */
.data-analysis-container {
    padding: 20px;
}

.map-container {
    height: 600px;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background-color: var(--background);
}

.legend-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.legend-item {
    padding: 5px 10px;
    border-radius: 4px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}

.legend-color {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 8px;
}

/* Mappe */
.map-card {
    border-radius: 0.5rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: all 0.3s ease;
}


[data-theme="dark"] .filters-card
Specificity: (0,2,0)
 {
    background-color: var(--card-bg-dark);
    border-color: var(--border-color-dark);
}

.filters-card {
    margin-bottom: 2rem;
    background-color: var(--card-bg);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
}

[data-theme="dark"] .map-card {
    background-color: var(--card-bg-dark);
    border-color: var(--border-color-dark);
}

.map-card .card-header {
    border-bottom: 1px solid var(--border-color);
    background-color: var(--card-header-bg);
    transition: all 0.3s ease;
}

[data-theme="dark"] .map-card .card-header {
    color: white !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .map-card .card-header .mdi {
    color: white !important;
}

[data-theme="dark"] .map-card .card-header .i {
    color: white !important;
}

[data-theme="light"] .map-card .card-header {
    color: inherit;
    border-bottom-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .map-card .card-header .mdi {
    color: inherit;
}

.card-footer .publisher-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 70%;
}

.card-footer .publisher-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Stile per il nome del publisher */
.card-footer .publisher-info span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}

/* Stile per la data */
.card-footer .text-muted {
    margin-left: auto; /* Spinge la data a destra */
    padding-left: 0.5rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Tema scuro - testo bianco */
[data-theme="dark"] .card-footer .publisher-info span,
[data-theme="dark"] .card-footer .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}


.leaflet-container {
    background-color: var(--map-bg-color) !important;
}

/* Stili per i popup delle mappe */
.leaflet-popup-content-wrapper {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-radius: 8px !important;
    box-shadow: var(--shadow) !important;
}

.leaflet-popup-tip {
    background-color: var(--card-bg) !important;
}

[data-theme="dark"] .leaflet-popup-content-wrapper {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-radius: 8px !important;
}

[data-theme="dark"] .leaflet-popup-tip {
    background-color: var(--card-bg-dark) !important;
    color: var(--text-color-dark) !important;
}

/* Carousel Publisher Logos */
.publisher-carousel-container {
    overflow: hidden;
    padding: 15px 0;
    position: relative;
    width: 100%;
    max-width: 83vw;
}

.publisher-carousel {
    display: flex;
    gap: 35px;
    width: max-content;
    position: relative;
    left: 0;
    will-change: transform;
    transition: transform 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.publisher-logo-card {
    width: 120px;
    flex: 0 0 auto;
    text-align: center;
    transition: transform 0.3s ease;
}

.logo-container {
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    border: 1px solid #eee;
    transition: all 0.3s ease;
}

[data-theme="dark"] .logo-container {
    background: #2d2d2d;
    border: 1px solid #444;
}

.publisher-logo-img {
    max-width: 60px;
    max-height: 60px;
    object-fit: contain;
}

.publisher-info {
    margin-top: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.article-count {
    font-size: 12px;
    color: #666;
    display: block;
}

[data-theme="dark"] .article-count {
    color: #aaa;
}

.publisher-name {
    font-size: 14px;
    font-weight: 500;
    display: block;
    margin-top: 3px;
}

.publisher-carousel-container:hover .publisher-carousel {
    transition: transform 1s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.publisher-logo-card:hover {
    transform: translateY(-5px);
}

.publisher-logo-card:hover .logo-container {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .publisher-logo-card:hover .logo-container {
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1050;
    }
    
    .sidebar.show {
        transform: translateX(0);
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .nav-item {
        margin: 0;
        border-radius: 0;
    }
}

@media (max-width: 768px) {
    .news-grid {
        grid-template-columns: 1fr;
    }
    
    .content-body {
        padding: 1rem;
    }
    
    .content-header {
        padding: 1rem;
    }
    
    .content-header h1 {
        font-size: 1.5rem;
    }
    
    .modal-content {
        margin: 0.5rem;
    }
    
    .map-container {
        height: 400px;
    }
}

/* Stile per il carousel combinato */
.combined-carousel {
    background-color: rgba(245, 245, 245, 0.7);
    padding: 15px 0;
    border-radius: 10px;
}

[data-theme="dark"] .combined-carousel {
    background-color: rgba(45, 45, 45, 0.7);
}

.combined-carousel .publisher-logo-card {
    margin: 0 10px;
}

.combined-carousel .logo-container {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .combined-carousel .logo-container {
    box-shadow: 0 2px 5px rgba(255, 255, 255, 0.1);
}

.map-card .card-header .badge {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Animazioni */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Transizioni globali */
a, button, .nav-item, .btn-icon, .news-card {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scrollbar personalizzata */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}