/* ============================================================
   Szerszámolcsón.hu – header.css
   Topbar, fejléc, keresősáv, navigáció, mobilmenü, ticker
   ============================================================ */

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    background: var(--dark-bar);
    padding: 7px 0;
    font-family: var(--fm);
    font-size: 11px;
    color: var(--dark-txt);
    transition: background .3s;
}

.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.topbar-left  { display: flex; gap: 20px; flex-wrap: wrap; }
.topbar-right { display: flex; gap: 16px; align-items: center; flex-shrink: 0; }

.tb-item {
    display: flex;
    align-items: center;
    gap: 5px;
    transition: var(--t);
    white-space: nowrap;
}
.tb-item:hover  { color: var(--gold); }
.tb-item a      { color: inherit; }

.tb-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pdot 2.5s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes pdot {
    0%, 100% { opacity: 1; }
    50%       { opacity: .3; }
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    transition: background .3s, border-color .3s, box-shadow .3s, transform .3s;
}

.header.scrolled {
    border-bottom-color: var(--gold);
    box-shadow: 0 2px 16px rgba(0,0,0,.09);
}
[data-theme="dark"] .header.scrolled {
    box-shadow: 0 2px 16px rgba(0,0,0,.4);
}

.header.header--hidden {
    transform: translateY(-100%);
}

.nav-wrap {
    display: flex;
    align-items: center;
    height: var(--header-h);
    gap: 12px;
}

/* ============================================================
   LOGÓ
   ============================================================ */
.logo {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-shrink: 0;
    text-decoration: none;
}

.logo-mark {
    width: 34px;
    height: 34px;
    background: var(--gold);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--t);
}
.logo:hover .logo-mark {
    background: var(--gold-h);
    transform: rotate(-5deg);
}

.logo-mark--sm {
    width: 30px;
    height: 30px;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.logo-name {
    font-family: var(--fd);
    font-weight: 800;
    font-size: 15px;
    letter-spacing: .3px;
    text-transform: uppercase;
    color: var(--text);
    transition: color .3s;
    white-space: nowrap;
}

.logo-sub {
    font-family: var(--fm);
    font-size: 8px;
    letter-spacing: .5px;
    color: var(--gold);
    margin-top: 1px;
}

/* ============================================================
   KERESŐSÁV A FEJLÉCBEN
   ============================================================ */
.header-search-wrap {
    flex: 1;
    max-width: 580px;
    position: relative;
}

.header-search {
    display: flex;
    align-items: center;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--r-xl);
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
    height: 42px;
}

.header-search:focus-within {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-dim);
    background: var(--surface);
}

/* Kategória szűrő gomb */
.search-cat-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 12px 0 14px;
    border-right: 1px solid var(--border);
    height: 100%;
    font-family: var(--fd);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--text-3);
    white-space: nowrap;
    flex-shrink: 0;
    background: none;
    cursor: pointer;
    transition: var(--t);
}
.search-cat-btn:hover { color: var(--gold); }

/* Keresőmező input */
.search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 0 12px;
    font-size: 14px;
    color: var(--text);
    background: transparent;
    min-width: 0;
}
.search-input::placeholder { color: var(--text-4); }

/* Keresés gomb */
.search-submit-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 18px;
    height: 100%;
    background: var(--gold);
    color: #fff;
    font-family: var(--fd);
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--t);
}
[data-theme="dark"] .search-submit-btn { color: #000; }
.search-submit-btn:hover { background: var(--gold-h); }

/* Keresési szöveg csak desktopOn látszik */
@media (max-width: 900px) {
    .search-btn-text { display: none; }
    .search-submit-btn { padding: 0 14px; }
}

/* Kategória legördülő */
.search-cat-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 2px solid var(--gold);
    border-radius: var(--r-md);
    box-shadow: var(--sh-lg);
    z-index: 300;
    padding: 6px;
    max-height: 320px;
    overflow-y: auto;
}

.search-cat-option {
    display: block;
    width: 100%;
    padding: 9px 12px;
    text-align: left;
    font-size: 13px;
    color: var(--text-3);
    border-radius: var(--r-xs);
    cursor: pointer;
    background: none;
    border: none;
    transition: var(--t);
}
.search-cat-option:hover,
.search-cat-option--active { background: var(--gold-dim); color: var(--gold); }

.search-cat-option--child {
    padding-left: 24px;
    font-size: 12px;
    color: var(--text-4);
}
.search-cat-option--child:hover { color: var(--gold); }

