/* header.css — the site header (src/templates/header.php's <header class="main-header">
   block, plus the sticky banner strip above it and the footer's scroll offset partner).
   Currently loaded only by /produkty — see the CSS refactor plan for the future sitewide
   migration. Copied verbatim from assets/css/common.css (all header-related rules were
   scattered across two places there — the main "Header" section and, oddly, a chunk
   physically embedded after the "Qty Control" section — consolidated here into one place). */

/* --- Site notice banner (temporary announcements, e.g. holiday closure) --- */
.site-notice-banner {
    background: var(--clr-strawberry-pink);
    color: #fff;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.site-notice-banner__inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

/* --- Sticky top bar (banner + header together) --- */
.sticky-top-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* --- Info Banner --- */
@keyframes banner-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

.info-banner {
    background: var(--clr-apricot);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 7px 16px;
    border-radius: var(--radius-card) var(--radius-card) 0 0;
    transition: border-radius 0.3s ease;
}

.app-card.is-scrolled .info-banner {
    border-radius: 0;
}

.info-banner__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex-wrap: nowrap;
}

.info-banner__item {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.info-banner__item svg {
    flex-shrink: 0;
    opacity: 0.9;
}

/* Desktop: duplicate marquee-set hidden, separator dot hidden */
.marquee-set + .marquee-set,
.info-banner__dot--sep {
    display: none;
}

.marquee-track {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    white-space: nowrap;
}

.marquee-set {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.info-banner__dot {
    margin: 0 12px;
    opacity: 0.6;
    font-size: 1rem;
    line-height: 1;
}

@media (max-width: 600px) {
    .sticky-top-bar {
        border-radius: 0;
    }

    .info-banner {
        border-radius: 0;
        padding: 6px 0;
        overflow: hidden;
    }

    .info-banner__inner {
        overflow: hidden;
        padding: 0;
        justify-content: flex-start;
    }

    .marquee-track {
        width: max-content;
        justify-content: flex-start;
        animation: banner-scroll 20s linear infinite;
    }

    /* Show duplicated set for seamless loop */
    .marquee-set + .marquee-set,
    .info-banner__dot--sep {
        display: inline-flex;
    }

    .info-banner__dot {
        margin: 0 10px;
    }
}

/* --- Header --- */
.main-header {
    position: relative;
    height: var(--header-height);
    display: flex;
    align-items: center;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    flex: 0 0 auto;
}

.logo img {
    height: 40px;
    width: auto;
}

/* Align nav left near logo */
#main-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex: 1;
    justify-content: flex-start;
    padding-left: 2rem;
}

/* Tools on the right */
.header-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1.5rem;
    flex: 0 0 auto;
}

#main-nav a.nav-link {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
}

#main-nav a.nav-link:hover,
#main-nav a.nav-link.active {
    color: var(--clr-green);
    position: relative;
}

#main-nav a.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--clr-green);
    border-radius: 2px;
}

/* Products dropdown: opens on hover/focus on desktop; the mobile menu shows it expanded. */
.nav-dropdown-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: -0.75rem;
    min-width: 240px;
    padding: 0.5rem;
    margin-top: 0.75rem;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    z-index: 1000;
}

/* Invisible bridge so the pointer can move from the link into the panel without closing it. */
.nav-dropdown::before {
    content: '';
    position: absolute;
    top: -0.75rem;
    left: 0;
    right: 0;
    height: 0.75rem;
}

.nav-dropdown-wrap:hover .nav-dropdown,
.nav-dropdown-wrap:focus-within .nav-dropdown {
    display: block;
}

.nav-dropdown-link {
    display: block;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    text-decoration: none;
    white-space: nowrap;
}

.nav-dropdown-link:hover {
    background: color-mix(in srgb, var(--clr-green) 15%, #fff);
    color: var(--clr-green);
}

.cart-btn-wrapper {
    position: relative;
}

.btn-cart {
    background-color: var(--btn-green);
    color: var(--btn-green-text);
    padding: 0.5rem 1.2rem;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

/* Empty cart state */
.btn-cart.cart-empty {
    background-color: var(--btn-white);
    color: var(--btn-white-text);
    border-color: var(--btn-white);
}

.btn-cart.cart-empty svg {
    color: var(--btn-white-text) !important;
}

.btn-cart.cart-empty .js-cart-count {
    background: var(--btn-white);
    color: var(--btn-white-text);
}

.btn-cart:hover {
    background-color: var(--btn-green-hover);
    color: var(--btn-green-text);
}

.btn-cart.cart-empty:hover {
    background-color: var(--btn-white-hover);
    color: var(--btn-white-text);
    border-color: var(--clr-green);
}

/* Settings dropdown (language/currency) */
.settings-dropdown {
    position: relative;
    z-index: 1001;
}

.dropbtn {
    background: none;
    border: none;
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.5rem;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: #fff;
    min-width: 180px;
    box-shadow: 0px 8px 20px rgba(0, 0, 0, 0.15);
    z-index: 1002;
    border-radius: 12px;
    padding: 0.5rem;
    border: 1px solid #eee;
}

.dropdown-group span {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #999;
    padding: 0.5rem 0.8rem 0.2rem;
    font-weight: 700;
}

.dropdown-content a {
    padding: 10px 16px;
    display: block;
    font-size: 0.95rem;
    border-radius: 8px;
    color: var(--text-dark);
    font-weight: 500;
}

.dropdown-content a:hover {
    background-color: #f0f7f6;
    color: var(--clr-green);
}

.dropdown-content a.active {
    font-weight: bold;
    color: var(--clr-green);
    background-color: #f0f7f6;
}

.dropdown-division {
    height: 1px;
    background-color: #eee;
    margin: 0.5rem 0;
}

.settings-dropdown:hover .dropdown-content {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* User dropdown */
.user-dropdown-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.user-avatar-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: transform 0.2s ease;
}

.user-avatar-btn:hover {
    transform: scale(1.05);
}

.user-avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--avatar-border-color, var(--clr-green));
    background-color: #fff;
}

