/* ========================================
   LOTTE COMMON STYLES
   Shared CSS for index.html & search.html
   ======================================== */

/* === FONTS === */
/* Google Fonts loaded via <link> in HTML <head> for non-blocking rendering */

/* === RESET & VARIABLES === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-red: #DA291C;
    --primary-red-hover: #BF1E2E;
    --text-color: #333333;
    --text-dark: #141416;
    --text-gray: #666666;
    --border-color: #e0e0e0;
    --bg-neutral: #f8f9fa;
    --bg-gray: #f5f5f5;
    --white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    color: var(--text-dark);
    background-color: var(--white);
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

/* === LAYOUT === */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 15px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col-lg-2,
.col-lg-3,
.col-lg-4 {
    padding: 0 15px;
    flex: 1;
}

.col-lg-2 {
    max-width: 16.66%;
}

.col-lg-3 {
    max-width: 25%;
}

.col-lg-4 {
    max-width: 33.33%;
}

@media (max-width: 992px) {

    .col-lg-2,
    .col-lg-3,
    .col-lg-4 {
        max-width: 100%;
    }
}

/* === HEADER === */
.header-top {
    background: var(--white);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 2px solid var(--primary-red);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.header-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.logo-box {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.logo-img {
    height: 23px;
    width: auto;
    min-width: 100px;
    display: block;
}

/* === LOCATION SELECT === */
.location-select {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    position: relative;
}

.location-select span {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-dark);
}

.location-select-icon {
    width: 16px;
    height: 16px;
    border: 1px solid #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.location-select-icon svg {
    width: 6px;
    height: 6px;
}

/* === STORE DROPDOWN === */
.store-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1001;
    margin-top: 8px;
}

.store-dropdown.show {
    display: block;
}

.store-dropdown-item {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.store-dropdown-item:last-child {
    border-bottom: none;
}

.store-dropdown-item:hover {
    background: #f8f9fa;
}

.store-dropdown-item.active {
    background: #fff0f0;
    color: var(--primary-red);
    font-weight: 600;
}

.store-region-group {
    padding: 5px 0;
}

.store-region-label {
    padding: 8px 15px 4px;
    font-size: 12px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
}

/* === SEARCH === */
.search-container {
    flex: 1;
    max-width: 600px;
    position: relative;
}

.search-input-wrapper {
    display: flex;
    width: 100%;
    height: 45px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-neutral);
    align-items: center;
}

.search-input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    background: transparent;
    font-size: 16px;
    outline: none;
}

.search-input:focus {
    background-color: var(--white);
}

.search-btn {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-gray);
    background: transparent;
    flex-shrink: 0;
}

.search-btn:hover {
    color: var(--primary-red);
}

.search-btn:last-child {
    margin-right: 6px;
}

/* === SEARCH DROPDOWN === */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    margin-top: 2px;
    max-height: 500px;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}

.search-dropdown.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.search-dropdown .inner {
    padding: 20px;
}

.s-block-cols {
    display: flex;
    gap: 30px;
}

.s-block-cols .item {
    flex: 1;
}

.s-block-cols .item.first {
    border-right: 1px solid var(--border-color);
    padding-right: 20px;
}

.s-block-cols .item.last {
    padding-left: 20px;
}

@media (max-width: 768px) {
    .s-block-cols {
        flex-direction: column;
        gap: 20px;
    }

    .s-block-cols .item.first {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 20px;
    }

    .s-block-cols .item.last {
        padding-left: 0;
    }

    .search-dropdown .inner {
        padding: 15px;
    }
}

.s-block h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 15px;
}

.s-block.kw-list.ps-4m {
    padding-left: 1rem;
}

/* === KEYWORD LISTS === */
.top-kw {
    list-style: none;
    padding: 0;
    margin: 0;
}

.top-kw li {
    margin-bottom: 10px;
}

.top-kw li:last-child {
    margin-bottom: 0;
}

.top-kw a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-dark);
    transition: color 0.2s;
}

