:root {
    --cream: #FAF2E7;
    --dark-brown: #5D381E;
    --medium-brown: #7E5F4B;
    --gold: #EEBF69;
    --sage: #70765C;
    --white: #FFFFFF;
    --light-gray: #F8F8F8;
    --dark-gray: #333333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body { background: var(--cream); color: var(--dark-brown); }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
.container { width: 90%; max-width: 1200px; margin: 0 auto; }

header {
    background-color: var(--cream);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.main-header { padding: 12px 0; }
.header-content { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.menu-toggle { display: none; font-size: 1.2rem; cursor: pointer; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo img { height: 35px; }
.logo-text { font-size: 1.4rem; font-weight: 700; }

.search-bar { flex: 1; max-width: 440px; position: relative; display: flex; }
.search-bar input { width: 100%; border: 1px solid #ddd; border-right: none; border-radius: 6px 0 0 6px; padding: 10px; }
.search-bar button { border: 1px solid #ddd; border-left: none; border-radius: 0 6px 6px 0; padding: 0 12px; cursor: pointer; background: #fff; }

.header-icons { display: flex; gap: 12px; align-items: center; }
.header-icons a { color: var(--dark-brown); font-size: 1rem; }
.header-icons .auth-shortcut {
    font-size: .84rem;
    font-weight: 600;
    border: 1px solid var(--medium-brown);
    border-radius: 6px;
    padding: 6px 10px;
    line-height: 1;
}
.search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    max-height: 220px;
    overflow-y: auto;
    display: none;
    z-index: 1500;
}
.cart-count, .wishlist-count {
    background: var(--gold); color: var(--dark-brown); border-radius: 50%;
    font-size: 0.7rem; min-width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center;
    margin-left: 3px;
}

.nav-desktop { background: var(--white); border-top: 1px solid rgba(0,0,0,0.05); }
.nav-links { display: flex; align-items: center; gap: 18px; padding: 11px 0; flex-wrap: wrap; }
.nav-links a:hover { color: var(--gold); }
.dropdown { display: none; position: absolute; background: var(--white); border-radius: 8px; min-width: 250px; padding: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.14); }
.nav-links li { position: relative; }
.nav-links li:hover > .dropdown { display: block; }
.dropdown li { margin-bottom: 6px; }

.sidebar {
    position: fixed; top: 0; left: -100%; width: 300px; height: 100dvh; background: var(--white); z-index: 2000;
    transition: left .25s ease; overflow-y: auto; padding: 16px;
}
.sidebar.active { left: 0; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sidebar-close { cursor: pointer; font-size: 1.2rem; }
.sidebar .nav-links { flex-direction: column; align-items: flex-start; }
.sidebar .dropdown { display: block; position: static; box-shadow: none; padding: 6px 0 6px 10px; min-width: 0; }
.sidebar .nav-links > li > a { font-weight: 600; }

.hero {
    background: linear-gradient(135deg, var(--sage), var(--medium-brown));
    color: var(--cream);
    text-align: center;
    padding: 54px 0;
}
.hero h1 { font-size: clamp(1.6rem, 3.8vw, 2.4rem); margin-bottom: 10px; }
.hero p { max-width: 760px; margin: 0 auto; opacity: .95; }

.products-section { padding: 42px 0 55px; }
.section-title { text-align: center; font-size: 1.8rem; margin-bottom: 10px; }
.section-subtitle { text-align: center; color: var(--medium-brown); margin: 0 auto 24px; max-width: 760px; }

.products {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
}

.product-card {
    background-color: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid transparent;
    transition: all .3s ease;
    display: flex;
    flex-direction: column;
}
.product-card:hover { transform: translateY(-5px); border-color: var(--gold); box-shadow: 0 8px 18px rgba(0,0,0,0.16); }
.product-img { height: 180px; background: linear-gradient(135deg, var(--light-gray), var(--cream)); overflow: hidden; }
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.product-content { padding: 12px; display: flex; flex-direction: column; flex-grow: 1; }
.product-content h3 { font-size: 1.05rem; margin-bottom: 7px; line-height: 1.3; }
.price { color: var(--sage); font-weight: 700; margin-bottom: 8px; }
.old-price { text-decoration: line-through; opacity: .65; margin-right: 6px; }
.stock-info { font-size: .82rem; color: var(--medium-brown); margin-bottom: 8px; }
.product-meta { font-size: .8rem; color: var(--medium-brown); margin-top: auto; display: flex; justify-content: space-between; }
.product-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.btn { border-radius: 6px; text-align: center; padding: 9px 10px; font-size: .9rem; }
.btn-dark { background: var(--dark-brown); color: var(--cream); }
.btn-gold { background: var(--gold); color: var(--dark-brown); }

.empty-state {
    background: var(--white); border: 1px dashed rgba(93,56,30,.2); border-radius: 10px; text-align: center; padding: 30px 16px;
    color: var(--medium-brown);
}

footer { background-color: var(--dark-brown); color: var(--cream); padding: 40px 0 15px; }
.footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; margin-bottom: 20px; }
.footer-column h3 { font-size: 1.1rem; margin-bottom: 12px; }
.footer-column ul li { margin-bottom: 6px; font-size: .85rem; }
.footer-column ul li a:hover { color: var(--gold); }
.contact-details li { display: flex; gap: 6px; margin-bottom: 8px; align-items: flex-start; }
.footer-bottom { text-align: center; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.12); font-size: .8rem; }

@media (max-width: 900px) {
    .menu-toggle { display: block; }
    .nav-desktop { display: none; }
    .search-bar { max-width: 100%; }
}

@media (max-width: 768px) {
    .header-content { flex-wrap: wrap; }
    .logo { order: 2; }
    .menu-toggle { order: 1; }
    .header-icons { order: 3; margin-left: auto; }
    .search-bar { order: 4; width: 100%; }
    .products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 430px) {
    .products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .product-content h3 { font-size: .95rem; }
    .btn { font-size: .82rem; padding: 8px 8px; }
}

/* In-page checkout (collections.js) */
.btn-secondary {
    background: #6c757d;
    color: #fff;
    border: none;
}
.btn-secondary:hover { filter: brightness(1.05); }

.subpage-payment-modal {
    display: none;
    position: fixed;
    z-index: 4000;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

.subpage-payment-modal-inner {
    background: var(--white);
    margin: clamp(12px, 6vh, 48px) auto;
    padding: 16px 16px 20px;
    border-radius: 10px;
    max-width: 500px;
    width: 100%;
    position: relative;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.subpage-payment-close {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    color: var(--medium-brown);
}

.subpage-payment-title {
    color: var(--dark-brown);
    margin: 0 28px 14px 0;
    font-size: 1.25rem;
}

.subpage-pay-fields {
    margin-bottom: 14px;
    padding: 12px;
    background: var(--light-gray);
    border-radius: 8px;
}
.subpage-pay-fields h3 { font-size: 0.95rem; margin-bottom: 10px; color: var(--dark-brown); }

.subpage-form-group { margin-bottom: 10px; }
.subpage-form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--dark-brown);
}
.subpage-form-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.subpage-pay-grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.subpage-pay-summary {
    margin-bottom: 14px;
    padding: 12px;
    background: var(--light-gray);
    border-radius: 8px;
}
.subpage-pay-summary h3 { font-size: 0.95rem; margin-bottom: 8px; }
.subpage-pay-line {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.88rem;
}
.subpage-pay-total-row {
    border-top: 1px solid #ddd;
    margin-top: 10px;
    padding-top: 10px;
}

.subpage-pay-btn { width: 100%; margin-top: 10px; cursor: pointer; }

#payment-element { min-height: 220px; margin-top: 8px; }

.subpage-pay-message { margin-top: 12px; }
.subpage-pay-msg {
    padding: 10px;
    border-radius: 6px;
    font-size: 0.88rem;
}
.subpage-pay-msg--err {
    color: #c0392b;
    background: #ffeaea;
}

.payment-success-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    z-index: 4500;
}
.payment-success-overlay.active {
    display: flex;
}
.payment-success-card {
    background: #fff;
    border-radius: 10px;
    padding: 24px 20px;
    width: min(92vw, 360px);
    text-align: center;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
}
.payment-success-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    margin: 0 auto 12px;
    display: grid;
    place-items: center;
    background: #e8f8ee;
    color: #1f9d55;
    font-size: 1.6rem;
    font-weight: 700;
}
.payment-success-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark-brown);
    margin-bottom: 6px;
}
.payment-success-text {
    color: var(--medium-brown);
    font-size: 0.92rem;
}

@media (max-width: 520px) {
    .subpage-pay-grid2 { grid-template-columns: 1fr; }
}
