/**
 * Shop Page Size Fixes & Readability Improvements
 * Fixes sizing bugs and improves UI/UX
 */

/* ============================================
   SHIPPING BADGES ON PRODUCT CARDS
   ============================================ */
.product-card .shipping-badges {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.product-card .shipping-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.product-card .domestic-badge {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.product-card .worldwide-badge {
    background: #fce7f3;
    color: #be185d;
    border: 1px solid #f9a8d4;
}

/* ============================================
   PRODUCT CARD SIZE FIXES
   ============================================ */
.product-card {
    max-width: 100%;
    height: auto;
}

/* Mobile 2-Column Grid Layout */
@media (max-width: 768px) {
    .products-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    .product-card {
        width: 100%;
    }
    
    .product-card-image {
        padding-top: 100%;
    }
    
    .product-card-body {
        padding: 12px;
    }
    
    .product-card-title {
        font-size: 14px;
        min-height: 38px;
    }
    
    .product-card-category {
        font-size: 10px;
    }
    
    .product-card-meta {
        font-size: 11px;
    }
}

.product-card-image {
    padding-top: 100%; /* Maintain 1:1 ratio */
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

.product-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Changed from cover to contain */
    padding: 15px; /* Add padding around product image */
}

/* ============================================
   IMPROVED TEXT READABILITY
   ============================================ */
.product-card-category {
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.product-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 10px;
    line-height: 1.4;
    min-height: 44px; /* Ensure consistent height */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #6b7280;
}

.product-card-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.product-card-price-current {
    font-size: 24px;
    font-weight: 700;
    color: #d4af37;
}

.product-card-price-original {
    font-size: 16px;
    color: #9ca3af;
    text-decoration: line-through;
}

.product-card-discount {
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
    background: #FF0000;
    padding: 2px 8px;
    border-radius: 4px;
}

/* ============================================
   BUTTON SIZE FIXES
   ============================================ */
.product-card-body .btn {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.product-card-body .btn-secondary {
    background: #ffffff;
    color: #1f2937;
    border: 2px solid #e5e7eb;
}

.product-card-body .btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.product-card-body .btn-primary {
    background: linear-gradient(135deg, #d4af37 0%, #c5a028 100%);
    color: #ffffff;
    border: none;
}

.product-card-body .btn-primary:hover {
    background: linear-gradient(135deg, #c5a028 0%, #b69121 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

/* ============================================
   FILTER SIDEBAR IMPROVEMENTS
   ============================================ */
.shop-filters {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

.shop-filters-title {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
}

.shop-filters-clear {
    font-size: 13px;
    font-weight: 600;
    color: #d4af37;
    background: none;
    border: none;
    cursor: pointer;
}

.filter-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
}

.filter-label {
    font-size: 14px;
    font-weight: 500;
    color: #4b5563;
}

.filter-count {
    font-size: 12px;
    color: #9ca3af;
}

/* ============================================
   SHOP HEADER IMPROVEMENTS
   ============================================ */
.shop-header {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
    border: 1px solid #e5e7eb;
}

.shop-title {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.shop-results-count {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.shop-search-input {
    padding: 12px 16px 12px 44px;
    font-size: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    color: #1f2937;
    background: #ffffff;
}

.shop-search-input:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.shop-sort-select {
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    color: #1f2937;
}

/* ============================================
   INSPIRATION CARD FIX
   ============================================ */
.card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

.card h4 {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 10px;
}

.card p {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 16px;
    line-height: 1.5;
}

/* Default card buttons (global) */
.card .btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
}

/* Inspiration banner button inside shop filters sidebar */
.shop-filters .card .btn-primary.btn-sm.btn-block {
    display: block !important;          /* override inline-flex from .btn */
    white-space: normal !important;     /* allow wrapping */
    word-wrap: break-word !important;   /* break long words if needed */
    line-height: 1.4 !important;
    text-align: center !important;
}

/* Also handle any inner span that may be wrapped by other button utilities */
.shop-filters .card .btn-primary.btn-sm.btn-block span {
    display: inline !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

/* ============================================
   GRID LAYOUT FIXES
   ============================================ */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

@media (min-width: 640px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   BREADCRUMB IMPROVEMENTS
   ============================================ */
.shop-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 14px;
}

.breadcrumb-item {
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb-item:hover {
    color: #d4af37;
}

.breadcrumb-item.active {
    color: #1f2937;
    font-weight: 600;
}

.breadcrumb-separator {
    color: #d1d5db;
}

/* ============================================
   MOBILE FILTER BUTTON
   ============================================ */
.shop-filters-mobile-toggle {
    position: fixed;
    bottom: 24px;
    left: 24px; /* Moved to left side to avoid overlap with chatbot */
    right: auto;
    padding: 14px 24px;
    background: linear-gradient(135deg, #d4af37 0%, #c5a028 100%);
    color: #ffffff;
    border: none;
    border-radius: 50px;
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.4);
    cursor: pointer;
    z-index: 998;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
}

@media (min-width: 1024px) {
    .shop-filters-mobile-toggle {
        display: none;
    }
}

/* ============================================
   EMPTY STATE IMPROVEMENTS
   ============================================ */
.shop-empty {
    text-align: center;
    padding: 60px 40px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.shop-empty-icon {
    font-size: 64px;
    color: #d1d5db;
    margin-bottom: 24px;
}

.shop-empty-title {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 12px;
}

.shop-empty-text {
    font-size: 16px;
    color: #6b7280;
    margin-bottom: 24px;
}

/* ============================================
   RESPONSIVE IMPROVEMENTS
   ============================================ */
@media (max-width: 1023px) {
    .shop-page {
        grid-template-columns: 1fr;
    }
    
    .shop-filters {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 400px;
        height: 100vh;
        overflow-y: auto;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    
    .shop-filters.open {
        left: 0;
    }
}

@media (max-width: 768px) {
    .shop-title {
        font-size: 24px;
    }
    
    .product-card-title {
        font-size: 15px;
        min-height: 40px;
    }
    
    .product-card-price-current {
        font-size: 20px;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .shop-header {
        padding: 20px;
    }
    
    .product-card {
        max-width: 100%;
    }
}

/* ============================================
   CONTRAST & ACCESSIBILITY IMPROVEMENTS
   ============================================ */
.product-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.product-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: #d4af37;
}

/* Ensure text has proper contrast */
.product-card-body {
    padding: 20px;
    background: #ffffff;
}

/* Fix button text readability */
.btn {
    text-decoration: none;
    display: inline-block;
}

.btn-block {
    width: 100%;
    display: block;
}

/* ============================================
   LOADING STATE
   ============================================ */
.shop-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.shop-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: #d4af37;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .shop-filters,
    .shop-filters-mobile-toggle,
    .shop-header {
        display: none;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
