/**
 * Shopify Integration Styles
 * Extends qatarshoes theme with dynamic product styling
 */

/* Google Font - Inter loaded via preconnect in functions.php for better performance */

/* ============================================
   PRODUCT GRID
   ============================================ */

.product-grid-container {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-gap: 1px;
    background: #E0DCD3;
    border: 1px solid #E0DCD3;
}

@media (max-width: 1023px) {
    .product-grid-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .product-grid-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ============================================
   PRODUCT CARD
   ============================================ */

.product-card {
    align-items: center;
    background-color: #FFFFFF;
    color: inherit;
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: space-between;
    line-height: 2em;
    padding: 15px;
    text-decoration: none;
    transition: box-shadow 0.2s ease;
}

.product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

@media (min-width: 1024px) {
    .product-card {
        padding: 30px 32px;
    }
}

/* Image Container */
.image-container {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: flex-start;  /* Align to top, not center */
    position: relative;
    width: 100%;
}

/* Sold Out Badge - Lines above and below text */
.sold-out-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;

    /* transparent background with flex layout for pseudo-elements */
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
    border: none;
    padding: 0;

    /* text */
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #1d1d1d;
    text-align: center;
    white-space: nowrap;

    /* rendering */
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Top line */
.sold-out-badge::before {
    content: '';
    display: block;
    width: 100%;
    height: 1.5px;
    background-color: #1d1d1d;
    margin-bottom: 6px;
}

/* Bottom line */
.sold-out-badge::after {
    content: '';
    display: block;
    width: 100%;
    height: 1.5px;
    background-color: #1d1d1d;
    margin-top: 6px;
}

@media (max-width: 1023px) {
    .sold-out-badge {
        font-size: 10px;
        top: 5px;
        left: 5px;
        letter-spacing: 1.5px;
    }
    .sold-out-badge::before,
    .sold-out-badge::after {
        height: 1px;
        margin-bottom: 4px;
        margin-top: 4px;
    }
    .sold-out-badge::before {
        margin-bottom: 4px;
    }
    .sold-out-badge::after {
        margin-top: 4px;
    }
}

/* Low stock badge - similar to sold out but with warning color */
.low-stock-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;

    /* look */
    display: inline-block;
    background: #fff4e5;
    border: 2px solid #e67700;
    border-radius: 0;

    /* spacing */
    padding: 7px 11px 10px;

    /* text */
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 400;
    font-style: normal;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #e67700;
    text-align: center;
    white-space: nowrap;

    /* rendering */
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media (max-width: 1023px) {
    .low-stock-badge {
        font-size: 10px;
        padding: 4px 6px;
        letter-spacing: 0.5px;
    }
}

/* Location-specific sold out overlay for product cards */
.product-card.location-sold-out .product-card-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

/* Size option low-stock indicator in variant modal */
.size-option.low-stock {
    position: relative;
}

.size-option.low-stock::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: #e67700;
    border-radius: 50%;
}

/* Responsive image sizing - fills container width, maintains aspect ratio */
.image-container img {
    width: 100%;
    height: auto;
    aspect-ratio: 2/3;
    object-fit: contain;
    margin: 0;
}

/* Text Wrapper */
.text-wrapper {
    align-self: start;
    width: 100%;
}

