/* Language Selector */
.language-selector {
    position: fixed;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.lang-option {
    padding: 8px 16px;
    background: transparent;
    color: #667eea;
    border: 2px solid transparent;
    border-radius: 50px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: none;
}

.lang-option:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: none;
}

.lang-option.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 15px;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 20px;
    padding-top: 20px;
}

h1 {
    color: white;
    font-size: 3.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.subtitle-sub {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    font-style: italic;
}

.search-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 20px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 100%;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#searchInput {
    flex: 1;
    padding: 18px 25px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    max-width: 100%;
}

#searchInput:focus {
    outline: 3px solid #ff6b6b;
}

button {
    padding: 18px 45px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

button:hover {
    background: #ff5252;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

button:active {
    transform: translateY(0);
}

.search-btn {
    background: #4CAF50;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.search-btn:hover {
    background: #45a049;
}

.clear-btn {
    background: #f44336;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.clear-btn:hover {
    background: #da190b;
}

/* Filters */
.filters {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    align-items: start;
    width: 100%;
    max-width: 100%;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.filter-group.full-width {
    grid-column: span 2;
}

.filter-group label {
    color: white;
    font-weight: 600;
    font-size: 14px;
    display: block;
    margin-bottom: 5px;
    line-height: 1.4;
}

.filter-group select {
    padding: 12px 15px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    background: white;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    max-width: 100%;
}

.price-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 100%;
}

.price-inputs input {
    flex: 1;
    min-width: 0;
    padding: 12px 12px;
    font-size: 15px;
    border: none;
    border-radius: 12px;
    max-width: 100%;
}

.price-inputs span {
    color: white;
    font-weight: bold;
    font-size: 18px;
    flex-shrink: 0;
}

/* Shipping filters */
.shipping-filters {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 100%;
}

.shipping-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: white;
    font-size: 14px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.shipping-option:hover {
    background: rgba(255, 255, 255, 0.2);
}

.shipping-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.shipping-option span {
    user-select: none;
    font-size: 13px;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    margin-top: 5px;
    width: 100%;
    max-width: 100%;
}

.filter-buttons button {
    flex: 1;
    padding: 14px;
    font-size: 15px;
}

/* Search Tips */
.search-tips {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 12px 15px;
    border-radius: 12px;
    margin-top: 15px;
    border-left: 4px solid #4CAF50;
    width: 100%;
    max-width: 100%;
}

.search-tips p {
    color: white;
    font-size: 0.9rem;
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.search-tips p:last-child {
    margin-bottom: 0;
}

.search-tips .tip-main {
    font-size: 0.95rem;
}

.search-tips .tip-disclaimer,
.search-tips .tip-english {
    font-size: 0.85rem;
    opacity: 0.95;
}

.search-tips strong {
    color: #4CAF50;
}

.search-tips em {
    color: #ffeb3b;
    font-style: normal;
    font-weight: 600;
}

/* Loading with Progress Bar - CENTERED AND PROMINENT */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(102, 126, 234, 0.95);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.loading.hidden {
    display: none;
}

.progress-container {
    max-width: 600px;
    width: 90%;
    padding: 40px 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.progress-text {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 25px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.progress-bar {
    width: 100%;
    height: 35px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin-bottom: 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A, #CDDC39);
    background-size: 200% 100%;
    animation: gradientMove 2s ease infinite;
    transition: width 0.5s ease;
    border-radius: 50px;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-percentage {
    font-size: 1.8rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    text-align: center;
}

/* Results Container */
.results-container {
    margin-top: 30px;
    width: 100%;
    max-width: 100%;
}

.results-container.hidden {
    display: none;
}

/* Results Section */
.results-section {
    margin-bottom: 40px;
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
}

.section-header {
    margin-bottom: 20px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 15px;
}

.section-header h2 {
    color: #333;
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.section-header p {
    color: #666;
    font-size: 1rem;
}

/* Products Grid - Top 5 sections */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* Products Grid - All Results */
.products-grid-all {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
}

/* Product Cards */
.product-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    border: 2px solid transparent;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.product-card:active {
    transform: translateY(-2px);
}

/* Badge for special categories */
.badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 1;
}

.product-image-container {
    position: relative;
    margin-bottom: 12px;
}

.product-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    background: #f5f5f5;
}

.product-card h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 0.95rem;
    min-height: 42px;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-info {
    flex: 1;
}

.price {
    font-size: 1.5rem;
    color: #ff6b6b;
    font-weight: bold;
    margin: 8px 0;
}

/* Discount badge */
.discount-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin: 8px 0;
}

/* Shipping display on product cards */
.product-shipping {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: #e8f5e9;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #2e7d32;
    font-weight: 600;
    margin: 10px 0;
    flex-wrap: wrap;
}

.product-shipping.paid {
    background: #fff3e0;
    color: #e65100;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 12px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat {
    text-align: center;
}

.stat-value {
    font-weight: bold;
    color: #333;
    display: block;
    font-size: 0.9rem;
}

.stat-label {
    font-size: 0.75rem;
    color: #666;
}

.product-card button {
    width: 100%;
    margin-top: 12px;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* About Section */
.about-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 50px 30px;
    border-radius: 20px;
    margin-top: 40px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 100%;
}

.about-section h2 {
    text-align: center;
    color: #333;
    font-size: 2.5rem;
    margin-bottom: 40px;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.feature {
    text-align: center;
    padding: 20px;
}

.icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
}

.feature h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.feature p {
    color: #666;
    line-height: 1.6;
}

/* Footer */
footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    padding: 30px 0;
    margin-top: 20px;
    font-size: 0.9rem;
    width: 100%;
    max-width: 100%;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-state h3 {
    color: #333;
    margin-bottom: 10px;
}

/* ============================================
   LOW SALES WARNING BADGES
   ============================================ */

/* Low Sales Warning Badges */
.low-sales-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
    z-index: 2;
}

.low-sales-badge.warning {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.4);
}

/* Highlight products with low/zero sales */
.product-card.zero-sales {
    border: 2px solid #ff6b6b;
    opacity: 0.9;
}

.product-card.low-sales {
    border: 2px solid #f39c12;
    opacity: 0.95;
}

/* Styling for sales stat when it's low */
.stat-warning .stat-value {
    color: #ff6b6b !important;
    font-weight: 700;
}

.stat-caution .stat-value {
    color: #f39c12 !important;
    font-weight: 700;
}

/* ============================================
   PAGINATION STYLES
   ============================================ */

.pagination-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.pagination-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.pagination-btn:active {
    transform: translateY(0);
}

.page-number {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: 2px solid #667eea;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 45px;
    text-align: center;
}

.page-number:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.page-number.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #764ba2;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.page-ellipsis {
    color: #667eea;
    font-weight: bold;
    padding: 10px;
}




/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Tablets (portrait) */
@media (max-width: 992px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
    
    .products-grid-all {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

/* Mobile devices */
@media (max-width: 768px) {
    body {
        padding: 0;
        overflow-x: hidden;
    }

    .container {
        width: 100%;
        padding: 0;
        overflow-x: hidden;
    }

    /* Compact language selector on mobile */
    .language-selector {
        top: 5px;
        right: 5px;
        padding: 4px;
        gap: 5px;
    }
    
    .lang-option {
        padding: 6px 10px;
        font-size: 11px;
    }

    header {
        padding: 50px 15px 15px 15px;
        margin-bottom: 10px;
    }

    h1 {
        font-size: 2rem;
        margin-bottom: 5px;
    }

    .subtitle {
        font-size: 1rem;
    }

    .subtitle-sub {
        font-size: 0.85rem;
    }

    .search-section {
        padding: 15px;
        border-radius: 0;
        margin-bottom: 15px;
        width: 100%;
        max-width: 100%;
    }

    .search-box {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 15px;
    }

    #searchInput {
        padding: 14px 18px;
        font-size: 16px;
        width: 100%;
    }

    button {
        width: 100%;
        padding: 14px;
    }

    /* Stack filters vertically on mobile */
    .filters {
        grid-template-columns: 1fr;
        gap: 12px;
        width: 100%;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group.full-width {
        grid-column: span 1;
        width: 100%;
    }

    .filter-group label {
        font-size: 13px;
    }

    .filter-group select {
        padding: 11px 12px;
        font-size: 14px;
        width: 100%;
    }

    .price-inputs {
        width: 100%;
    }

    .price-inputs input {
        padding: 11px 10px;
        font-size: 14px;
        width: 100%;
    }

    .shipping-filters {
        grid-template-columns: 1fr;
        gap: 8px;
        width: 100%;
    }

    .shipping-option {
        font-size: 13px;
        padding: 9px;
        width: 100%;
    }

    .filter-buttons {
        flex-direction: column;
        gap: 8px;
        margin-top: 5px;
        width: 100%;
    }

    .filter-buttons button {
        font-size: 14px;
        padding: 12px;
        width: 100%;
    }

    .search-tips {
        padding: 10px 12px;
        margin-top: 12px;
        width: 100%;
    }
    
    .search-tips p {
        font-size: 0.8rem;
    }

    .search-tips .tip-disclaimer,
    .search-tips .tip-english {
        font-size: 0.75rem;
    }

    /* Loading - POSITIONED AT TOP ON MOBILE */
    .loading {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 15px;
        align-items: flex-start;
        padding-top: 15vh;
    }

    .progress-container {
        width: 90%;
        max-width: 350px;
        padding: 20px 15px;
    }

    .progress-text {
        font-size: 0.95rem;
        min-height: 45px;
        padding: 0 10px;
        line-height: 1.3;
    }
    
    .progress-bar {
        height: 25px;
    }
    
    .progress-percentage {
        font-size: 1.3rem;
    }

    /* Results sections - full width */
    .results-container {
        width: 100%;
        overflow-x: hidden;
    }

    .results-section {
        padding: 15px;
        margin-bottom: 20px;
        border-radius: 0;
        width: 100%;
    }

    .section-header h2 {
        font-size: 1.3rem;
    }

    .section-header p {
        font-size: 0.85rem;
    }

    /* SMALLER Product cards on mobile - 2 columns */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .products-grid-all {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .product-card {
        padding: 8px;
    }

    .product-image {
        height: 120px;
    }

    .product-card h3 {
        font-size: 0.75rem;
        min-height: 32px;
        margin-bottom: 6px;
    }

    .price {
        font-size: 1.1rem;
        margin: 4px 0;
    }

    .product-shipping {
        padding: 5px 6px;
        font-size: 0.7rem;
        margin: 6px 0;
    }

    .discount-badge {
        font-size: 0.65rem;
        padding: 3px 6px;
        margin: 4px 0;
    }

    .stats {
        padding: 5px;
        gap: 3px;
        margin: 8px 0;
    }

    .stat-value {
        font-size: 0.7rem;
    }

    .stat-label {
        font-size: 0.6rem;
    }

    .badge {
        font-size: 0.55rem;
        padding: 2px 5px;
        top: 5px;
        right: 5px;
    }

    .product-card button {
        padding: 8px;
        font-size: 0.75rem;
        margin-top: 8px;
    }

    /* About section */
    .about-section {
        padding: 25px 15px;
        border-radius: 0;
        width: 100%;
    }

    .about-section h2 {
        font-size: 1.5rem;
        margin-bottom: 25px;
    }

    .features {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .icon {
        font-size: 2.5rem;
    }

    .feature h3 {
        font-size: 1.1rem;
    }

    .feature p {
        font-size: 0.9rem;
    }

    /* Footer - full width */
    footer {
        width: 100%;
        padding: 20px 15px;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .subtitle-sub {
        font-size: 0.75rem;
    }

    .search-section {
        padding: 12px;
    }

    .results-section {
        padding: 12px;
    }

    .products-grid,
    .products-grid-all {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .product-image {
        height: 180px;
    }

    .product-card h3 {
        font-size: 0.85rem;
        min-height: auto;
    }

    .about-section {
        padding: 20px 12px;
    }

    .about-section h2 {
        font-size: 1.3rem;
    }

    .progress-container {
        padding: 18px 12px;
    }

    .progress-text {
        font-size: 0.85rem;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    button {
        min-height: 44px;
    }

    .product-card:hover {
        transform: none;
    }

    .product-card:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
}