:root {
    --primary: #d8a07e;
}

/* Site max-width constraint */
body {
    max-width: 4000px;
    margin: 0 auto;
}

header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 20px;
    background-color: rgba(216, 160, 126, 0.1);
    border-bottom: none;
    margin-bottom: 0;
    margin: 0 auto;
    width: 100%;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 59px;
    margin: 0 auto;
    width: 100%;
}

.logo-desktop {
    height: 60px;
    flex-shrink: 0;
    display: block;
}

.logo-mobile {
    height: 50px;
    flex-shrink: 0;
    display: none;
}

.search-bar {
    display: flex;
    align-items: center;
    max-width: 200px;
    border: 1px solid #ced4da;
    border-radius: 20px;
    padding: 8px 12px;
    background-color: white;
}

.search-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
}

.search-bar input {
    border: none;
    outline: none;
    flex: 1;
    padding: 0;
    background: transparent;
    font-size: 16px;
    max-width: 165px;
}

.search-bar input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    display: none;
}

.search-bar input::-moz-search-cancel-button {
    display: none;
}

nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 10px;
}

nav a {
    text-decoration: none;
    color: #d8a07e;
    font-weight: bold;
    padding: 8px 12px;
    border-radius: 4px;
    border-bottom: none;
    transition: border-bottom 0.3s;
}

nav a:hover {
    border-bottom: 2px solid #d8a07e;
}

.cart-desktop {
    height: 70px;
    cursor: pointer;
    flex-shrink: 0;
    display: block;
    padding-right: 20px;
}

.cart-mobile {
    height: 50px;
    cursor: pointer;
    flex-shrink: 0;
    display: none;
}

.mobile-hamburger {
    display: none;
    cursor: pointer;
    color: #d8a07e;
}

.hamburger-icon {
    display: inline-block;
    vertical-align: middle;
}

.mobile-menu-icon-img {
    display: none;
    vertical-align: middle;
    width: 32px;
    height: auto;
}

.hamburger-icon {
    vertical-align: middle;
}

@media (max-width: 768px) {
    header {
        padding: 10px 20px;
        position: static;
        width: auto;
        height: auto;
        z-index: auto;
        box-sizing: border-box;
    }

    .header-content {
        position: static;
        justify-content: space-between;
        gap: 0;
        align-items: center;
        width: 100%;
        height: auto;
    }

    .mobile-hamburger {
        display: block;
        position: static;
        z-index: auto;
    }

    .mobile-hamburger .hamburger-icon {
        display: none !important;
    }

    .mobile-hamburger .mobile-menu-icon-img {
        display: inline-block !important;
        height: 50px;
        width: auto;
    }

    .logo-desktop {
        display: none !important;
    }

    .logo-mobile {
        display: block !important;
        position: static;
        left: auto;
        top: auto;
        transform: none;
        margin: 0;
    }

    .search-bar,
    nav {
        display: none;
    }

    .cart-desktop {
        display: none !important;
    }

    .cart-mobile {
        display: block !important;
        position: static;
        right: auto;
        top: auto;
        transform: none;
    }

  main {
    padding-top: 0;
  }
}

@media (min-width: 769px) and (max-width: 1085px) {
    nav {
        display: none;
    }

    .header-content {
        justify-content: space-between;
        gap: 20px;
    }

    .search-bar {
        margin: 0 auto;
        flex-grow: 1;
        max-width: 300px;
    }
}

/* Cart Modal Styles */
.cart-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 50%;
    top: 0;
    width: 100%;
    height: 100%;
    max-width: 2000px;
    transform: translateX(-50%);
    background-color: transparent;
    padding: 20px;
    box-sizing: border-box;
}

.cart-modal-content {
    position: absolute;
    background-color: #fff;
    width: 320px;
    height: 560px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    top: 80px;
    right: 20px;
    transform: scaleY(0);
    transform-origin: top;
    opacity: 0;
    transition: all 0.4s ease-out;
}

.cart-modal.show .cart-modal-content {
    transform: scaleY(1);
    opacity: 1;
}

.cart-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e1e4e8;
    border-radius: 20px 20px 0 0;
    background: #fafafa;
}

.cart-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2328;
}

.cart-modal-close {
    color: #666;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.cart-modal-close:hover {
    color: #000;
}

.cart-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-top: 15px;
}

.cart-modal-body .cart-container {
    flex: 1;
    margin-bottom: 16px;
    overflow-x: hidden;
    overflow-y: auto;
    background: transparent;
    border-radius: 0;
}

/* Custom scrollbar styling */
.cart-modal-body .cart-container::-webkit-scrollbar {
    width: 6px;
}

.cart-modal-body .cart-container::-webkit-scrollbar-track {
    background: rgba(241, 241, 241, 0.5);
    border-radius: 10px;
}

.cart-modal-body .cart-container::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, var(--primary, #d8a07e), #c18e64);
    border-radius: 10px;
}

.cart-modal-body .cart-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #c18e64, #aa7c58);
}

.cart-modal-body .cart-empty {
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* Modal cart items - based on mobile styles from cart.css */
.cart-modal-body .cart-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.cart-modal-body .cart-item {
    display: grid;
    grid-template-columns: 56px 1fr auto auto auto;
    column-gap: 8px;
    row-gap: 6px;
    align-items: center;
    padding: 6px 6px;
    border-radius: 8px;
    border: 1px solid #f1f1f1;
    background: #fafafa;
}

.cart-modal-body .cart-item img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    grid-column: 1;
    grid-row: 1;
}