.vertical-spacer {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.jsx-181079620.vertical-spacer,
.jsx-957240164.vertical-spacer {
    height: 5px;
}

@media (max-width: 1023px) {
    .jsx-181079620.vertical-spacer {
        height: 21px;
    }
}

.product-card .brand {
    font-family: 'ITC Garamond', 'Garamond', 'Baskerville', serif;
    font-size: 22px;
    line-height: 28px;
}

@media (min-width: 1024px) {
    .product-card .brand {
        font-size: 28px;
        line-height: 28px;
    }
}

.product-card .model {
    font-size: 12px;
    line-height: 18px;
    color: #666;
}

/* Price */
.price-container {
    margin-top: 10px;
}

.price-container .price {
    font-size: 14px;
    font-weight: 600;
}

.price-container .price.has-discount {
    color: #f25c5e;
}

.price-container .compare-price {
    text-decoration: line-through;
    color: #999;
    font-size: 12px;
    margin-left: 8px;
}

/* ============================================
   LOADING PLACEHOLDERS
   ============================================ */

.placeholder-card {
    background: #fff;
    padding: 15px;
}

.placeholder-card .image {
    width: 100%;
    height: 330px;
    background: #f5f5f5;
    margin-bottom: 15px;
}

@media (max-width: 1023px) {
    .placeholder-card .image {
        height: 196px;
    }
}

.placeholder-card .info > div {
    height: 16px;
    background: #f5f5f5;
    margin-bottom: 8px;
    border-radius: 4px;
}

.placeholder-card .brand {
    width: 60%;
    height: 24px !important;
}

.placeholder-card .model {
    width: 80%;
}

.placeholder-card .price {
    width: 40%;
}

/* Shimmer Animation */
.global-shimmer-animate {
    background: linear-gradient(90deg, #f5f5f5 25%, #e8e8e8 50%, #f5f5f5 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   FILTERS SIDEBAR
   ============================================ */

.filters-sidebar {
    width: 280px;
    padding: 20px;
    background: #fff;
    border-right: 1px solid #e5e5e5;
}

@media (max-width: 1023px) {
    .filters-sidebar {
        display: none;
    }

    .filters-sidebar.mobile-open {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1000;
        overflow-y: auto;
    }
}

.filter-section {
    margin-bottom: 25px;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 20px;
}

.filter-section-title {
    font-family: 'Maison Neue Book', sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-options {
    max-height: 200px;
    overflow-y: auto;
}

.filter-option {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
}

.filter-option input[type="checkbox"] {
    margin-right: 10px;
    width: 16px;
    height: 16px;
}

.filter-option label {
    font-size: 14px;
    color: #333;
    cursor: pointer;
}

.filter-option .count {
    color: #999;
    font-size: 12px;
    margin-left: auto;
}

/* Sort Dropdown */
.sort-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.sort-container label {
    font-size: 14px;
    color: #666;
}

.sort-container select {
    padding: 8px 30px 8px 12px;
    font-size: 14px;
    border: 1px solid #e5e5e5;
    background: #fff;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* ============================================
   CART PAGE
   ============================================ */

.cart-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.cart-page h1 {
    font-family: 'ITC Garamond', serif;
    font-size: 32px;
    margin-bottom: 30px;
}

.cart-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 40px;
}

@media (max-width: 768px) {
    .cart-container {
        grid-template-columns: 1fr;
    }
}

/* Cart Summary */
#cart-summary {
    background: #f8f8f8;
    padding: 30px;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 14px;
}

.summary-row.total {
    border-top: 1px solid #e5e5e5;
    margin-top: 15px;
    padding-top: 20px;
    font-size: 18px;
    font-weight: 600;
}

.checkout-btn {
    width: 100%;
    padding: 18px;
    background: #2d1f1f;
    color: white;
    border: none;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    margin-top: 20px;
    transition: background 0.2s;
}

.checkout-btn:hover {
    background: #1a1212;
}

.checkout-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ============================================
   PRODUCT DETAIL PAGE
   ============================================ */

.product-detail-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.product-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .product-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* Product Gallery */
#product-gallery {
    display: flex;
    gap: 20px;
}

.product-thumbnails {
    width: 80px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-thumbnails img {
    width: 100%;
    height: auto;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.product-thumbnails img.active,
.product-thumbnails img:hover {
    border-color: #2d1f1f;
}

.product-main-image {
    flex: 1;
}

.product-main-image img {
    width: 100%;
    height: auto;
    max-height: 700px;
    object-fit: contain;
}

/* Product Info */
#product-info .vendor {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    margin-bottom: 10px;
}

#product-info .title {
    font-family: 'ITC Garamond', serif;
    font-size: 32px;
    line-height: 1.2;
    margin-bottom: 20px;
}

#product-info .price {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 30px;
}

#product-info .price.sale {
    color: #f25c5e;
}

