:root {
    color-scheme: light;
    --primary-color: #3390ec;
    --bg-color: #ffffff;
    --sec-bg: #f4f4f7;
    --text-main: #000000;
    --card-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--sec-bg);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

#app {
    width: 100%;
    max-width: 500px;
    background-color: var(--bg-color);
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    position: relative;
    display: flex;
    flex-direction: column;
}

.hidden { display: none !important; }

.section-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #fff;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 50;
}

.section-header h2 { margin: 0; font-size: 18px; text-align: center; }

.section-header .back-btn {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    background: transparent; border: none; color: var(--primary-color);
    font-size: 16px; cursor: pointer; padding: 5px;
}

.main-header {
    padding: 15px; border-bottom: 1px solid #eee; background: #fff;
    text-align: center; position: sticky; top: 0; z-index: 50;
}

.main-header h1 { margin: 0; font-size: 20px; }

.categories-grid, .products-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px;
}

.category-card, .product-card {
    background: #ffffff; border-radius: 12px; overflow: hidden;
    border: 1px solid #eee; box-shadow: var(--card-shadow);
    display: flex; flex-direction: column; cursor: pointer;
}

.category-img, .product-img {
    width: 100%; height: 160px; object-fit: cover; display: block;
}

.category-name {
    padding: 10px; font-weight: 600; text-align: center; font-size: 14px;
}

.product-info {
    padding: 10px; display: flex; flex-direction: column; text-align: center; flex: 1;
}

.product-title {
    font-size: 14px; font-weight: 600; margin-bottom: 5px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.product-price { color: var(--primary-color); font-weight: bold; margin-bottom: 8px; }
.product-art { font-size: 11px; color: #888; margin-bottom: 8px; }

.qty-wrapper {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--sec-bg); border-radius: 8px; padding: 4px; margin-top: auto;
}

.qty-btn {
    width: 32px; height: 32px; border: none; background: #fff;
    border-radius: 6px; color: var(--primary-color); font-weight: bold; font-size: 18px; cursor: pointer;
}

.detail-container { padding: 15px; display: flex; flex-direction: column; align-items: center; }
.detail-img { width: 100%; max-height: 400px; object-fit: contain; border-radius: 12px; margin-bottom: 15px; cursor: zoom-in; }
.detail-art { color: #888; margin-bottom: 10px; }
.detail-desc { margin-bottom: 20px; color: #444; line-height: 1.5; text-align: left; width: 100%; }
.detail-price { font-size: 24px; font-weight: bold; color: var(--primary-color); margin-bottom: 20px; }

.main-btn-alt {
    width: 100%; padding: 14px; background: var(--primary-color);
    color: #ffffff; border: none; border-radius: 10px; font-weight: 600; font-size: 16px;
}

.cart-items-container { padding: 10px; background: #fff; border-bottom: 1px solid #eee; }
.cart-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px solid #f5f5f5;
}
.cart-row:last-child { border-bottom: none; }
.total-row {
    padding: 15px; font-size: 18px; font-weight: bold;
    display: flex; justify-content: space-between; background: #fff;
}

.form-container { display: flex; flex-direction: column; padding: 15px; gap: 12px; background: #fff; }
.form-container input, .form-container textarea, .form-container select {
    padding: 12px; border: 1px solid #ddd; border-radius: 8px; width: 100%; font-size: 16px;
}
.delivery-selector { margin: 10px 0; }
.field-label { font-weight: 500; margin-bottom: 5px; display: block; }
.radio-group { display: flex; gap: 15px; margin-top: 5px; }
.radio-group label { display: flex; align-items: center; gap: 5px; cursor: pointer; }

.file-input-wrapper { margin-top: 10px; }

.footer-contacts {
    margin-top: auto; padding: 20px; text-align: center;
    background: var(--sec-bg); border-top: 1px solid #eee;
}
.social-links { display: flex; justify-content: center; gap: 20px; margin-top: 10px; }
.social-links a { color: var(--primary-color); text-decoration: none; font-weight: 600; }

#image-viewer {
    display: none; position: fixed; z-index: 2000; top: 0; left: 0;
    width: 100%; height: 100%; background: rgba(0,0,0,0.9);
    align-items: center; justify-content: center;
}
#image-viewer.active { display: flex; }
#full-image { max-width: 100%; max-height: 100%; object-fit: contain; }
#close-btn {
    position: absolute; top: 20px; right: 20px;
    background: rgba(255,255,255,0.2); color: #fff; border: none;
    width: 40px; height: 40px; border-radius: 50%; font-size: 24px; cursor: pointer;
}