/* ==========================================================================
   HEADER STYLES - MyTicketPrinting.it
   ========================================================================== */

/* --------------------------------------------------------------------------
   VARIABILI CSS
   -------------------------------------------------------------------------- */
:root {
    --header-bg: #ffffff;
    --header-border: #eeeeee;
    --nav-bg: #c31949;
    --nav-bg-hover: #a01538;
    --text-dark: #111111;
    --text-light: #ffffff;
    --accent: #c31949;
    --font-main: Arial, Helvetica, sans-serif;
    --header-height: 70px;
    --nav-height: 50px;
    --z-header: 1000;
    --z-dropdown: 1001;
    --z-mobile-menu: 1002;
    --z-sidebar: 9999;
    --z-sidebar-overlay: 9998;
}

/* --------------------------------------------------------------------------
   HEADER CONTAINER (Sticky)
   -------------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background: var(--header-bg);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* --------------------------------------------------------------------------
   TOP BAR (Logo, Login, Carrello, Telefono)
   -------------------------------------------------------------------------- */
.header-topbar {
    background: var(--header-bg);
    padding: 12px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--header-border);
    min-height: var(--header-height);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.header-logo img {
    height: 50px;
    width: auto;
}

/* --------------------------------------------------------------------------
   BARRA DI RICERCA
   -------------------------------------------------------------------------- */
.header-search {
    display: flex;
    align-items: stretch;
    flex: 1;
    max-width: 650px;
    height: 44px;
    border-radius: 25px;
    overflow: hidden;
    border: 2px solid #ddd;
    transition: border-color 0.3s ease;
    background: #fff;
}

.header-search:focus-within {
    border-color: var(--accent);
}

.search-category {
    position: relative;
    background: #f5f5f5;
    border-right: 1px solid #ddd;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.search-category select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    padding: 0 30px 0 15px;
    height: 100%;
    font-size: 14px;
    font-family: Arial, Helvetica, sans-serif;
    color: #333;
    cursor: pointer;
    min-width: 140px;
}

.search-category select:focus {
    outline: none;
}

.search-category::after {
    content: '▼';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 8px;
    color: #666;
    pointer-events: none;
}

.search-input {
    flex: 1;
    display: flex;
    min-width: 0;
}

.search-input input {
    width: 100%;
    min-width: 0;
    border: none;
    padding: 0 15px;
    font-size: 15px;
    font-family: Arial, Helvetica, sans-serif;
    color: #333;
    background: transparent;
}

.search-input input:focus {
    outline: none;
}

.search-input input::placeholder {
    color: #999;
}

.search-button {
    background: var(--accent);
    border: none;
    width: 50px;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.search-button:hover {
    background: var(--nav-bg-hover);
}

.search-button svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Link utente */
.header-user-links {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-user-links a {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--text-dark);
    font-size: 14px;
    transition: color 0.3s ease;
}

.header-user-links a:not(.header-login):hover {
    color: var(--accent);
}

.header-user-links img,
.header-user-links svg {
    height: 20px;
    width: 20px;
}

/* Accedi → Stile come carrello */
.header-login {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #111;
    background: transparent;
    padding: 10px 15px;
    border-radius: 4px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.header-login:hover {
    border-color: #111;
    text-decoration: none;
}

.header-login svg {
    width: 20px;
    height: 20px;
    fill: #111;
}


/* Carrello stile minimale */
.header-cart {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #111;
    background: transparent;
    padding: 10px 15px;
    border-radius: 4px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.header-cart:hover {
    border-color: #111;
    text-decoration: none;
}

.cart-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-icon {
    width: 28px;
    height: 28px;
    fill: #111;
}

.cart-count {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #c31949;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.cart-label {
    font-size: 14px;
    font-weight: 700;
    color: #111;
}

/* Made in Italy */
.header-badge img {
    height: 40px;
    width: auto;
}

/* Benvenuto utente */
.header-welcome {
    font-size: 14px;
    color: var(--text-dark);
}

/* --------------------------------------------------------------------------
   NAVIGATION BAR
   -------------------------------------------------------------------------- */
.nav-bar {
    position: relative;
    background: var(--nav-bg);
    padding: 0 25px;
    display: flex;
    justify-content: flex-start; /* Allineato a sinistra */
    align-items: center;
    min-height: var(--nav-height);
}

.nav-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-light);
    text-decoration: none;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    font-weight: 600;
    padding: 15px 14px;
    transition: background 0.3s ease;
    white-space: nowrap;
}

.nav-link:hover,
.nav-item:hover > .nav-link {
    background: var(--nav-bg-hover);
}

.nav-link .arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.nav-item:hover .nav-link .arrow {
    transform: rotate(180deg);
}

/* --------------------------------------------------------------------------
   PULSANTE MENU (Sidebar opener)
   -------------------------------------------------------------------------- */
.nav-item-menu {
    margin-right: 80px; /* Spazio tra Menu e Biglietti */
}

.nav-menu-btn {
    background: rgba(255, 255, 255, 0.95);
    color: var(--nav-bg);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-main);
    font-size: 16px;
    font-weight: 600;
    padding: 10px 16px;
    transition: all 0.3s ease;
}