#product-info .compare-price {
    text-decoration: line-through;
    color: #999;
    font-size: 18px;
    margin-left: 10px;
}

/* Size Selector */
#size-selector {
    margin: 30px 0;
}

.size-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.size-option {
    min-width: 50px;
    padding: 12px 20px;
    border: 1px solid #e5e5e5;
    background: #fff;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.size-option:hover {
    border-color: #2d1f1f;
}

.size-option.selected {
    background: #2d1f1f;
    color: #fff;
    border-color: #2d1f1f;
}

.size-option.unavailable {
    opacity: 0.4;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* Add to Cart Button */
#add-to-cart {
    width: 100%;
    padding: 18px;
    background: #2d1f1f;
    color: white;
    border: none;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.2s;
}

#add-to-cart:hover:not(:disabled) {
    background: #1a1212;
}

#add-to-cart:disabled {
    background: #e5e5e5;
    color: #999;
    cursor: not-allowed;
}

/* Product Description */
#product-description {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #e5e5e5;
}

#product-description h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

#product-description p {
    font-size: 14px;
    line-height: 1.8;
    color: #666;
}

/* ============================================
   NOTIFICATIONS
   ============================================ */

.cart-notification {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   BREADCRUMBS
   ============================================ */

.breadcrumbs {
    font-size: 12px;
    color: #666;
    padding: 15px 0;
}

.breadcrumbs a {
    color: #666;
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumbs span {
    margin: 0 8px;
}

/* ============================================
   ERROR STATE
   ============================================ */

.error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: #fff;
}

.error-message p {
    font-size: 18px;
    color: #2d1f1f;
    margin-bottom: 20px;
}

.error-message button {
    padding: 12px 30px;
    background: #2d1f1f;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

/* ============================================
   EMPTY CART
   ============================================ */

.empty-cart {
    text-align: center;
    padding: 80px 20px;
}

.empty-cart h2 {
    font-family: 'ITC Garamond', serif;
    font-size: 28px;
    margin-top: 20px;
}

.empty-cart p {
    color: #666;
    margin-top: 10px;
}

.continue-shopping {
    display: inline-block;
    margin-top: 30px;
    padding: 15px 40px;
    background: #2d1f1f;
    color: white;
    text-decoration: none;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.continue-shopping:hover {
    background: #1a1212;
}

/* ============================================
   COLOR SWATCHES
   Displays color variants in product grid
   ============================================ */

.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    padding: 0 2px;
    justify-content: center;
}

.color-swatch {
    width: 18px;
    height: 18px;
    border: 1px solid #d0d0d0;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    flex-shrink: 0;
}

.color-swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.color-swatch.active {
    border: 2px solid #2d1f1f;
    box-shadow: 0 0 0 1px rgba(45, 31, 31, 0.2);
}

/* White and light colors need visible border */
.color-swatch[data-color="white"],
.color-swatch[data-color="cream"],
.color-swatch[data-color="ivory"],
.color-swatch[data-color="beige"],
.color-swatch[data-color="nude"] {
    border: 1px solid #bbb;
}

.color-swatch[data-color="white"].active,
.color-swatch[data-color="cream"].active,
.color-swatch[data-color="ivory"].active,
.color-swatch[data-color="beige"].active,
.color-swatch[data-color="nude"].active {
    border: 2px solid #2d1f1f;
}

/* Mobile responsive */
@media (max-width: 1023px) {
    .color-swatches {
        gap: 5px;
        margin-top: 8px;
    }

    .color-swatch {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .color-swatches {
        gap: 4px;
        margin-top: 6px;
    }

    .color-swatch {
        width: 14px;
        height: 14px;
    }
}