.user-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    background-color: #fff;
    min-width: 200px;
    box-shadow: 0px 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1002;
    border-radius: 12px;
    padding: 8px;
    border: 1px solid #eee;
}

.user-dropdown-wrapper.active .user-dropdown-content {
    display: block;
    animation: fadeIn 0.1s ease;
}

.user-dropdown-content a {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    font-size: 0.95rem;
    border-radius: 8px;
    color: var(--text-dark);
    font-weight: 500;
    transition: all 0.2s ease;
}

.user-dropdown-content a:hover {
    background-color: #f0f7f6;
    color: var(--clr-green);
}

.user-dropdown-content a svg {
    color: var(--text-light);
    transition: color 0.2s ease;
}

.user-dropdown-content a:hover svg {
    color: var(--clr-green);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.mobile-controls {
    display: none;
}

/* Mobile controls */
@media (max-width: 768px) {
    .mobile-controls {
        display: flex !important;
        order: 2;
    }

    .header-tools {
        display: none !important;
    }

    .user-avatar-circle {
        width: 35px;
        height: 35px;
    }

    .user-dropdown-content {
        position: fixed;
        top: 70px;
        right: 20px;
        left: 20px;
        width: auto;
    }

    .btn-cart .cart-label {
        display: none;
    }

    .btn-cart {
        padding: 0.6rem;
        gap: 6px;
    }

    .mobile-controls .user-dropdown-wrapper {
        display: none;
    }

    .mobile-settings-dropdown .dropdown-content {
        position: fixed;
        top: 70px;
        right: 20px;
        left: auto;
        width: auto;
        min-width: 150px;
    }

    .mobile-settings-dropdown:hover .dropdown-content {
        display: none;
    }

    .mobile-settings-dropdown.open .dropdown-content {
        display: block;
        animation: fadeIn 0.2s ease;
    }
}

/* Hamburger menu */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    padding: 0;
}

.hamburger span {
    width: 100%;
    height: 3px;
    background-color: var(--text-dark);
    border-radius: 10px;
    transition: all 0.3s;
}

/* Media queries for mobile nav — kept together here even though in common.css these are
   oddly split off, physically located after an unrelated "Qty Control" section. */
@media (max-width: 900px) {
    .main-header .container {
        justify-content: space-between;
        gap: 0.5rem;
    }

    .logo {
        flex: 0 0 auto;
        order: 1;
    }

    .header-tools {
        display: flex;
        flex: 0 0 auto;
        gap: 0.5rem;
        width: auto;
        justify-content: flex-end;
        order: 2;
        margin-left: auto;
    }

    .cart-label {
        display: none;
    }

    .btn-cart {
        padding: 0.5rem;
    }

    .btn-cart svg {
        margin: 0;
    }

    .hamburger {
        display: flex;
        flex: 0 0 auto;
        margin-left: 0.5rem;
        order: 3;
    }
}

@media (max-width: 900px) {
    #main-nav {
        position: absolute;
        top: var(--header-height);
        left: 0;
        width: 100%;
        background: white;
        flex-direction: column;
        padding: 2rem;
        gap: 1.5rem;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        transform: translateY(-150%);
        /* visibility navíc k transformu – v kombinaci se sticky rodičem (.sticky-top-bar),
           jehož výška se mění (nová hláška), Chrome umí špatně spočítat, kam se transformem
           "mimo obrazovku" posunutý prvek vykreslí, a bílý panel menu pak překryje obsah nad ním.
           visibility: hidden ho spolehlivě vynechá z vykreslení bez ohledu na transform. */
        visibility: hidden;
        transition: transform 0.3s ease, visibility 0s linear 0.3s;
        z-index: 999;
        justify-content: flex-start;
        align-items: flex-start;
    }

    .dropbtn {
        font-size: 0.8rem;
    }

    /* Mobile: categories always listed under "Produkty", indented, no second tap needed. */
    .nav-dropdown-wrap {
        display: block;
        width: 100%;
    }

    .nav-dropdown {
        display: flex;
        flex-direction: column;
        position: static;
        min-width: 0;
        margin: 0.6rem 0 0;
        padding: 0 0 0 1.25rem;
        border: none;
        border-radius: 0;
        background: none;
    }

    .nav-dropdown::before {
        display: none;
    }

    .nav-dropdown-link {
        display: block;
        padding: 0.35rem 0;
        font-size: 0.95rem;
        font-weight: 400;
        white-space: normal;
        text-align: left;
    }

    .nav-dropdown-link:hover {
        background: none;
    }

    #main-nav.active {
        transform: translateY(0);
        visibility: visible;
        transition: transform 0.3s ease;
    }

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

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

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