.top-kw a:hover {
    color: var(--primary-red);
}

.top-kw .number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-gray);
}

.top-kw .txt {
    flex: 1;
    font-size: 15px;
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history-list li {
    margin-bottom: 0;
}

.history-list a {
    display: block;
    color: var(--text-dark);
    padding: 8px 0;
    font-size: 15px;
    transition: color 0.2s;
}

.history-list a:hover {
    color: var(--primary-red);
}

.history-list.empty {
    color: var(--text-gray);
    font-size: 14px;
    font-style: italic;
}

/* === HEADER ACTIONS === */
.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.action-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--primary-red);
    color: white;
    font-size: 10px;
    font-weight: bold;
    height: 16px;
    width: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* === LANGUAGE SELECTOR === */
.lang-selector {
    position: relative;
    gap: 2px;
}

.lang-selector img {
    border-radius: 50%;
    object-fit: cover;
}

.lang-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    z-index: 1002;
    overflow: hidden;
}

.lang-selector.open .lang-dropdown {
    display: block;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background 0.15s;
}

.lang-option:hover {
    background: #f8f9fa;
}

.lang-option img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.lang-option .lang-check {
    margin-left: auto;
    color: var(--primary-red);
    font-weight: 700;
    display: none;
}

.lang-option.active .lang-check {
    display: inline;
}

.lang-option.active {
    color: var(--primary-red);
    font-weight: 500;
}

/* === FOOTER === */
.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
    font-size: 15px;
    color: #666;
}

.footer-links a {
    font-size: 16px;
    color: var(--text-gray);
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary-red);
}

.footer-bottom {
    padding-top: 30px;
    border-top: 1px solid #eee;
    text-align: center;
}

.footer-info {
    font-size: 14px;
    color: var(--text-gray);
    line-height: 1.8;
    margin-bottom: 15px;
}

.copyright {
    font-size: 12px;
    color: #aaa;
    font-style: italic;
}

/* === UTILITIES === */
.mb-2 {
    margin-bottom: 0.5rem !important;
}

.mb-3 {
    margin-bottom: 12px !important;
}

.mb-4m {
    margin-bottom: 15px !important;
}

dl,
ol,
ul {
    margin-top: 0;
    margin-bottom: 0;
}

/* ========================================
   SEARCH PAGE SPECIFIC STYLES
   ======================================== */

body.search-page {
    font-size: 16px;
}

.search-input {
    line-height: 1.5;
    height: 100%;
}

.search-btn.clear-btn {
    background: #e0e0e0;
    border-radius: 50%;
    color: #333;
    width: 24px;
    height: 24px;
}

.search-btn.clear-btn:hover {
    background: #d0d0d0;
}

.store-dropdown-header {
    padding: 10px 15px;
    font-weight: 600;
    font-size: 13px;
    color: #666;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

/* BREADCRUMB */
.breadcrumb-area {
    padding: 15px 0;
    color: var(--text-gray);
    font-size: 14px;
}

.breadcrumb-area a {
    color: var(--text-gray);
}

.breadcrumb-area a:hover {
    color: var(--primary-red);
}

/* SEARCH TITLE */
.clear-filters-btn {
    width: 80%;
    padding: 10px;
    margin-bottom: 20px;
    background: var(--primary-red);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    display: none;
}

.search-title-block {
    text-align: center;
    padding: 20px 0 40px;
}

.search-title-block h1 {
    font-size: 28px;
    font-weight: 400;
    color: #000;
}

.search-title-block span.query {
    color: var(--primary-red);
    font-weight: 600;
}

/* MAIN CONTENT */
.main-content {
    display: flex;
    gap: 30px;
    margin-bottom: 60px;
    position: relative;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    align-self: flex-start;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.filter-group {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.filter-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #000;
}

.filter-list {
    list-style: none;
    padding-left: 0;
}

.filter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 16px;
    color: #333;
    cursor: pointer;
    transition: color 0.2s, font-weight 0.2s;
}

.filter-item:hover {
    color: var(--primary-red);
}

.filter-item.active {
    color: var(--primary-red);
    font-weight: 600;
}

.filter-count {
    color: #999;
    font-size: 15px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    cursor: pointer;
}

.checkbox-item input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-red);
}