/* Autocomplete dropdown */
.search-autocomplete {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 2px solid var(--gold);
    border-radius: 0 0 var(--r-md) var(--r-md);
    box-shadow: var(--sh-lg);
    z-index: 299;
    max-height: 380px;
    overflow-y: auto;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: var(--t);
    border-bottom: 1px solid var(--border-soft);
    text-decoration: none;
    color: inherit;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover      { background: var(--gold-dim); }

.autocomplete-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: var(--r-xs);
    background: var(--surface-3);
    flex-shrink: 0;
}

.autocomplete-img-placeholder {
    width: 40px;
    height: 40px;
    background: var(--surface-3);
    border-radius: var(--r-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.autocomplete-info { flex: 1; min-width: 0; }
.autocomplete-name {
    font-family: var(--fd);
    font-weight: 700;
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.autocomplete-cat  { font-size: 10px; color: var(--text-4); }
.autocomplete-price {
    font-family: var(--fd);
    font-weight: 800;
    font-size: 14px;
    color: var(--gold);
    flex-shrink: 0;
}

.autocomplete-footer {
    padding: 10px 14px;
    border-top: 1px solid var(--border-soft);
    text-align: center;
}

.autocomplete-footer a {
    font-family: var(--fd);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--gold);
    transition: var(--t);
}
.autocomplete-footer a:hover { opacity: .8; }

/* Nincs találat üzenet */
.autocomplete-empty {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-3);
}

/* ============================================================
   DESKTOP NAVIGÁCIÓ
   ============================================================ */
.nav-links {
    display: flex;
    align-items: center;
    gap: 1px;
    flex-shrink: 0;
}

.nav-link,
.nav-dd-trigger {
    font-family: var(--fd);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 6px 11px;
    border-radius: var(--r-xs);
    position: relative;
    transition: var(--t);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    cursor: pointer;
}

.nav-link::after,
.nav-dd-trigger::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 11px;
    right: 11px;
    height: 2px;
    background: var(--gold);
    border-radius: 1px;
    transform: scaleX(0);
    transition: var(--t);
}

.nav-link:hover,
.nav-dd-trigger:hover {
    color: var(--text);
    background: var(--surface-2);
}

.nav-link:hover::after,
.nav-dd-trigger:hover::after,
.nav-link.active::after,
.nav-dd-trigger.active::after { transform: scaleX(1); }

.nav-link.active,
.nav-dd-trigger.active { color: var(--gold); }

/* Akciók badge */
.nav-sale-badge {
    background: var(--red);
    color: #fff;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: .5px;
}

/* ============================================================
   NAVIGÁCIÓ LEGÖRDÜLŐ
   ============================================================ */
.nav-dd-wrap {
    position: relative;
}

.nav-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 2px solid var(--gold);
    border-radius: var(--r-md);
    padding: 7px;
    min-width: 210px;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: var(--t);
    box-shadow: var(--sh-lg);
    z-index: 250;
}

.nav-dropdown--right {
    left: auto;
    right: 0;
}

.nav-dd-wrap:hover .nav-dropdown,
.nav-dd-wrap:focus-within .nav-dropdown {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.nav-dd-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 11px;
    border-radius: var(--r-xs);
    color: var(--text-3);
    font-size: 13px;
    font-weight: 500;
    transition: var(--t);
    text-decoration: none;
    gap: 8px;
}
.nav-dd-item:hover          { background: var(--gold-dim); color: var(--gold); }
.nav-dd-item--all           { color: var(--gold); font-weight: 600; margin-top: 2px; }
.nav-dd-item--logout        { color: var(--red); }
.nav-dd-item--logout:hover  { background: rgba(192,57,43,.1); color: var(--red); }

.nav-dd-divider {
    height: 1px;
    background: var(--border);
    margin: 5px 0;
}

/* Bejelentkezett user fejléc a dropdownban */
.nav-dd-user-info {
    padding: 10px 11px 8px;
}
.nav-dd-user-name {
    font-family: var(--fd);
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
}
.nav-dd-user-email {
    font-size: 11px;
    color: var(--text-4);
    margin-top: 1px;
}

/* ============================================================
   JOBB OLDALI AKCIÓ IKONOK
   ============================================================ */
.nav-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
}

.nav-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    color: var(--text-3);
    transition: var(--t);
    position: relative;
    text-decoration: none;
    cursor: pointer;
    background: none;
}

.nav-icon:hover {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--gold);
}

