/* Color Variables */
:root {
    /* Light Mode Colors */
    --background-color-light: #f4faff;
    --header-background-light: #ffffffa9;
    --primary-color-light: #0d47a1;
    --text-color-light: #0d47a1;
    --card-background-light: #fff;
    --card-shadow-light: rgba(0, 0, 0, 0.1);
    --border-color-light: #90caf9;
    --footer-background-light: #d0ebff;
    --footer-text-color-light: #0d47a1;
    --sub-navbar-background-light: #fff;
    --sub-navbar-shadow-light: rgba(0, 0, 0, 0.1);
    --sub-navbar-hover-background-light: rgba(144, 202, 249, 0.2);
    --sub-navbar-hover-background-light: #dde2e8;
    --hero-background-image: url('../images/cagliari_in_2_giorni.jpg');

    /* Dark Mode Colors */
    --background-color-dark: #121212;
    --header-background-dark: #1e1e1e;
    --primary-color-dark: #8f1c08;
    --text-color-dark: #90caf9;
    --card-background-dark: #1e1e1e;
    --card-shadow-dark: rgba(255, 255, 255, 0.05);
    --border-color-dark: #330b08;
    --footer-background-dark: #1e1e1e;
    --footer-text-color-dark: #90caf9;
    --sub-navbar-background-dark: #2c2c2c;
    --sub-navbar-shadow-dark: rgba(255, 255, 255, 0.1);
    --sub-navbar-hover-background-dark: #424242;
    --hero-background-image-dark: url('../images/cagliari_poetto_banner.jpeg');
}

/* Base styles using variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background-color-light);
    color: var(--text-color-light);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background 0.5s ease, color 0.5s ease;
}

/* Header */
header {
    background: var(--header-background-light);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color-light);
    position: relative;
    z-index: 1001;
}

.right-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    font-size: 1.6em;
    color: var(--primary-color-light);
    text-decoration: none;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow:
        1px 1px 0px var(--primary-color-light),
        2px 2px 0px rgba(0, 0, 0, 0.2),
        3px 3px 5px rgba(0, 0, 0, 0.3);
    transition: text-shadow 0.3s ease, color 0.3s ease;
}

.logo .logo-icon {
    height: 35px;
    width: auto;
    transition: filter 0.3s ease;
}

.logo-tour-word {
    color: #dc3545;
    font-size: 0.9em;
    font-weight: 800;
    text-shadow: 1px 1px 0px rgba(220, 53, 69, 0.4);
}

/* Hamburger menu */
.hamburger {
    display: none;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--text-color-light);
}

/* Stili per la navigazione principale */
.sub-navbar {
    background: var(--card-background-light);
    border-bottom: 2px solid var(--border-color-light);
    padding: 10px 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.sub-navbar ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 0;
    padding: 0;
}

/* SOTTOLINEATURA DINAMICA MIGLIORATA */
.sub-navbar a {
    color: var(--text-color-light);
    text-decoration: none;
    font-weight: 500;
    font-size: 1em;
    padding: 10px 0;
    position: relative;
    transition: color 0.3s ease;
    overflow: hidden;
}

.sub-navbar a:hover {
    color: var(--primary-color-light);
    background-color: var(--sub-navbar-hover-background-light);
}

/* Sottolineatura animata da sinistra a destra */
.sub-navbar a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--primary-color-light);
    transition: width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 1px;
}

.sub-navbar a:hover::after {
    width: 100%;
}

/* Variante alternativa: sottolineatura che si espande dal centro */
.sub-navbar a.center-expand::after {
    left: 50%;
    transform: translateX(-50%);
    transition: width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Versione con effetto glow */
.sub-navbar a.glow-effect::after {
    background: linear-gradient(90deg, 
        transparent, 
        var(--primary-color-light), 
        transparent
    );
    box-shadow: 0 0 8px var(--primary-color-light);
}

/* Versione con doppia linea */
.sub-navbar a.double-line::before,
.sub-navbar a.double-line::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    left: 0;
    background-color: var(--primary-color-light);
    transition: width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.sub-navbar a.double-line::before {
    bottom: 3px;
}

.sub-navbar a.double-line::after {
    bottom: 0;
    transition-delay: 0.1s;
}

.sub-navbar a.double-line:hover::before,
.sub-navbar a.double-line:hover::after {
    width: 100%;
}

/* DROPDOWN STYLES - VERSIONE CORRETTA */
.dropdown-menu {
    position: relative;
}

/* IMPORTANTE: Dropdown inizia SEMPRE nascosto */
.dropdown-content {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--card-background-light);
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    padding: 10px 0;
    border-radius: 8px;
    border: 1px solid var(--border-color-light);
}

