/* Header Styles - Riutilizzabile su tutte le pagine */

.header-logo {
    height: 5vh; /* 5% dell'altezza della viewport */
    position: absolute;
    left: 0;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    margin: 1vh;
    z-index: 1000;
    background-color: transparent;
    backdrop-filter: blur(0px);
    transition: all 0.3s ease;
    border-radius: 4vh;
    padding: 1vh;
    border: 1px solid transparent; /* Bordo trasparente inizialmente */
}

header.scrolled {
    background: 
        linear-gradient(135deg, rgba(19, 19, 19, 0.15) 0%, rgba(25, 25, 25, 0.2) 100%),
        linear-gradient(90deg, rgba(255,255,255,0.005) 0%, transparent 50%, rgba(255,255,255,0.005) 100%);
    backdrop-filter: blur(12px) saturate(1.1);
    -webkit-backdrop-filter: blur(12px) saturate(1.1);
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.15),
        inset 0 -1px 0 rgba(255, 255, 255, 0.03),
        0 1px 3px rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

nav {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    height: 5vh;
}

/* Menu hamburger - nascosto di default */
.hamburger-menu {
    display: none;
    flex-direction: column;
    cursor: pointer;
    position: absolute;
    right: 2vh;
    z-index: 1001;
    padding: 0.5vh;
    background: none;
    border: none;
}

.hamburger-menu span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #e0e0e0;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

/* Animazione hamburger quando è attivo */
.hamburger-menu.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

nav ul {
    display: flex;
    justify-content: space-around;
    list-style-type: none;
    margin: 0;
    padding: 0;
    align-items: center;
    gap: 1em;
}

nav ul li a {
    text-decoration: none;
    font-size: 1.2vw;
    font-weight: bold;
    color: #e0e0e0;
}

.profile, .shopping-cart {
    display: flex;
    fill: #e0e0e0;
    align-items: baseline;
}

.search {
    display: flex;
    justify-content: center;
    align-items: baseline;
    stroke: #e0e0e0;
    fill: none;
}

.nav-icons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1em;
    right: 2vh;
    position: absolute;
    flex-direction: row-reverse;
    transition: all 0.3s ease;
}

.nav-btn {
    transition: all 0.3s ease;
    color: rgba(224, 224, 224, 0.7);
    fill: rgba(224, 224, 224, 0.7);
}

.nav-btn:hover {
    color: rgba(201, 201, 201, 0.8);
    fill: rgba(201, 201, 201, 0.8);
    transition: all 0.3s ease;
}

.nav-btn-stroke {
    stroke: rgba(224, 224, 224, 0.7);
    transition: all 0.3s ease;
}

.nav-btn-stroke:hover {
    stroke: rgba(201, 201, 201, 0.8);
    transition: all 0.3s ease;
}

/* Miglioramenti per il sistema di autenticazione */
.profile {
    position: relative;
    cursor: pointer;
}

.profile:hover svg {
    fill: #494949;
}

/* Stili migliorati per le icone */
.profile, .shopping-cart, .search {
    padding: 0.5vh;
    border-radius: 0.5vh;
    transition: all 0.3s ease;
}

/* Effetti hover solo quando l'utente è loggato */
.user-logged-in .profile:hover, 
.user-logged-in .shopping-cart:hover {
    background-color: rgba(73, 73, 73, 0.2);
}

.user-logged-in .search:hover {
    background-color: rgba(73, 73, 73, 0.2);
}

/* Nascondi tutte le icone quando l'utente non è loggato */
.user-not-logged-in .profile,
.user-not-logged-in .shopping-cart,
.user-not-logged-in .search {
    display: none !important;
}

/* Assicurati che il pulsante Sign In sia sempre visibile per utenti non loggati */
.user-not-logged-in .sign-in-btn {
    display: inline-flex !important;
}

/* Nascondi il pulsante Sign In quando l'utente è loggato */
.user-logged-in .sign-in-btn {
    display: none !important;
}

/* Pulsante Sign In - Semplice ed efficace */
.sign-in-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5vh !important;
    background: linear-gradient(135deg, #131313 0%, #1a1a1a 50%, #131313 100%) !important;
    color: #c9c9c9 !important;
    border: 1px solid #444243 !important;
    padding: 1vh 2vh !important;
    border-radius: 1.5vh !important;
    font-size: 0.85vw !important;
    font-weight: 500 !important;
    font-family: 'Montserrat-Alt1', sans-serif !important;
    cursor: pointer !important;
    transition: all 0.4s ease !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    min-width: 100px !important;
    min-height: 35px !important;
    text-decoration: none !important;
    position: relative !important;
    overflow: hidden !important;
}