.nav-menu-btn:hover {
    background: #ffffff;
    transform: scale(1.02);
}

.nav-menu-btn svg {
    stroke: var(--nav-bg);
}

/* --------------------------------------------------------------------------
   DROPDOWN MENU
   -------------------------------------------------------------------------- */
.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--header-bg);
    min-width: 220px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    border-radius: 0 0 8px 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: var(--z-dropdown);
    list-style: none;
    margin: 0;
    padding: 10px 0;
}

.nav-item:hover .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown li {
    margin: 0;
}

.nav-dropdown a {
    display: block;
    padding: 10px 20px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s ease;
}

.nav-dropdown a:hover {
    background: #f5f5f5;
    color: var(--accent);
    padding-left: 25px;
}

/* Categoria nel dropdown */
.dropdown-category {
    padding: 8px 20px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
}

/* Divider nel dropdown */
.dropdown-divider {
    height: 1px;
    background: #eee;
    margin: 8px 15px;
}

/* --------------------------------------------------------------------------
   MEGA DROPDOWN (per Biglietti)
   -------------------------------------------------------------------------- */
.nav-item-mega {
    position: static;
}

.nav-mega-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--header-bg);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    border-radius: 0 0 8px 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: var(--z-dropdown);
    padding: 20px 0;
}

.nav-item-mega:hover .nav-mega-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-dropdown-inner {
    display: flex;
    justify-content: center;
    gap: 40px;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

.mega-column {
    min-width: 180px;
}

.mega-column-title {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    padding-bottom: 10px;
    margin-bottom: 8px;
    border-bottom: 2px solid var(--accent);
}

.mega-column ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-column li {
    margin: 0;
}

.mega-column a {
    display: block;
    padding: 8px 0;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
}

.mega-column a:hover {
    color: var(--accent);
    padding-left: 5px;
}

/* --------------------------------------------------------------------------
   HAMBURGER BUTTON (Mobile)
   -------------------------------------------------------------------------- */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: var(--z-mobile-menu);
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--text-dark);
    margin: 3px 0;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* --------------------------------------------------------------------------
   MOBILE MENU
   -------------------------------------------------------------------------- */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--header-bg);
    z-index: calc(var(--z-mobile-menu) - 1);
    padding: 80px 20px 20px;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.mobile-menu.active {
    transform: translateX(0);
}

.mobile-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-menu-item {
    border-bottom: 1px solid var(--header-border);
}

.mobile-menu-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 10px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
}

.mobile-menu-link.has-submenu::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.3s ease;
}

.mobile-menu-item.open .mobile-menu-link.has-submenu::after {
    transform: rotate(180deg);
}

.mobile-submenu {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0 0 10px 20px;
    background: #f9f9f9;
}

.mobile-menu-item.open .mobile-submenu {
    display: block;
}

.mobile-submenu a {
    display: block;
    padding: 12px 15px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 14px;
}

.mobile-submenu a:hover {
    color: var(--accent);
}

/* Ricerca mobile */
.mobile-search {
    padding: 15px 20px;
    background: #f5f5f5;
}

.mobile-search form {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #ddd;
}

.mobile-search input {
    flex: 1;
    border: none;
    padding: 12px 15px;
    font-size: 16px;
    font-family: Arial, Helvetica, sans-serif;
}

.mobile-search input:focus {
    outline: none;
}

.mobile-search button {
    background: var(--accent);
    border: none;
    padding: 12px 15px;
    cursor: pointer;
}

.mobile-search button svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

/* ==========================================================================
   SIDEBAR MENU - Menu Laterale Completo
   ========================================================================== */