/* SOLO quando ha classe active si mostra */
.dropdown-menu.active .dropdown-content {
    display: block !important;
}

.dropdown-content li {
    list-style: none;
    margin: 0;
}

.dropdown-content a {
    color: var(--text-color-light);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: background-color 0.3s ease;
    border-bottom: none;
}

.dropdown-content a:hover {
    background-color: var(--background-color-light);
    color: var(--primary-color-light);
}

/* Nascondi sottolineatura nei dropdown */
.dropdown-content a::after {
    display: none !important;
}

.dropdown-menu > a i {
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.dropdown-menu.active > a i {
    transform: rotate(180deg);
}

/* Hero Section */
.hero-section {
    position: relative;
    width: 100%;
    height: calc(100vh - 120px);
    background: var(--hero-background-image) no-repeat center center/cover;
    color: #fff;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 20px;
    transition: background-image 0.5s ease;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: 20px;
    max-width: 800px;
}

.hero-title {
    font-size: 3.5em;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.hero-subtitle {
    font-size: 1.8em;
    margin-bottom: 30px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}

.scroll-down-button {
    background-color: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: 2px solid #fff;
    padding: 12px 25px;
    border-radius: 50px;
    font-size: 1.2em;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.scroll-down-button:hover {
    background-color: rgba(0, 0, 0, 0.6);
    border-color: #90caf9;
    transform: translateY(-3px);
}

.scroll-down-button i {
    animation: bounce 1.5s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.content-section {
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

h2 {
    font-size: 2em;
    margin-bottom: 20px;
    color: var(--primary-color-light);
    text-align: center;
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.itinerario-card {
    background-color: var(--card-background-light);
    border-radius: 8px;
    box-shadow: 0 4px 8px var(--card-shadow-light);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.itinerario-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px var(--card-shadow-light);
}

.itinerario-card a {
    text-decoration: none;
    color: var(--text-color-light);
    display: block;
}

.itinerario-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.card-text {
    padding: 15px;
}

.card-text h3 {
    font-size: 1.2em;
    margin-bottom: 5px;
}

.card-text p {
    font-size: 0.9em;
    color: var(--text-color-light);
    opacity: 0.7;
}

/* Footer */
footer {
    text-align: center;
    padding: 15px;
    background: var(--footer-background-light);
    border-top: 2px solid var(--border-color-light);
    color: var(--footer-text-color-light);
    margin-top: 20px;
}

.footer-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    align-items: flex-start;
    text-align: left;
    padding-bottom: 20px;
}

.footer-section {
    flex: 1;
    min-width: 200px;
    margin: 10px;
}

.footer-section h3 {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.footer-section p,
.footer-section ul {
    font-size: 0.9em;
    color: var(--text-color-light);
    opacity: 0.7;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li a {
    color: var(--footer-text-color-light);
    text-decoration: none;
}

.footer-section ul li a:hover {
    text-decoration: underline;
}

.social-icons {
    margin-top: 10px;
}

.social-icons a {
    color: var(--footer-text-color-light);
    font-size: 1.5em;
    margin-right: 15px;
    transition: color 0.3s ease;
}

.social-icons a:hover {
    color: var(--primary-color-light);
}

.footer-bottom {
    border-top: 1px solid var(--border-color-light);
    padding-top: 15px;
    font-size: 0.8em;
    color: var(--text-color-light);
    opacity: 0.7;
}

footer a {
    color: var(--footer-text-color-light);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Regole per lo switch del tema */
.theme-switch {
    cursor: pointer;
    font-size: 1.5em;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color-light);
}

.theme-switch i {
    transition: opacity 0.3s ease, color 0.3s ease;
    opacity: 0.5;
}

.theme-switch i.active-icon {
    opacity: 1;
}

/* LANGUAGE SWITCHER - VERSIONE CORRETTA */
.lang-switcher {
    position: relative;
    display: inline-block;
}

.lang-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.lang-button:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.lang-button img {
    width: 24px;
    height: 18px;
    border: 1px solid #ccc;
    border-radius: 3px;
    object-fit: cover;
}

.lang-dropdown-content {
    display: none !important;
    position: absolute;
    background-color: var(--card-background-light);
    min-width: 120px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    right: 0;
    border-radius: 4px;
    margin-top: 5px;
    border: 1px solid var(--border-color-light);
}

.lang-switcher.active .lang-dropdown-content {
    display: block !important;
}

.lang-dropdown-content a {
    color: var(--text-color-light);
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.3s ease;
}

.lang-dropdown-content a:hover {
    background-color: var(--sub-navbar-hover-background-light);
    color: #fff;
}

.lang-dropdown-content a img {
    width: 20px;
    height: 15px;
    border-radius: 3px;
    object-fit: cover;
}

/* Dark Mode Styles */
body.dark-mode {
    background: var(--background-color-dark);
    color: var(--text-color-dark);
}

body.dark-mode header {
    background: var(--header-background-dark);
    border-bottom: 2px solid var(--border-color-dark);
}

body.dark-mode .logo,
body.dark-mode .hamburger {
    color: #dc3545;
}

body.dark-mode .sub-navbar {
    background-color: var(--sub-navbar-background-dark);
    box-shadow: 0 2px 5px var(--sub-navbar-shadow-dark);
}

body.dark-mode .sub-navbar a {
    color: var(--text-color-dark);
}

body.dark-mode .sub-navbar a:hover {
    background-color: var(--sub-navbar-hover-background-dark);
    color: #90caf9;
}

/* Dark mode sottolineatura */
body.dark-mode .sub-navbar a::after {
    background-color: #ee241d;
}

body.dark-mode .sub-navbar a.glow-effect::after {
    background: linear-gradient(90deg, 
        transparent, 
        var(--primary-color-dark), 
        transparent
    );
    box-shadow: 0 0 8px var(--primary-color-dark);
}

body.dark-mode .sub-navbar a.double-line::before,
body.dark-mode .sub-navbar a.double-line::after {
    background-color: var(--primary-color-dark);
}

body.dark-mode .dropdown-content {
    background-color: var(--card-background-dark);
    border: 1px solid var(--border-color-dark);
}

body.dark-mode .dropdown-content a {
    color: var(--text-color-dark);
}

body.dark-mode .dropdown-content a:hover {
    background-color: var(--background-color-dark);
    color: var(--primary-color-dark);
}

body.dark-mode .itinerario-card {
    background-color: var(--card-background-dark);
    box-shadow: 0 4px 8px var(--card-shadow-dark);
}

body.dark-mode .itinerario-card:hover {
    box-shadow: 0 6px 12px var(--card-shadow-dark);
}

body.dark-mode .itinerario-card a {
    color: var(--text-color-dark);
}

body.dark-mode .card-text p {
    color: var(--text-color-dark);
    opacity: 0.7;
}

body.dark-mode h2 {
    color: var(--primary-color-dark);
}

body.dark-mode footer {
    background: var(--footer-background-dark);
    border-top: 2px solid var(--border-color-dark);
    color: var(--footer-text-color-dark);
}

body.dark-mode .footer-section p,
body.dark-mode .footer-section ul {
    color: var(--text-color-dark);
    opacity: 0.7;
}

body.dark-mode .footer-section ul li a {
    color: var(--footer-text-color-dark);
}

body.dark-mode .social-icons a {
    color: var(--footer-text-color-dark);
}

body.dark-mode .theme-switch i {
    color: #90caf9;
}

body.dark-mode .lang-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .lang-dropdown-content {
    background-color: var(--card-background-dark);
    border: 1px solid var(--border-color-dark);
}

body.dark-mode .lang-dropdown-content a {
    color: var(--text-color-dark);
}

body.dark-mode .lang-dropdown-content a:hover {
    background-color: var(--sub-navbar-hover-background-dark);
    color: var(--text-color-dark);
}

body.dark-mode .hero-section {
    background-image: var(--hero-background-image-dark);
}

body.dark-mode .logo {
    color: #dc3545;
    text-shadow:
        1px 1px 0px var(--primary-color-dark),
        2px 2px 0px rgba(255, 255, 255, 0.1),
        3px 3px 5px rgba(0, 0, 0, 0.4);
}

body.dark-mode .logo-tour-word {
    color: #90caf9;
    text-shadow: 1px 1px 0px rgba(253, 126, 20, 0.4);
}

/* Responsive */
/* Per schermi grandi (desktop) */
.sub-navbar {
    display: block;
    position: static;
    width: auto;
    height: auto;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.sub-navbar ul {
    flex-direction: row;
    justify-content: flex-start;
    padding: 0;
    margin: 0 20px;
    flex-wrap: wrap;
}

.sub-navbar li {
    padding: 0;
}

.sub-navbar a {
    padding: 15px 20px;
    border-bottom: none;
}

.dropdown-content {
    left: 50%;
    transform: translateX(-50%);
}

.itinerario-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Media Queries per il mobile */
@media(max-width: 768px) {
    .hamburger {
        display: block;
    }

    .sub-navbar {
        position: fixed;
        top: 65px; 
        right: 0;
        width: 280px;
        height: calc(100vh - 65px);
        background-color: var(--sub-navbar-background-light);
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
        transform: translateX(100%);
        transition: transform 0.4s ease-in-out;
        z-index: 1002;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        overflow-y: auto;
        padding: 0;
    }

    .sub-navbar.show {
        transform: translateX(0);
    }

    .sub-navbar ul {
        flex-direction: column;
        padding: 0;
        margin: 0;
        width: 100%;
        gap: 0;
    }

    .sub-navbar li {
        width: 100%;
        text-align: left;
        border-bottom: 1px solid rgba(0,0,0,0.1);
        margin: 0;
    }

    .sub-navbar li:last-child {
        border-bottom: none;
    }

    .sub-navbar > ul > li > a {
        padding: 15px 20px;
        display: block;
        width: 100%;
        border-bottom: none;
    }

    /* Mobile sottolineatura adattata */
    .sub-navbar a::after {
        bottom: 0;
        left: 20px;
        right: 20px;
        width: calc(100% - 40px);
        transform: scaleX(0);
        transform-origin: left;
        transition: transform 0.3s ease;
    }
    
    .sub-navbar a:hover::after {
        transform: scaleX(1);
        width: calc(100% - 40px);
    }

    .sub-navbar a:hover {
        background-color: var(--background-color-light);
        color: var(--primary-color-light);
    }

    /* MOBILE DROPDOWN - VERSIONE CORRETTA */
    .dropdown-menu {
        width: 100%;
    }

    .dropdown-content {
        display: none !important;
        position: static;
        box-shadow: none;
        padding: 0;
        margin: 0;
        border-radius: 0;
        transform: none;
        left: auto;
        background-color: rgba(0,0,0,0.05);
        border: none;
        border-top: 1px solid rgba(0,0,0,0.1);
    }

    .dropdown-menu.active .dropdown-content {
        display: block !important;
    }

    .dropdown-content li {
        border-bottom: none;
        margin: 0;
    }

    .dropdown-content a {
        padding: 12px 30px;
        font-size: 0.9em;
        color: var(--text-color-light);
        opacity: 0.8;
    }

    .dropdown-content a:hover {
        background-color: rgba(0,0,0,0.1);
        color: var(--primary-color-light);
        opacity: 1;
    }

    /* Dark mode mobile adjustments */
    body.dark-mode .sub-navbar {
        background-color: var(--sub-navbar-background-dark);
    }

    body.dark-mode .sub-navbar a:hover {
        background-color: var(--background-color-dark);
        color: var(--primary-color-dark);
    }

    body.dark-mode .dropdown-content {
        background-color: rgba(255,255,255,0.05);
        border-top: 1px solid rgba(255,255,255,0.1);
    }

    body.dark-mode .dropdown-content a {
        color: var(--text-color-dark);
    }

    body.dark-mode .dropdown-content a:hover {
        background-color: rgba(255,255,255,0.1);
        color: var(--primary-color-dark);
    }

    

    .footer-section {
        margin-bottom: 10px;
    }

    .footer-section h3 {
        margin-top: 20px;
    }

    .hero-title {
        font-size: 2.5em;
    }

    .hero-subtitle {
        font-size: 1.2em;
    }

    .hero-section {
        height: calc(100vh - 120px);
    }
}

/* Fix dropdown Escursioni sopra al pannello mappa */
.sub-navbar .dropdown-content {
    z-index: 2000 !important;
}

/* Nascondi hamburger di default */
.hamburger {
    display: none !important;
}

/* Mostra hamburger solo su mobile */
@media(max-width: 768px) {
    .hamburger {
        display: block !important;
    }
}
@media (max-width: 768px) {
  header {
    padding: 10px 15px;
  }

  .logo {
    font-size: 1.2em;        /* riduce dimensione testo logo */
    gap: 5px;
  }

  .logo .logo-icon {
    height: 25px;             /* riduce dimensione icona logo */
  }

  .right-container {
    gap: 8px;                 /* riduce lo spazio tra gli elementi a destra */
  }
  .footer-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding-bottom: 5px;
    }
}