/* Shared Layout: Header, Navigation, Drawers, Footer */

#header-placeholder {
    position: sticky;
    top: 0;
    z-index: 1000;
    --search-panel-space: 0px;
}

#header-placeholder [data-reveal] {
    opacity: 1;
    transform: none;
}

.site-header {
    position: relative;
    z-index: 20;
}

.top-banner {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #f1c28e;
    background: linear-gradient(90deg, #fff1dd 0%, #ffe7c5 50%, #fff1dd 100%);
    box-shadow: 0 2px 10px rgba(148, 82, 17, 0.1);
    color: #5a3a1e;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-align: center;
    padding: 6px 12px;
}

.top-banner p {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.top-banner strong {
    color: #6f3c09;
    font-weight: 700;
    background: rgba(255, 140, 0, 0.12);
    border: 1px solid rgba(255, 140, 0, 0.28);
    border-radius: 999px;
    padding: 2px 10px;
}

.nav-shell {
    border-bottom: 1px solid rgba(245, 189, 126, 0.62);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(255, 250, 244, 0.86);
    padding-bottom: var(--search-panel-space);
    transition: padding-bottom 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease;
}

.nav-row {
    min-height: 86px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 24px;
}

.brand-mark {
    display: inline-flex;
    flex-direction: column;
    width: fit-content;
}

.brand-mark img {
    height: 40px;
    width: auto;
    display: block;
}

.brand-sub {
    margin-top: 2px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #9a7551;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.main-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(18px, 2.2vw, 34px);
    min-width: 0;
}

.main-nav a {
    color: #7f5a33;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.25s ease;
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    white-space: nowrap;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--primary-hover);
}

.nav-actions {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-btn {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6f4d2d;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.25s ease;
    cursor: pointer;
}

.icon-btn:hover {
    border-color: #ffb56a;
    color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(183, 101, 18, 0.16);
}

.search-box {
    --search-open-width: clamp(260px, 26vw, 360px);
    position: relative;
    width: 42px;
    height: 42px;
    display: grid;
    grid-template-columns: 42px 0fr;
    align-items: center;
    gap: 0;
    overflow: visible;
    transition: width 0.28s ease, grid-template-columns 0.28s ease, gap 0.28s ease;
}

.search-box.active {
    width: var(--search-open-width);
    grid-template-columns: 42px 1fr;
    gap: 8px;
}

.search-toggle {
    width: 42px;
    height: 42px;
}

.search-box.active .search-toggle {
    border-color: #f3bc80;
    box-shadow: 0 8px 18px rgba(183, 101, 18, 0.14);
}

.search-input {
    opacity: 0;
    pointer-events: none;
    width: 0;
    min-width: 0;
    height: 42px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0);
    color: var(--text-color);
    padding: 8px 0;
    transition: width 0.28s ease, opacity 0.2s ease, padding 0.28s ease, border-color 0.28s ease, background-color 0.28s ease, box-shadow 0.28s ease;
}

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

.search-box.active .search-input {
    width: 100%;
    opacity: 1;
    pointer-events: auto;
    border-color: var(--border-color);
    background: rgba(255, 255, 255, 0.94);
    padding: 8px 14px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.search-suggest {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: var(--search-open-width);
    max-height: min(210px, 34vh);
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(242, 206, 165, 0.92);
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(132, 76, 22, 0.14);
    display: none;
    z-index: 1200;
}

.search-suggest-item {
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.search-suggest-item:last-child {
    border-bottom: none;
}

.search-suggest-item:hover {
    background: rgba(255, 238, 213, 0.8);
}

.search-suggest-img {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--accent-color);
}

.search-suggest-title {
    font-size: 0.9rem;
    color: var(--heading-color);
    margin: 0;
}

.search-suggest-price {
    font-size: 0.85rem;
    color: var(--primary-color);
    margin-top: 2px;
}

.auth-user-btn {
    position: relative;
}

.auth-user-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.9);
    color: #5f3f22;
    padding: 0 10px;
    cursor: pointer;
}

.auth-user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.86rem;
    font-weight: 700;
}

.auth-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(242, 206, 165, 0.92);
    border-radius: 10px;
    min-width: 160px;
    box-shadow: 0 10px 24px rgba(132, 76, 22, 0.14);
    padding: 6px 0;
    display: none;
    z-index: 1300;
}

.auth-user-btn.open .auth-menu {
    display: block;
}

.auth-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--text-color);
    font-size: 0.9rem;
}

.auth-menu-item:hover {
    background: rgba(255, 238, 213, 0.8);
}