.checkbox-label {
    font-size: 16px;
    color: #333;
}

.star-rating {
    color: #ffbc00;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* RESULTS AREA */
.results-column {
    flex: 1;
    position: relative;
}

.results-header-bar {
    display: none;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.results-header-bar.show {
    display: flex;
}

.results-count {
    font-size: 16px;
    color: #333;
    display: none;
}

.results-count.show {
    display: block;
}

#productCount {
    font-size: 22px;
    font-weight: 600;
    color: var(--primary-red);
}

.sort-select-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    background: #fff;
}

.view-switch {
    display: flex;
    gap: 10px;
}

.view-btn {
    padding: 5px;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 4px;
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn.active {
    opacity: 1;
    border-color: #ddd;
    background: #f9f9f9;
}

/* PRODUCT GRID */
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    min-height: 600px;
    align-items: start;
    position: relative;
}

.product-card {
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    position: relative;
    transition: all 0.2s;
    overflow: hidden;
    background: #fff;
    height: fit-content;
}

.product-card:hover {
    border-color: #ddd;
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.product-card.out-of-stock::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    z-index: 1;
    pointer-events: none;
}

.p-image-box {
    width: 100%;
    aspect-ratio: 1;
    position: relative;
    background: #fff;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.p-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.btn-add-cart {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-red);
    box-shadow: var(--shadow-sm);
    z-index: 2;
}

.btn-add-cart:hover {
    background: var(--primary-red);
    color: #fff;
}

.p-info {
    padding: 15px;
    border-top: 1px solid #f9f9f9;
}

.p-name {
    font-size: 16px;
    font-weight: 400;
    margin-bottom: 8px;
    height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 20px;
}

.p-discount-desc {
    margin-top: 8px;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    transition: background 0.2s;
}

.p-discount-desc:hover {
    background: #f9f9f9;
}

.p-discount-desc .arrow {
    color: #999;
    font-size: 16px;
    margin-left: 5px;
}

.p-price-old {
    color: #999;
    text-decoration: line-through;
    font-size: 13px;
    margin-bottom: 4px;
    display: block;
    height: 18px;
}

.p-price-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.p-discount {
    color: var(--primary-red);
    font-weight: 700;
    font-size: 16px;
}

.p-price {
    font-size: 20px;
    font-weight: 700;
    color: #000;
}

.p-stars {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

.p-stars .icon {
    color: #ffbc00;
    font-size: 11px;
}

/* SEARCH PAGE FOOTER */
footer {
    background-color: #f5f5f5;
    border-top: 1px solid #eee;
    padding: 50px 0 30px;
    margin-top: 50px;
}

.footer-top {
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 40px;
    margin-bottom: 30px;
}

.footer-logo {
    margin-bottom: 25px;
}

.footer-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #333;
}

.footer-social {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
}

/* VARIANT BADGES */
.variant-badges-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
    min-height: 0;
}

.variant-badges-bar:empty {
    display: none;
}

.variant-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 12px;
    color: #666;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    white-space: nowrap;
}

.variant-badge:hover {
    border-color: #ccc;
    color: #333;
    background: #eee;
}

.variant-badge.active {
    border-color: var(--primary-red);
    color: var(--primary-red);
    background: #fff5f5;
    font-weight: 500;
}

.variant-badge .vb-count {
    font-size: 10px;
    color: #999;
    margin-left: 1px;
}

.variant-badge.active .vb-count {
    color: var(--primary-red);
    opacity: 0.7;
}

/* LOADING */
.search-loading-full {
    grid-column: 1 / -1;
    position: absolute;
    left: calc(-260px - 30px);
    right: 0;
    width: calc(100% + 260px + 30px);
    padding: 100px 0;
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}