.cart-modal-body .cart-item .ci-col--info {
    grid-column: 2 / -1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.cart-modal-body .cart-item .ci-title {
    font-weight: 600;
    color: #1f2328;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    line-height: 1.2;
}

.cart-modal-body .cart-item .ci-title:hover {
    text-decoration: underline;
}

.cart-modal-body .cart-item .ci-code {
    color: #8a7a6a;
    font-size: 11px;
}

.cart-modal-body .cart-item .ci-col--unit {
    grid-column: 3;
    grid-row: 2;
    font-weight: 600;
    white-space: nowrap;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.cart-modal-body .cart-item .ci-col--qty {
    grid-column: 4;
    grid-row: 2;
    display: flex;
    align-items: center;
    gap: 4px;
}

.cart-modal-body .cart-item .ci-qty {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 6px;
    padding: 1px;
}

.cart-modal-body .cart-item .ci-qty-input {
    width: 32px;
    padding: 2px 3px;
    border-radius: 4px;
    border: 1px solid #ddd;
    text-align: center;
    font-size: 11px;
    appearance: textfield; /* Standard */
    -moz-appearance: textfield; /* Firefox */
}

/* Hide number input arrows/spinners */
.cart-modal-body .cart-item .ci-qty-input::-webkit-outer-spin-button,
.cart-modal-body .cart-item .ci-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-modal-body .cart-item .ci-qty-btn {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
}

.cart-modal-body .cart-item .ci-col--total {
    grid-column: 5;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.cart-modal-body .cart-item .ci-price {
    font-weight: 700;
    white-space: nowrap;
    font-size: 12px;
}

.cart-modal-body .cart-item .ci-remove {
    background: transparent;
    border: none;
    color: #b00;
    cursor: pointer;
    font-size: 14px;
    padding: 3px;
}

.cart-modal-body .cart-summary {
    display: flex;
    justify-content: flex-end;
    padding: 12px 0 0;
    font-size: 16px;
    font-weight: 700;
    border-top: 1px solid #e1e4e8;
    margin-top: 12px;
}

.cart-modal-summary {
    padding: 12px 20px;
    background: #fafafa;
    border-top: 1px solid #e1e4e8;
    font-size: 16px;
    font-weight: 700;
    text-align: right;
    flex-shrink: 0;
}

.cart-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-left: 16px;
    padding-bottom: 12px;
}

.cart-modal-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-size: 13px;
    max-width: 260px;
}

.cart-modal-actions .btn-primary {
    background: linear-gradient(90deg, var(--primary, #d8a07e), #c18e64);
    color: #fff;
    box-shadow: 0 6px 18px rgba(16, 24, 40, 0.06);
}

.cart-modal-actions .btn-secondary {
    background: #fff;
    color: #1f2328;
    border: 1px solid #c59168;
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.04);
}

/* Mobile responsive for cart modal */
@media (max-width: 768px) {
    .cart-modal-content {
        position: absolute;
        top: 70px;
        right: 10px;
        left: auto;
        transform: scaleY(0);
        transform-origin: top right;
        margin: 0;
        opacity: 0;
        width: 300px;
        height: 500px;
    }
    
    .cart-modal.show .cart-modal-content {
        transform: scaleY(1);
        opacity: 1;
    }
    .cart-modal-actions {
        padding-left: 7px;
    }    
}

/* Large screens - modal opens to the left of cart */
@media (min-width: 1200px) {
    .cart-modal-content {
        right: auto;
        left: calc(100% - 420px);
        transform-origin: top left;
    }
    
    .cart-modal.show .cart-modal-content {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* Search Autocomplete Dropdown */
.search-dropdown {
    /* Positioning is controlled by JS to match the input width and left offset */
    background: #fff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    max-height: 400px;
    overflow-y: auto;
    z-index: 9999;
    transition: opacity 120ms ease, transform 120ms ease;
    font-family: inherit;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 10px;
    cursor: pointer;
}

.search-result-item + .search-result-item { /* remove separator line */ border-top: none; }
.search-result-item:hover { background: rgba(0,0,0,0.03); }
.search-result-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.search-result-item .title { font-size: 14px; color: #111; line-height: 1.2; max-width: calc(100% - 120px); }
.search-result-item .price { margin-left: auto; font-weight: 700; color: #111; white-space: nowrap; }

.search-result-item img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.search-result-item .search-item-info {
    flex: 1;
    min-width: 0;
}

.search-result-item .search-item-name {
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-item .search-item-price {
    color: #d8a07e;
    font-weight: 600;
}

/* Ensure links inside the dropdown have no underline and inherit color */
.search-dropdown a,
.search-dropdown a:link,
.search-dropdown a:visited {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
}

/* Remove underline on hover/focus as well */
.search-dropdown a:hover,
.search-dropdown a:focus {
    text-decoration: none;
}
@media (min-width: 769px) and (max-width: 1085px){
.cart-desktop {
    padding-right: 40px;
}
}
/* Mobile adjustments */
@media (max-width: 768px) {
    .search-dropdown {
        max-height: 300px;
    }
    
    .search-result-item {
        padding: 10px 12px;
    }
    
    .search-result-item img {
        width: 40px;
        height: 40px;
    }
}