.nav-icon--user { gap: 5px; }
.nav-icon-label {
    font-family: var(--fd);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--text-3);
    white-space: nowrap;
}
.nav-icon:hover .nav-icon-label { color: var(--gold); }

/* Kosár badge */
.nav-cart-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gold);
    color: #fff;
    font-size: 8px;
    font-weight: 700;
    font-family: var(--fm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s;
}
[data-theme="dark"] .nav-cart-badge { color: #000; }

.nav-cart-badge--hidden { display: none; }
.nav-cart-badge--bounce { animation: badge-bounce .3s ease; }
@keyframes badge-bounce {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.5); }
}

/* Téma toggle */
.theme-toggle {
    width: 34px;
    height: 34px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-3);
    transition: var(--t);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-dim); }

.th-icon {
    position: absolute;
    font-size: 14px;
    line-height: 1;
    transition: transform .35s var(--ease), opacity .25s;
}
.th-sun  { transform: translateY(0);   opacity: 1; }
.th-moon { transform: translateY(26px); opacity: 0; }
[data-theme="dark"] .th-sun  { transform: translateY(-26px); opacity: 0; }
[data-theme="dark"] .th-moon { transform: translateY(0);    opacity: 1; }

/* Hamburger */
.mob-toggle {
    display: none;
    width: 34px;
    height: 34px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    cursor: pointer;
    flex-shrink: 0;
}

.hline {
    width: 16px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: var(--t);
}

.mob-toggle.open .hline:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.mob-toggle.open .hline:nth-child(2) { opacity: 0; transform: scaleX(0); }
.mob-toggle.open .hline:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ============================================================
   MOBILMENÜ OVERLAY
   ============================================================ */
.mob-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface);
    z-index: 190;
    padding: 20px var(--page-pad) 30px;
    display: flex;
    flex-direction: column;
    gap: 0;
    transform: translateX(100%);
    transition: transform .3s var(--ease);
    border-top: 1px solid var(--border);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mob-nav.open {
    transform: translateX(0);
}

.mob-nav-search {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.mob-search-form {
    display: flex;
    gap: 8px;
}

.mob-nav-list { flex: 1; }

.mob-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    font-family: var(--fd);
    font-weight: 800;
    font-size: 20px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-3);
    transition: var(--t);
    background: none;
    cursor: pointer;
    text-decoration: none;
    text-align: left;
}

.mob-nav-link:hover,
.mob-nav-link.active { color: var(--gold); }

.mob-nav-link--expand svg {
    transition: transform .25s;
}
.mob-nav-link--expand[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.mob-nav-sub {
    padding: 8px 0 8px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mob-nav-sub-link {
    display: block;
    padding: 8px 0;
    font-size: 15px;
    color: var(--text-3);
    border-bottom: 1px solid var(--border-soft);
    transition: var(--t);
    text-decoration: none;
}
.mob-nav-sub-link:hover { color: var(--gold); padding-left: 6px; }
.mob-nav-sub-link--all  { color: var(--gold); font-weight: 600; }

.mob-nav-auth {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ============================================================
   TICKER SZALAG
   ============================================================ */
.ticker-tape {
    background: var(--gold);
    padding: 8px 0;
    overflow: hidden;
}

.ticker-inner {
    display: flex;
    animation: ticker-go 24s linear infinite;
    width: max-content;
}

.ticker-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 26px;
    font-family: var(--fd);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #fff;
    white-space: nowrap;
}
[data-theme="dark"] .ticker-item { color: #000; }

.ticker-sep {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255,255,255,.4);
    flex-shrink: 0;
}
[data-theme="dark"] .ticker-sep { background: rgba(0,0,0,.3); }

@keyframes ticker-go {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* ============================================================
   RESZPONZÍV
   ============================================================ */
@media (max-width: 1100px) {
    .nav-links { display: none; }
    .header-search-wrap { max-width: 100%; }
}

@media (max-width: 768px) {
    .topbar-left .tb-item:nth-child(n+2) { display: none; }
    .mob-toggle { display: flex; }
    .header-search-wrap { display: none; } /* Mobilon a mobilmenüben van */
    .nav-icon--user .nav-icon-label { display: none; }
}

@media (max-width: 480px) {
    .topbar { display: none; }
}

/* Desktop: mobil elemek rejtve */
@media (min-width: 769px) {
    .mob-toggle { display: none !important; }
    .mob-nav    { display: none !important; }
}

/* Segédosztály a topbar "d-md-flex" kezeléséhez */
@media (max-width: 900px) {
    .d-md-flex { display: none !important; }
}