.floating-quick-actions {
    position: fixed;
    right: max(14px, env(safe-area-inset-right));
    bottom: calc(16px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1100;
}

.floating-action-btn {
    position: relative;
    width: clamp(52px, 7vw, 60px);
    height: clamp(52px, 7vw, 60px);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: clamp(1.3rem, 2.1vw, 1.6rem);
    background: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition);
}

.floating-action-btn:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.count-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: #f1514f;
    color: #fff;
    font-size: 11px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
}

.drawer-overlay.active {
    display: block;
}

button.close-drawer {
    border: 1px solid var(--border-color);
    background: #fff;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 500px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.96);
    z-index: 2200;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    font-family: var(--font-body);
    backdrop-filter: blur(14px) saturate(125%);
    -webkit-backdrop-filter: blur(14px) saturate(125%);
}

.cart-drawer.active {
    right: 0;
}

.cart-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: var(--accent-color);
}

.cart-footer-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.cart-item {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    align-items: flex-start;
}

.cart-item img {
    width: 80px;
    height: 110px;
    object-fit: contain;
    border-radius: 8px;
    background: #f4f8fd;
}

.cart-item h4 {
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.cart-item-size {
    color: #8895a9;
    font-size: 0.85rem;
}

.cart-item-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: nowrap;
}

.cart-item-line p {
    margin: 0;
    white-space: nowrap;
    color: var(--primary-color);
    font-weight: 600;
}

.qty-control,
.cart-qty-control {
    margin-top: 12px;
    display: flex;
    width: 100%;
    max-width: 220px;
    justify-content: space-between;
    border: 1px solid var(--border-color);
    border-radius: 0;
    height: 40px;
    overflow: hidden;
}

.qty-control .qty-input,
.cart-qty-control .qty-input,
.cart-qty-control .cart-qty-input {
    text-align: center;
    width: 100%;
    padding: 8px 6px;
    border: none;
    background: transparent;
    font-weight: 600;
    height: 40px;
    flex: 1 1 auto;
    border-radius: 0;
}

.qty-btn,
.cart-qty-control .qty-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-color);
    font-size: 16px;
    color: var(--text-color);
    flex: 0 0 40px;
    border-radius: 0;
    border-right: 1px solid var(--border-color);
}

.qty-btn:last-child,
.cart-qty-control .qty-btn:last-child {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

.qty-btn:hover,
.cart-qty-control .qty-btn:hover {
    background: var(--accent-color);
}

.cart-remove-btn-lg {
    font-size: 1.2rem;
    line-height: 1;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ef4444;
    border-radius: 999px;
    background: #fff5f5;
}

.size-select-modal {
    position: fixed;
    inset: 0;
    z-index: 2600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
}

.size-select-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.size-select-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 16, 25, 0.52);
}

.size-select-card {
    position: relative;
    width: min(560px, calc(100% - 8px));
    max-height: min(82vh, 760px);
    overflow: auto;
    border-radius: 18px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    padding: 22px;
}

.size-select-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.size-select-header h3 {
    margin: 0;
    font-size: 1.28rem;
}

.size-select-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: #fff;
    font-size: 1.3rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.size-select-hint {
    margin: 4px 0 14px;
    color: var(--text-light);
}

