* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #e3f2fd;
    color: #1a1a1a;
    margin: 0;
    padding: 0 0 20px 0;
    min-height: 100vh;
    position: relative;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

body.privacy-blur {
    filter: blur(20px);
    transition: filter 0.15s;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("https://i.ibb.co/KpwYv3qV/Screenshot-20260917-104619.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.35;
    z-index: -1;
    pointer-events: none;
}

/* ============ HEADER ============ */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px 6px;
    gap: 8px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 0 0 16px 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    margin-bottom: 8px;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.logo-img {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    background: #fff;
}
.brand-text {
    font-size: 19px;
    font-weight: 900;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.brand-maxi {
    color: #e53935;
    text-shadow: -1px -1px 0 #fff, -1px 0 0 #fff, -1px 1px 0 #fff, 0 -1px 0 #fff, 0 1px 0 #fff, 1px -1px 0 #fff, 1px 0 0 #fff, 1px 1px 0 #fff, 2px 2px 4px rgba(0,0,0,0.3);
}
.brand-market {
    color: #1565c0;
    text-shadow: -1px -1px 0 #fff, -1px 0 0 #fff, -1px 1px 0 #fff, 0 -1px 0 #fff, 0 1px 0 #fff, 1px -1px 0 #fff, 1px 0 0 #fff, 1px 1px 0 #fff, 2px 2px 4px rgba(0,0,0,0.3);
}
.profile-btn {
    background: #1565c0;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(21,101,192,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}

/* ============ BANNER ============ */
.banner-carousel {
    position: relative;
    width: calc(100% - 24px);
    margin: 4px 12px 10px;
    height: 130px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(0,0,0,0.2);
    background: #1565c0;
}
.banner-slide {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: #fff; transition: opacity 0.3s;
    padding: 8px; text-align: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.banner-emoji { font-size: 28px; margin-bottom: 4px; }
.banner-title { font-size: 16px; font-weight: 800; margin-bottom: 2px; text-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.banner-subtitle { font-size: 11px; opacity: 0.95; text-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.banner-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.9); border: none;
    width: 28px; height: 28px; border-radius: 50%;
    font-size: 16px; cursor: pointer; color: #1565c0;
    font-weight: 700; z-index: 3; display: flex;
    align-items: center; justify-content: center;
}
.banner-nav.prev { left: 6px; }
.banner-nav.next { right: 6px; }
.banner-dots { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; z-index: 3; }
.banner-dots span {
    display: inline-block; width: 6px; height: 6px;
    background: rgba(255,255,255,0.5); border-radius: 50%;
    margin: 0 2px; cursor: pointer;
}
.banner-dots span.active { background: #fff; transform: scale(1.3); }

/* ============ QIDIRUV ============ */
.search-box {
    display: flex; align-items: center;
    background: #fff; border-radius: 10px;
    padding: 3px 12px; margin: 0 12px 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.search-icon { font-size: 14px; margin-right: 7px; color: #888; }
.search-box input {
    flex: 1; border: none; outline: none;
    padding: 8px 0; font-size: 13px; background: transparent;
}
.search-clear {
    background: #e0e0e0; border: none;
    width: 20px; height: 20px; border-radius: 50%;
    cursor: pointer; font-size: 10px;
    display: flex; align-items: center; justify-content: center;
}

/* ============ KATEGORIYALAR ============ */
.categories-scroll {
    display: flex; gap: 8px;
    overflow-x: auto; padding: 0 12px 10px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.categories-scroll::-webkit-scrollbar { display: none; }
.category-btn {
    flex-shrink: 0; background: #fff;
    border: 2px solid transparent; border-radius: 10px;
    padding: 6px 10px; display: flex;
    flex-direction: column; align-items: center;
    gap: 3px; cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    min-width: 58px; transition: all 0.15s;
}
.category-btn.active { border-color: #1565c0; background: #e3f2fd; }
.cat-emoji { font-size: 16px; }
.cat-name { font-size: 9px; font-weight: 600; color: #333; white-space: nowrap; }

/* ============ MAHSULOTLAR ============ */
#products-container { padding: 0 12px; }

/* 1-qator: yonboshga scroll */
.products-horizontal {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}
.products-horizontal::-webkit-scrollbar { display: none; }
.products-horizontal .product-card-h {
    flex: 0 0 auto;
    width: 198px;
}

/* Pastga qarab: 2 tadan grid */
.products-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}
.products-grid .product-card-h {
    width: 100%;
}

.product-card-h {
    background: #fff; border-radius: 12px;
    padding: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer; display: flex;
    flex-direction: column; gap: 6px;
    transition: transform 0.15s;
    contain: layout style;
}
.product-card-h:active { transform: scale(0.97); }

.product-image-h {
    position: relative;
    width: 100%;
    height: 204px;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
}
.product-image-h img {
    position: relative;
    z-index: 2;
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    opacity: 0;
    transition: opacity 0.3s ease-in;
}
.product-image-h img.loaded {
    opacity: 1;
}
.img-spinner {
    position: absolute;
    top: 50%; left: 50%;
    width: 32px; height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid #e0e0e0;
    border-top-color: #1565c0;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 1;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.product-image-h:has(img.loaded) .img-spinner {
    display: none;
}

.discount-badge-h {
    position: absolute; top: 6px; left: 6px;
    background: linear-gradient(135deg, #ff6f00, #e53935);
    color: #fff; font-size: 10px; font-weight: 700;
    padding: 3px 6px; border-radius: 5px;
    z-index: 3;
}
.product-title-h {
    font-size: 12px; font-weight: 600; color: #222;
    line-height: 1.3; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; min-height: 32px;
}
.product-price-h { display: flex; flex-direction: column; gap: 1px; }
.old-price-h { font-size: 10px; color: #999; text-decoration: line-through; }
.new-price-h { font-size: 13px; font-weight: 700; color: #e53935; }

.buy-btn-h {
    width: 100%;
    background: linear-gradient(135deg, #2e7d32, #43a047);
    color: #fff;
    border: none;
    padding: 9px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    margin-top: auto;
    box-shadow: 0 2px 6px rgba(46,125,50,0.3);
}
.buy-btn-h:active { transform: scale(0.97); }

.loading {
    text-align: center; padding: 40px 20px;
    color: #333; font-size: 14px; font-weight: 600;
}

/* ============ YANA KO'RISH TUGMASI ============ */
.load-more-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px 12px 16px;
    margin-top: 10px;
}

.load-more-btn {
    background: linear-gradient(135deg, #1565c0, #42a5f5);
    color: #fff;
    border: none;
    padding: 15px 32px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(21,101,192,0.35);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    min-width: 220px;
    justify-content: center;
}
.load-more-btn:active {
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(21,101,192,0.4);
}
.load-more-icon {
    font-size: 18px;
    animation: bounceDown 1.5s infinite;
}
@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

.all-shown {
    text-align: center;
    color: #2e7d32;
    font-size: 13px;
    font-weight: 600;
    padding: 14px 20px;
    background: #e8f5e9;
    border-radius: 10px;
    margin: 0;
}

/* ============ SKELETON LOADER ============ */
.products-grid-skeleton {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.skeleton-card {
    background: #fff;
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.skeleton-img {
    width: 100%;
    height: 180px;
    border-radius: 8px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
.skeleton-line {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
.skeleton-line.short { width: 60%; }
.skeleton-btn {
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.product-colors-mini {
    display: flex; gap: 3px; margin: 4px 0;
}
.product-colors-mini span {
    width: 14px; height: 14px; border-radius: 50%;
    border: 1.5px solid #ddd;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* ============ BUYURTMA OYNASI ============ */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: #fff; z-index: 999;
    justify-content: center; align-items: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.modal-overlay.active { display: flex; }

.order-modal-content {
    width: 100%;
    max-width: 600px;
    min-height: 100vh;
    background: #fff;
    display: flex;
    flex-direction: column;
    padding-bottom: 80px;
}

.order-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.back-btn {
    background: none;
    border: none;
    font-size: 32px;
    font-weight: 900;
    color: #1a1a1a;
    cursor: pointer;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    line-height: 1;
}
.back-btn:active { background: #f0f0f0; }

.order-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
}

.header-spacer { width: 48px; }

.order-modal-body {
    padding: 16px;
    flex: 1;
}

/* COUNTDOWN */
.countdown-block {
    text-align: center;
    margin: 0 0 14px;
    padding: 10px;
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border-radius: 10px;
    border: 2px solid #ffb74d;
}
.countdown-label {
    font-size: 12px;
    color: #e65100;
    margin: 0 0 6px;
    font-weight: 700;
}
.countdown { display: flex; justify-content: center; gap: 10px; }
.countdown div { text-align: center; min-width: 45px; }
.countdown span { font-size: 20px; font-weight: 900; color: #e65100; display: block; }
.countdown small { font-size: 8px; color: #888; letter-spacing: 1px; font-weight: 700; }

/* FORM */
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #333;
    margin: 14px 0 6px;
}
#order-form input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    background: #fafafa;
    font-family: inherit;
    box-sizing: border-box;
    color: #1a1a1a;
}
#order-form input:focus {
    outline: none;
    border-color: #1565c0;
    background: #fff;
}

.order-submit-btn {
    width: 100%;
    background: #283593;
    color: #fff;
    border: none;
    padding: 16px;
    border-radius: 10px;
    font-size: 17px;
    font-weight: 700;
    margin-top: 18px;
    cursor: pointer;
    transition: background 0.15s;
}
.order-submit-btn:active { background: #1a237e; }
.order-submit-btn:disabled {
    background: #90a4ae;
    cursor: not-allowed;
}

/* ⭐ SLIDER (rasm wrapper + swipe) */
.slider {
    margin: 24px 0 16px;
}

.modal-img-wrap {
    position: relative;
    width: 100%;
    height: 600px;
    border-radius: 12px;
    overflow: hidden;
    background: #f0f0f0;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}
.modal-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease-in, transform 0.25s;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}
.modal-img-wrap img.loaded {
    opacity: 1;
}

/* ⭐ MODAL SPINNER */
.modal-img-spinner {
    position: absolute;
    top: 50%; left: 50%;
    width: 44px; height: 44px;
    margin: -22px 0 0 -22px;
    border: 4px solid rgba(21, 101, 192, 0.15);
    border-top-color: #1565c0;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 1;
    pointer-events: none;
}

.slider-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding: 0 4px;
}

.slider-btn {
    background: #1565c0;
    color: #fff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(21,101,192,0.35);
    flex-shrink: 0;
    transition: all 0.15s;
    padding: 0;
    margin: 0;
    line-height: 1;
}
.slider-btn:active {
    transform: scale(0.92);
    background: #0d47a1;
}

.slider-dots {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 0 4px;
}
.slider-dots span {
    width: 9px;
    height: 9px;
    background: #cfd8dc;
    border-radius: 50%;
    transition: all 0.25s ease;
}
.slider-dots span.active {
    background: #1565c0;
    transform: scale(1.4);
    box-shadow: 0 0 8px rgba(21,101,192,0.5);
}

/* TITLE */
.order-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    text-align: center;
    margin: 12px 0;
    line-height: 1.3;
}

/* NARX */
.order-price-block {
    text-align: center;
    margin: 8px 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.order-old-price {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
}
.order-new-price {
    font-size: 20px;
    font-weight: 800;
    color: #2e7d32;
}
.order-discount-badge {
    background: #e53935;
    color: #fff;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
}

/* STATS */
.order-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    justify-content: center;
    flex-wrap: wrap;
}
.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f8f9fa;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    color: #333;
}
.stat-item b { color: #1565c0; font-weight: 700; }
.stat-icon { font-size: 16px; }

/* DESCRIPTION */
.order-description {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 14px;
    margin: 12px 0;
    font-size: 14px;
    line-height: 1.7;
    color: #444;
    border: 1px solid #e0e0e0;
}
.order-description p { margin: 0 0 8px; }
.order-description p:last-child { margin-bottom: 0; }

/* OPTION SECTIONS */
.order-option-section {
    margin: 14px 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 10px;
}
.option-label {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}
.option-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.option-btn {
    padding: 10px 16px;
    border-radius: 8px;
    background: #fff;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
    width: auto;
    margin: 0;
    font-family: inherit;
}
.option-btn.selected {
    border-color: #1565c0;
    background: #e3f2fd;
    color: #1565c0;
}
.option-btn:active { transform: scale(0.97); }

.color-opt-btn { padding: 8px 12px; }
.option-color-circle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #ddd;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* STATUS */
.status {
    text-align: center;
    padding: 10px;
    font-size: 13px;
    margin-top: 10px;
    border-radius: 8px;
    font-weight: 600;
    display: none;
}
.status.ok, .status.err { display: block; }
.status.ok { background: #e8f5e9; color: #2e7d32; }
.status.err { background: #ffebee; color: #c62828; }

/* DELIVERY */
.delivery-info {
    text-align: center;
    font-size: 12px;
    color: #666;
    margin-top: 16px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
    line-height: 1.5;
}

/* PASTKI MENYU */
.order-bottom-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 600px;
    margin: 0 auto;
    background: #fff;
    border-top: 2px solid #e0e0e0;
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 20;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
}
.order-bottom-menu button {
    width: 100%;
    background: none;
    border: none;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    color: #1565c0;
    font-family: inherit;
    margin: 0;
}
.order-bottom-menu button:active {
    background: #f0f7ff;
    border-radius: 8px;
}
.bottom-icon { font-size: 24px; }
.bottom-label {
    font-size: 11px;
    font-weight: 700;
    color: #1565c0;
}

/* PROFIL MODAL */
.modal-overlay:not(#order-modal) .modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    max-width: 480px;
    width: calc(100% - 24px);
    position: relative;
    margin: auto;
    margin-top: 20px;
    margin-bottom: 20px;
}

.profile-content { padding-top: 30px; }
.profile-header-icon { text-align: center; margin-bottom: 8px; }
.profile-avatar {
    width: 90px; height: 90px;
    background: linear-gradient(135deg, #1565c0, #42a5f5);
    color: #fff; border-radius: 50%;
    font-size: 45px; display: flex;
    align-items: center; justify-content: center;
    margin: 0 auto;
    box-shadow: 0 4px 14px rgba(21,101,192,0.35);
    overflow: hidden;
}
.profile-number {
    text-align: center; font-size: 16px;
    font-weight: 800; color: #1565c0;
    margin: 8px 0 16px; letter-spacing: 1px;
}
.profile-form { text-align: left; }
.profile-form label {
    display: block; font-size: 12px;
    font-weight: 700; margin: 12px 0 5px; color: #333;
}
.profile-form input {
    width: 100%; padding: 12px 14px;
    border: 1.5px solid #ddd; border-radius: 10px;
    font-size: 15px; background: #fafafa;
    font-family: inherit;
}
.profile-form input[readonly] { background: #f0f0f0; color: #666; cursor: not-allowed; }
.profile-form input[type="file"] { padding: 8px; background: #fff; cursor: pointer; }
.save-btn {
    width: 100%; background: #2e7d32; color: #fff;
    border: none; padding: 14px; border-radius: 10px;
    font-size: 15px; font-weight: 700;
    margin-top: 16px; cursor: pointer;
}

.modal-close {
    position: absolute; top: 12px; right: 12px;
    background: rgba(0,0,0,0.5); color: #fff;
    border: none; border-radius: 50%;
    width: 34px; height: 34px; font-size: 18px;
    cursor: pointer; z-index: 10;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
}

/* ============ MOBIL ============ */
@media (max-width: 360px) {
    .products-horizontal .product-card-h { width: 178px; }
    .products-grid .product-card-h { width: 100%; }
    .product-image-h { height: 181px; }
    .buy-btn-h { font-size: 12px; padding: 8px; }
    .modal-img-wrap { height: 500px; }
    .banner-carousel { height: 115px; }
    .brand-text { font-size: 17px; }
    .back-btn { font-size: 28px; width: 44px; height: 44px; }
    .header-spacer { width: 44px; }
    .countdown span { font-size: 18px; }
    .countdown div { min-width: 40px; }
    .order-new-price { font-size: 18px; }
    .load-more-btn { min-width: 190px; font-size: 13px; padding: 13px 24px; }
}
