:root {
    --bg-color: #f8f9fb;
    --surface-color: #ffffff;
    --primary-color: #3b9def;
    --text-main: #1a1a1a;
    --text-muted: #94a3b8;
    --danger-color: #e53935;
    --success-color: #43a047;
    --border-radius: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
    padding-bottom: 120px;
}

/* Header & Toggle */
.header {
    background: var(--surface-color);
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-icons i {
    font-size: 1.4rem;
    color: var(--text-muted);
    margin-left: 15px;
    cursor: pointer;
}

.delivery-toggle {
    display: flex;
    background: var(--bg-color);
    border-radius: 30px;
    padding: 4px;
}

.toggle-btn {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: all 0.2s;
    cursor: pointer;
}

.toggle-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 157, 239, 0.3);
}

.address-bar {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-main);
    padding: 5px 0;
}

.address-bar i {
    color: var(--primary-color);
    margin-right: 5px;
}

/* Tabs */
.tab-content {
    display: none;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Categories */
.categories-scroll {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding: 10px 0 15px 0;
    margin-bottom: 5px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-color);
}

.categories-scroll::-webkit-scrollbar {
    display: none;
}

.category-chip {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    padding-bottom: 5px;
    transition: all 0.2s;
}

.category-chip.active {
    color: var(--text-main);
    font-weight: 700;
    border-bottom: 2px solid var(--text-main);
}

.category-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.category-section {
    scroll-margin-top: 70px;
    margin-bottom: 30px;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.product-card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding-bottom: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.product-img-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--border-radius);
}

.rating-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 4px;
}

.rating-badge i {
    color: #ffb300;
}

.fav-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.8);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 8px 0;
    min-height: 35px;
}

.product-tag {
    font-size: 0.65rem;
    padding: 3px 6px;
    border-radius: 4px;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
}

.product-info {
    padding: 0 8px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 4px;
}

.product-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-grow: 1;
    margin-bottom: 8px;
}

.product-footer {
    margin-top: auto;
}

.old-price {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: line-through;
    margin-bottom: 2px;
}

.add-to-cart-btn {
    background: #f1f5f9;
    color: var(--text-main);
    border: none;
    width: 100%;
    padding: 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.add-to-cart-btn:active {
    background: #e2e8f0;
}

/* Floating Cart */
.floating-cart-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-color);
    padding: 15px 20px 25px 20px;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
    z-index: 100;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-cart-wrapper.visible {
    transform: translateY(0);
}

.big-cart-btn {
    width: 100%;
    background: var(--primary-color);
    color: white;
    padding: 16px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

/* Forms & UI */
.checkout-form input,
.checkout-form textarea,
.admin-card input,
.admin-card textarea,
.admin-card select {
    width: 100%;
    padding: 14px;
    background: #f1f5f9;
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    margin-bottom: 10px;
    transition: border 0.2s;
}

.checkout-form input:focus {
    border: 1px solid var(--primary-color);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-main);
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}

.admin-card {
    background: white;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid #eee;
}

.cart-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--success-color);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 600;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Profile Styles */
.profile-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px 0;
    margin-bottom: 20px;
}
.profile-avatar {
    width: 60px;
    height: 60px;
    background: #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #94a3b8;
}
.profile-info h2 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-color);
}
.profile-info p {
    margin: 5px 0 0;
    font-size: 0.9rem;
    color: #94a3b8;
}

.profile-menu {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 30px;
}
.profile-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.2s;
}
.profile-menu-item:last-child {
    border-bottom: none;
}
.profile-menu-item:active {
    background: #f8fafc;
}
.profile-menu-left {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1rem;
    font-weight: 500;
}
.profile-menu-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}
.icon-green { background: #34d399; }
.icon-orange { background: #fbbf24; }
.icon-red { background: #ef4444; }
.icon-blue { background: #3b82f6; }

.toggle-switch {
    position: relative;
    width: 40px;
    height: 24px;
    background: #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.3s;
}
.toggle-switch.active {
    background: var(--primary-color);
}
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}
.toggle-switch.active::after {
    left: 18px;
}
.profile-hint {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: -10px;
    padding: 0 20px;
    margin-bottom: 15px;
}

.profile-subview {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: 100;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 80px;
}

.subview-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}
.subview-header i {
    font-size: 1.2rem;
    color: var(--text-color);
    cursor: pointer;
}
.subview-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.fav-btn.active i {
    color: #ef4444;
}

.address-card {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.address-card i {
    color: var(--primary-color);
    font-size: 1.2rem;
}
.history-card {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 15px;
}
.history-card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 600;
}
.history-card-items {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 10px;
}
.history-card-footer {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    color: var(--primary-color);
}

.address-form-group {
    display: flex;
    flex-direction: column;
}
.address-form-group input {
    border: none;
    border-bottom: 1px solid #f1f5f9;
    padding: 15px 0;
    font-size: 1rem;
    color: var(--text-color);
    background: transparent;
}
.address-form-group input:focus {
    outline: none;
    border-bottom-color: var(--primary-color);
}
.address-form-group input::placeholder {
    color: #94a3b8;
}

/* Checkout Redesign Styles */
.checkout-segmented-control {
    display: flex;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
}
.checkout-segment {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: 0.3s;
}
.checkout-segment.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.checkout-block {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
}
.checkout-block:last-child {
    border-bottom: none;
}
.checkout-block-left {
    display: flex;
    align-items: center;
    gap: 15px;
}
.checkout-block-icon {
    width: 30px;
    height: 30px;
    background: #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}
.checkout-block-icon.blue { background: #e0f2fe; color: #0ea5e9; }
.checkout-block-icon.green { background: #dcfce7; color: #22c55e; }
.checkout-block-icon.gray { background: #f1f5f9; color: #64748b; }

.checkout-block-content {
    display: flex;
    flex-direction: column;
}
.checkout-block-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
}
.checkout-block-subtitle {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 2px;
}

.checkout-btn-outline {
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.checkout-summary {
    margin-top: 30px;
    background: white;
    padding: 15px 0;
}
.checkout-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: var(--text-color);
}
.checkout-summary-row.total {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.payment-method-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
}
.payment-method-card.selected {
    border-color: var(--primary-color);
    background: #f0fdf4;
}
.payment-method-card i.check {
    color: var(--primary-color);
    font-size: 1.2rem;
    display: none;
}
.payment-method-card.selected i.check {
    display: block;
}

/* Yandex Maps SuggestView Z-Index Fix */
[class*="ymaps-2-1-"][class*="-islets_popup"],
[class*="ymaps-2-1-"][class*="-suggest"],
[class*="ymaps-2-1-"][class*="-popup"] {
    z-index: 9999 !important;
}

.suggest-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.suggest-item {
    padding: 12px 15px;
    font-size: 0.9rem;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    color: var(--text-color);
}
.suggest-item:last-child {
    border-bottom: none;
}
.suggest-item:active {
    background: #f8fafc;
}