.size-select-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.size-select-option {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: #fff;
    padding: 8px 14px;
    font-size: 0.9rem;
    color: var(--text-color);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.size-select-option:hover {
    border-color: #93a8bf;
}

.size-select-option.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.size-select-qty {
    margin-bottom: 16px;
}

.size-select-label {
    display: inline-block;
    font-weight: 700;
    margin-bottom: 8px;
}

.size-select-qty-control {
    display: grid;
    grid-template-columns: 52px 1fr 52px;
    border: 1px solid #c8d5e5;
    border-radius: 14px;
    overflow: hidden;
    height: 46px;
    background: #fdfefe;
    box-shadow: none;
}

.size-select-qty-btn {
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 1.15rem;
    line-height: 1;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.size-select-qty-btn[data-qty="minus"] {
    border-right: 1px solid var(--border-color);
}

.size-select-qty-btn[data-qty="plus"] {
    border-left: 1px solid var(--border-color);
}

.size-select-qty-btn:hover {
    background: #f2f6fb;
}

.size-select-qty-input {
    border: none;
    text-align: center;
    font-weight: 700;
    font-size: 1.85rem;
    width: 100%;
    min-width: 0;
    background: transparent;
    color: var(--heading-color);
    padding: 0 !important;
    border: none !important;
}

.size-select-qty-input:focus {
    outline: none;
}

.size-select-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.size-select-confirm[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (max-width: 560px) {
    .size-select-card {
        border-radius: 14px;
        padding: 16px;
        max-height: min(88vh, 840px);
    }

    .size-select-actions {
        grid-template-columns: 1fr;
    }
}

.site-footer {
    margin-top: 90px;
    background: var(--footer);
    color: #f1dbc7;
    border-top: 1px solid rgba(255, 189, 120, 0.28);
    padding: 56px 0 22px;
}

.site-footer .footer-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 40px;
}

.site-footer .footer-brand-row h3 {
    font-size: 1.35rem;
    color: #fff4e8;
    margin: 0;
}

.site-footer .footer-brand-row p {
    margin-top: 6px;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #d6b89b;
}

.site-footer .footer-col > p {
    margin-top: 14px;
    color: #e1c4a9;
    line-height: 1.72;
    font-size: 0.92rem;
}

.site-footer .footer-col h4 {
    margin-bottom: 18px;
    font-size: 1.05rem;
    color: #fff1e1;
}

.site-footer .footer-links,
.site-footer .contact-info {
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-footer .footer-links li,
.site-footer .contact-info li {
    margin-bottom: 10px;
    color: #dfc2a7;
    font-size: 0.92rem;
}

.site-footer .footer-links a {
    color: #f0d5bd;
}

.site-footer .footer-links a:hover {
    color: #ffffff;
}

.site-footer .footer-trust {
    margin-top: 24px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 193, 126, 0.24);
}

.site-footer .footer-trust h5 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #fff4e8;
}

.site-footer .trust-logos {
    display: grid;
    gap: 12px;
    align-items: center;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.site-footer .trust-logo {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 196, 132, 0.3);
    border-radius: 999px;
    padding: 5px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    width: 100%;
}

.site-footer .trust-logo img {
    height: 30px;
    width: auto;
    display: block;
}

.site-footer .copyright {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 193, 126, 0.24);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #d2b295;
    font-size: 0.84rem;
}

.site-footer .footer-legal {
    display: flex;
    gap: 8px;
    align-items: center;
}

.site-footer .footer-legal a {
    color: #e8c8aa;
}

.site-footer .footer-legal a:hover {
    color: #ffffff;
}

@media (max-width: 1320px) {
    .nav-row {
        gap: 16px;
    }

    .brand-sub {
        display: none;
    }

    .search-box {
        --search-open-width: clamp(210px, 22vw, 280px);
    }
}

@media (max-width: 1200px) {
    .search-box {
        --search-open-width: clamp(200px, 22vw, 260px);
    }
}

@media (max-width: 900px) {
    .nav-row {
        min-height: auto;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "brand actions"
            "nav nav";
        gap: 10px 14px;
        padding: 12px 0;
    }

    .brand-mark {
        grid-area: brand;
        justify-self: start;
    }

    .brand-sub {
        display: none;
    }

    .main-nav {
        grid-area: nav;
        justify-content: flex-start;
        gap: 16px;
        overflow-x: auto;
        padding: 2px 0 4px;
    }

    .main-nav a {
        font-size: 0.93rem;
        min-height: 32px;
    }

    .main-nav::-webkit-scrollbar {
        display: none;
    }

    .nav-actions {
        grid-area: actions;
        justify-self: end;
    }

    .search-box {
        display: grid;
        width: 42px;
    }

    .search-box.active {
        width: 42px;
        grid-template-columns: 42px 0fr;
        gap: 0;
    }

    .search-box.active .search-input {
        position: absolute;
        top: calc(100% + 44px);
        right: 0;
        width: min(84vw, 320px);
    }

    .search-suggest {
        top: calc(100% + 94px);
        right: 0;
        width: min(84vw, 320px);
        max-height: min(220px, 38vh);
    }

    .floating-quick-actions {
        right: max(10px, env(safe-area-inset-right));
        bottom: calc(10px + env(safe-area-inset-bottom));
        gap: 8px;
    }

    .floating-action-btn {
        width: clamp(48px, 14vw, 54px);
        height: clamp(48px, 14vw, 54px);
        font-size: clamp(1.2rem, 5vw, 1.4rem);
    }

    .site-footer .footer-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .site-footer .copyright {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 560px) {
    .top-banner {
        font-size: 0.8rem;
    }

    .main-nav {
        gap: 12px;
    }

    .main-nav a {
        font-size: 0.88rem;
    }

    .nav-actions {
        gap: 8px;
    }

    .icon-btn {
        width: 38px;
        height: 38px;
    }
}

@media (max-width: 500px) {
    .cart-drawer {
        width: 100%;
    }
}