.sign-in-btn svg {
    width: 14px !important;
    height: 14px !important;
    flex-shrink: 0 !important;
    stroke: currentColor !important;
    fill: none !important;
    transition: transform 0.3s ease !important;
}

.sign-in-btn::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: -100% !important;
    width: 100% !important;
    height: 100% !important;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent) !important;
    transition: left 0.6s ease !important;
}

.sign-in-btn:hover {
    background: linear-gradient(135deg, #494949 0%, #666565 50%, #494949 100%) !important;
    border-color: #666565 !important;
    color: #fff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

.sign-in-btn:hover::before {
    left: 100% !important;
}

.sign-in-btn:hover svg {
    transform: translateX(2px) !important;
}

/* Nascondi le icone mobili di default */
.mobile-nav-icons {
    display: none;
}

/* Media queries per responsive design */
@media (max-width: 768px) {
    /* Mostra il menu hamburger */
    .hamburger-menu {
        display: flex;
    }
    
    /* Cambia il logo per mobile */
    .header-logo {
        content: url("../images/pitt_png.png");
        height: 6vh;
    }
    
    /* Nascondi il menu normale */
    nav ul {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: rgba(19, 19, 19, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-radius: 2vh;
        margin-top: 1vh;
        padding: 2vh;
        flex-direction: column;
        gap: 2vh;
        box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    /* Mostra il menu quando è attivo */
    nav ul.active {
        display: flex;
    }
    
    /* Stili per i link del menu mobile */
    nav ul li a {
        font-size: 4vw;
        padding: 1vh 0;
        text-align: center;
        display: block;
        width: 100%;
    }
    
    /* Nascondi le icone desktop per mobile */
    .nav-icons {
        display: none;
    }
    
    /* Mostra le icone nel menu mobile */
    .mobile-nav-icons {
        display: flex;
        justify-content: center;
        gap: 3vh;
        margin-top: 2vh;
        padding-top: 2vh;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .mobile-nav-icons .nav-btn {
        padding: 1vh;
        border-radius: 1vh;
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    /* Adatta il header per mobile */
    header {
        margin: 0.5vh;
        padding: 0.5vh 1vh;
    }
    
    .header-logo {
        height: 4vh;
    }
}

@media (max-width: 480px) {
    /* Ulteriori ottimizzazioni per schermi molto piccoli */
    nav ul li a {
        font-size: 5vw;
    }
    
    header {
        border-radius: 2vh;
    }
    
    /* Mantieni il logo mobile anche per schermi molto piccoli */
    .header-logo {
        content: url("../images/pitt_png2.png");
        height: 4vh;
    }
}

/* iPad Portrait - Layout come smartphone */
@media only screen 
  and (min-device-width: 768px) 
  and (max-device-width: 1024px) 
  and (orientation: portrait) {
    
    /* Nascondi il menu hamburger per iPad portrait */
    .hamburger-menu {
        display: none;
    }
    
    /* Logo per iPad portrait */
    .header-logo {
        content: url("../images/pitt_png.png");
        height: 5vh;
        position: absolute;
        left: 2vh;
    }
    
    /* Mostra il menu normale come su desktop */
    nav ul {
        display: flex;
        justify-content: center;
        list-style-type: none;
        margin: 0 4vh 0 16vh;
        padding: 0;
        align-items: center;
        gap: 1vh;
        position: static;
        background: none;
        backdrop-filter: none;
        border-radius: 0;
        box-shadow: none;
        border: none;
        flex-direction: row;
    }
    
    /* Stili per i link del menu su iPad */
    nav ul li a {
        font-size: 1.8vh;
        padding: 0;
        text-align: center;
        display: block;
        text-decoration: none;
        font-weight: bold;
        color: #e0e0e0;
    }
    
    /* Mostra le icone desktop per iPad portrait */
    .nav-icons {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 1vh;
        right: 2vh;
        position: absolute;
        flex-direction: row-reverse;
        transition: all 0.3s ease;
    }
    
    /* Nascondi le icone nel menu mobile */
    .mobile-nav-icons {
        display: none;
    }
    
    /* Header per iPad portrait */
    header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        margin: 0.3vh;
        padding: 1vh 1.5vh;
        z-index: 1000;
        background-color: transparent;
        backdrop-filter: blur(0px);
        transition: all 0.3s ease;
        border-radius: 2vh;
        border: 1px solid transparent;
        min-height: 5vh;
    }
    
    /* Header con scroll per iPad portrait */
    header.scrolled {
        background: 
            linear-gradient(135deg, rgba(19, 19, 19, 0.15) 0%, rgba(25, 25, 25, 0.2) 100%),
            linear-gradient(90deg, rgba(255,255,255,0.005) 0%, transparent 50%, rgba(255,255,255,0.005) 100%);
        backdrop-filter: blur(12px) saturate(1.1);
        -webkit-backdrop-filter: blur(12px) saturate(1.1);
        box-shadow: 
            0 4px 15px rgba(0, 0, 0, 0.15),
            inset 0 -1px 0 rgba(255, 255, 255, 0.03),
            0 1px 3px rgba(255, 255, 255, 0.01);
        border: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    /* Nav per iPad portrait */
    nav {
        height: 5vh;
        min-height: 5vh;
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
    }
}

/* iPad Portrait - Safari compatibility */
@media screen 
  and (device-width: 768px) 
  and (device-height: 1024px) 
  and (orientation: portrait) {
    
    .hamburger-menu {
        display: none;
    }
    
    .header-logo {
        content: url("../images/pitt_png.png");
        height: 5vh;
        position: absolute;
        left: 2vh;
    }
    
    nav ul {
        display: flex;
        justify-content: center;
        list-style-type: none;
        margin: 0 4vh 0 16vh;
        padding: 0;
        align-items: center;
        gap: 1vh;
        position: static;
        background: none;
        backdrop-filter: none;
        border-radius: 0;
        box-shadow: none;
        border: none;
        flex-direction: row;
    }
    
    nav ul li a {
        font-size: 1.8vh;
        padding: 0;
        text-align: center;
        display: block;
        text-decoration: none;
        font-weight: bold;
        color: #e0e0e0;
    }
    
    .nav-icons {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 1vh;
        right: 2vh;
        position: absolute;
        flex-direction: row-reverse;
        transition: all 0.3s ease;
    }
    
    .mobile-nav-icons {
        display: none;
    }
    
    header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        margin: 0.3vh;
        padding: 1vh 1.5vh;
        z-index: 1000;
        background-color: transparent;
        backdrop-filter: blur(0px);
        transition: all 0.3s ease;
        border-radius: 2vh;
        border: 1px solid transparent;
        min-height: 5vh;
    }
    
    header.scrolled {
        background: 
            linear-gradient(135deg, rgba(19, 19, 19, 0.15) 0%, rgba(25, 25, 25, 0.2) 100%),
            linear-gradient(90deg, rgba(255,255,255,0.005) 0%, transparent 50%, rgba(255,255,255,0.005) 100%);
        backdrop-filter: blur(12px) saturate(1.1);
        -webkit-backdrop-filter: blur(12px) saturate(1.1);
        box-shadow: 
            0 4px 15px rgba(0, 0, 0, 0.15),
            inset 0 -1px 0 rgba(255, 255, 255, 0.03),
            0 1px 3px rgba(255, 255, 255, 0.01);
        border: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    nav {
        height: 5vh;
        min-height: 5vh;
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
    }
}

/* Media queries responsive per Sign In */
@media (max-width: 768px) {
    .sign-in-btn {
        font-size: 3.5vw !important;
        padding: 1.2vh 2.5vh !important;
        min-width: 110px !important;
        min-height: 40px !important;
        border-radius: 2vh !important;
        gap: 0.8vh !important;
    }
    
    .sign-in-btn svg {
        width: 16px !important;
        height: 16px !important;
    }
}

@media (max-width: 480px) {
    .sign-in-btn {
        font-size: 4vw !important;
        padding: 1.5vh 3vh !important;
        min-width: 120px !important;
        min-height: 42px !important;
        border-radius: 2.2vh !important;
        gap: 1vh !important;
    }
    
    .sign-in-btn svg {
        width: 18px !important;
        height: 18px !important;
    }
}