/* Overlay scuro */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: var(--z-sidebar-overlay);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Sidebar Container */
.sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 320px;
    height: 100vh;
    background: #ffffff;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: var(--z-sidebar);
    display: flex;
    flex-direction: column;
    transition: left 0.3s ease;
    overflow: hidden;
}

.sidebar.open {
    left: 0;
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--nav-bg);
    color: #ffffff;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-close {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Sidebar Content (scrollabile) */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* Sezioni Accordion */
.sidebar-section {
    border-bottom: 1px solid #eee;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar .sidebar-section-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}

.sidebar .sidebar-section-header:hover {
    background: #f5f5f5;
}

.sidebar .section-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar .section-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    text-align: left;
    margin-bottom: 0;
}

.sidebar .section-arrow {
    font-size: 10px;
    color: #666;
    transition: transform 0.2s;
}

.sidebar .sidebar-section-header[aria-expanded="true"] .section-arrow {
    transform: rotate(0deg);
}

.sidebar .sidebar-section-header[aria-expanded="false"] .section-arrow {
    transform: rotate(-90deg);
}

/* Contenuto Sezione */
.sidebar-section-content {
    padding: 0 20px 12px 20px;
    display: block;
}

.sidebar-section-content.collapsed {
    display: none;
}

/* Sottocategorie Collassabili (dentro Prodotti) */
.sidebar-subcategory {
    margin-bottom: 2px;
}

.subcategory-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    background: none;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.subcategory-header:hover {
    background: #fafafa;
    padding-left: 4px;
}

.subcategory-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--accent);
}

.subcategory-arrow {
    font-size: 9px;
    color: #999;
    transition: transform 0.2s;
}

.sidebar-subcategory.open .subcategory-arrow {
    transform: rotate(0deg);
}

.sidebar-subcategory:not(.open) .subcategory-arrow {
    transform: rotate(-90deg);
}

/* Contenuto sottocategoria */
.subcategory-content {
    display: none;
    padding: 4px 0 8px 0;
}

.sidebar-subcategory.open .subcategory-content {
    display: block;
}

/* Vecchio stile category-label (mantenuto per retrocompatibilità) */
.sidebar-category {
    margin-bottom: 8px;
}

.category-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    padding: 8px 0 6px 0;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 6px;
}

/* Links */
.sidebar-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-links li {
    margin: 0;
}

.sidebar-links a {
    display: block;
    padding: 6px 0 6px 8px;
    color: #333;
    text-decoration: none;
    font-size: 13px;
    border-radius: 4px;
    transition: all 0.2s;
}

.sidebar-links a:hover {
    background: #f8f8f8;
    color: var(--accent);
    padding-left: 12px;
}

.sidebar-links a.active {
    font-weight: 600;
    color: var(--accent);
}

/* Divider */
.sidebar-divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 12px 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 20px;
    background: #f8f8f8;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.sidebar-contact {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-phone {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1a1a2e;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
}

.sidebar-phone:hover {
    color: var(--accent);
}

.sidebar-email {
    color: #666;
    text-decoration: none;
    font-size: 13px;
}

.sidebar-email:hover {
    color: var(--accent);
}

/* Scrollbar Custom */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* --------------------------------------------------------------------------
   RESPONSIVE - TABLET
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .nav-link {
        padding: 15px 12px;
        font-size: 15px;
    }

    .header-search {
        max-width: 400px;
    }

    .search-category select {
        min-width: 100px;
    }
}

/* --------------------------------------------------------------------------
   RESPONSIVE - MOBILE
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .header-topbar {
        padding: 10px 15px;
        flex-wrap: wrap;
    }

    .header-left {
        flex: auto;
        width: 100%;
        order: 1;
    }

    .header-logo img {
        height: 40px;
    }

    .header-search {
        display: none;
    }

    .header-badge,
    .header-user-links span {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .nav-bar {
        display: none;
    }

    .mobile-menu {
        display: block;
    }

    .header-right {
        gap: 15px;
    }

    .header-cart {
        padding: 8px 12px;
    }

    .cart-label {
        display: none;
    }

    .cart-icon {
        width: 24px;
        height: 24px;
    }

    /* Sidebar full width su mobile */
    .sidebar {
        width: 100%;
        left: -100%;
    }
}

/* --------------------------------------------------------------------------
   RESPONSIVE - SMALL MOBILE
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
    .header-topbar {
        padding: 8px 10px;
    }

    .header-logo img {
        height: 35px;
    }

    .header-user-links a span {
        display: none;
    }
}