@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Montserrat:wght@300;400;500;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: #f8f9fa;
    color: #2d2d2d;
    background-color: #f8f9fa;
    color: #333;
}

.logo,
.product-title,
.detail-section h4 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    letter-spacing: 1px;
}
.modal-header h2,
.product-actions,
.btn {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
}

/* ========== ИЗМЕНЕНИЯ ЗДЕСЬ ========== */
.product-price {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    color: #000000; /* Цвет цифр черный */
    font-size: 22px;
    font-weight: bold;
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: flex-start !important; /* Жестко прижимает к левому краю */
    gap: 0 !important;
}

.modal-price {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 32px;
    font-weight: bold;
    color: #000000; /* Цвет цифр черный */
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: flex-start !important; /* Жестко прижимает к левому краю */
    gap: 0 !important;
}
/* ===================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.header {
    --header-start: #941f39;
    --header-middle: #ae3458;
    --header-end: #752f65;
    background-image: linear-gradient(115deg, var(--header-start), var(--header-middle), var(--header-end), var(--header-start));
    background-size: 220% 100%;
    box-shadow: 0 3px 14px rgba(58, 15, 36, 0.18);
    color: white;
    padding: 15px 64px 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

@keyframes header-gradient {
    from { background-position: 0% 50%; }
    to { background-position: 100% 50%; }
}

@media (prefers-reduced-motion: no-preference) {
    .header {
        animation: header-gradient 14s ease-in-out infinite alternate;
    }
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: bold;
}

.shop-logo-link {
    display: flex;
    align-items: center;
    gap: inherit;
    color: inherit;
    text-decoration: none;
}

.logo i {
    font-size: 28px;
}

.search-container {
    display: flex;
    gap: 10px;
    flex: 1;
    max-width: 400px;
}

#searchInput {
    padding: 10px 15px;
    border: none;
    border-radius: 25px;
    width: 100%;
    font-size: 14px;
}

.search-container button {
    background: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    color: #ff6b8b;
    transition: transform 0.2s;
}

.search-container button:hover {
    transform: scale(1.05);
}

.user-actions {
    display: flex;
    gap: 20px;
    align-items: center;
}

.theme-switch {
    position: absolute;
    inset-inline-end: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    width: 48px;
    height: 28px;
    padding: 2px;
    border: 1px solid white;
    border-radius: 20px;
    background: #ffffff40;
    cursor: pointer;
}

.theme-switch-thumb {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    color: #ce0303;
    font: 16px/1 sans-serif;
    transition: transform 0.2s;
}

.theme-switch-thumb::before {
    content: "☀";
}

.theme-switch[aria-checked="true"] .theme-switch-thumb {
    transform: translateX(20px);
}

.theme-switch[aria-checked="true"] .theme-switch-thumb::before {
    content: "☾";
}

.theme-switch:focus-visible {
    outline: 2px solid white;
    outline-offset: 3px;
}

.favorites-icon {
    color: white;
    font-size: 24px;
    transition: transform 0.2s;
}

.favorites-icon:hover,
.favorites-icon[aria-current="page"] {
    transform: scale(1.1);
}

.filters[hidden],
.search-container[hidden] {
    display: none;
}

.favorites-heading,
.favorites-empty,
.search-empty,
.cart-empty {
    text-align: center;
    margin: 30px 0;
}

.favorites-empty a,
.search-empty a,
.cart-empty a {
    display: inline-block;
    margin-top: 15px;
    color: #ce0303;
}

.user-icon {
    position: relative;
    cursor: pointer;
    font-size: 28px;
    transition: transform 0.2s;
}

.user-icon:hover {
    transform: scale(1.05);
}

.user-status {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background-color: #4caf50;
    border-radius: 50%;
    border: 2px solid white;
    display: none;
}

.cart-icon {
    position: relative;
    cursor: pointer;
    font-size: 24px;
    transition: transform 0.2s;
}

.cart-icon:hover {
    transform: scale(1.05);
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: red;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filters {
    display: flex;
    gap: 10px;
    margin: 30px 0;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid #ff6b8b;
    background: white;
    color: #ff6b8b;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.filter-btn.active,
.filter-btn:hover {
    background: #a83153;
    color: white;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
}

.product-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(60, 25, 43, 0.09);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(60, 25, 43, 0.14);
}

.product-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-gallery {
    position: relative;
    align-self: start;
}

.product-gallery-controls button,
.gallery-position {
    position: absolute;
    background: #23171bdb;
    color: white;
}

.product-gallery-controls button {
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    font: 26px/1 sans-serif;
    cursor: pointer;
}

.product-gallery-controls button:hover {
    background: #23171b;
}

.product-gallery-controls button:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

.gallery-prev {
    left: 8px;
}

.gallery-next {
    right: 8px;
}

.gallery-position {
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.product-info {
    padding: 20px;;
}

.product-title {
    font-size: 23px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.product-description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
    color: #666;
    font-size: 20px;
    margin: 8px 0;
    line-height: 1.4;
    font-family: 'Cormorant Garamond', serif;
}

.product-stock {
    margin: 10px 0;
    font-size: 14px;
    color: #4caf50;
}

.product-stock.low-stock {
    color: #f44336;
}

.product-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    font-size: 10px;
}

.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.2s, background 0.2s;
    font-weight: 500;
    font-size: 15px;
}

.btn-buy {
    flex: 1;
    background: #a83153;
    color: white;
}

.btn-buy:hover:not(:disabled) {
    background: #8e2646;
}

.btn-buy:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-like {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    padding: 0;
    background: white;
    color: #ff6b8b;
}

.btn-like svg {
    width: 24px;
    height: 24px;
    fill: white;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linejoin: round;
    transition: fill 0.2s;
}

.btn-like[aria-pressed="true"] svg {
    fill: currentColor;
}

.btn-like:hover {
    background: #f8f9fa;
}

.btn-primary {
    background: #4caf50;
    color: white;
    flex: 1;
}

.btn-primary:hover {
    background: #45a049;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.modal-content {
    background: white;
    margin: 50px auto;
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    overflow: hidden;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px;
    background: #a83153;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
}

.close {
    font-size: 28px;
    cursor: pointer;
    transition: transform 0.2s;
}

.close:hover {
    transform: scale(1.2);
}

.modal-body {
    padding: 30px;
    max-height: 60vh;
    overflow-y: auto;
}

/* ========== ПОЛЯ ВВОДА ========== */
.modal-input {
    width: 100%;
    padding: 12px 15px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.modal-input:focus {
    outline: none;
    border-color: #ff6b8b;
}

/* ========== ОШИБКИ ========== */
.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 15px;
    font-size: 14px;
    text-align: center;
}

.register-link {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    color: #666;
}

.register-link span {
    color: #ff6b8b;
    cursor: pointer;
    font-weight: bold;
    text-decoration: underline;
}

.register-link span:hover {
    color: #ce0303;
}

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

.cart-item-info {
    flex: 1;
}

.cart-item-info h4 {
    margin-bottom: 5px;
}

.cart-item-info p {
    color: #666;
    font-size: 14px;
}

.cart-price {
    display: flex;
    align-items: center;
    gap: 0.3em;
}

.cart-currency {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 0.8em;
    height: 1em;
    overflow: hidden;
}

.cart-currency img {
    flex: none;
    height: 2em;
    width: auto;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.quantity-btn:hover {
    background: #f0f0f0;
    border-color: #ff6b8b;
}

.remove-btn {
    background: #a83153;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s;
}

.remove-btn:hover {
    background: #ce0303;
}

.cart-total {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #eee;
    text-align: right;
}

.cart-total h3 {
    font-size: 18px;
    justify-content: flex-end;
}

.checkout-btn {
    background: #a83153;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
    transition: opacity 0.2s;
    font-weight: bold;
}

.checkout-btn:hover {
    opacity: 0.9;
}

.product-modal-content {
    max-width: 900px !important;
}

.product-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 20px;
}

.product-modal-image img {
    width: 100%;
    border-radius: 10px;
}

.stock-info {
    margin: 10px 0;
    font-size: 14px;
    color: #4caf50;
}

.stock-info.low-stock {
    color: #f44336;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
    font-family: 'Cormorant Garamond', serif;
    font-size: 20px;
}

.quantity-selector label {
    font-weight: 500;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.product-details {
    margin-top: 10px;
    border-top: 1px solid #eee;
    padding-top: 15px;
    font-family: 'Montserrat', sans-serif;
}

.product-full-description {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.detail-section {
    margin-bottom: 15px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.detail-section h4 {
    margin-bottom: 8px;
    color: #ff6b8b;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-section p {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.composition-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.composition-list li {
    padding: 6px 0;
    font-size: 14px;
    border-bottom: 1px solid #eee;
}

.composition-list li:last-child {
    border-bottom: none;
}

.profile-header {
    justify-content: flex-end;
}

.profile-order {
    background: #f8f9fa;
}

.profile-empty {
    color: #999;
}

.store-notice {
    position: fixed;
    inset-inline-end: 20px;
    bottom: 20px;
    z-index: 2100;
    max-width: min(360px, calc(100vw - 40px));
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--dark-surface, white);
    color: var(--dark-text, #333);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.store-notice:empty {
    padding: 0;
}

.checkout-confirmation:not([hidden]) {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    text-align: left;
}

.checkout-confirmation .modal-input {
    margin: 4px 0 0;
    font: inherit;
}

.checkout-time {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-width: 0;
    border: 0;
}

.checkout-time legend {
    margin-bottom: 4px;
}

.checkout-confirmation .admin-actions {
    align-items: center;
}

.checkout-confirmation .checkout-btn {
    margin-top: 0;
}

.quantity-cancel {
    background: var(--dark-raised, #f8f9fa);
    color: inherit;
}

.admin-form {
    display: grid;
    gap: 8px;
    margin-bottom: 20px;
}

.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0;
    padding: 14px;
    border: 1px solid var(--dark-border, #ff6b8b);
    border-radius: 10px;
}

.admin-toolbar > .btn,
.admin-actions > .btn {
    flex: none;
}

.admin-toolbar .admin-form {
    flex-basis: 100%;
    margin: 0;
}

.category-admin {
    max-width: 440px;
    margin: 0 auto 32px;
    text-align: center;
}

.products-grid:empty + .category-admin {
    padding-top: clamp(24px, 7vh, 72px);
}

.category-admin .admin-form {
    margin-top: 12px;
    text-align: left;
}

.admin-toolbar[hidden],
.admin-form[hidden],
.edit-product-button {
    display: none;
}

.editing-store .edit-product-button {
    display: block;
    width: 100%;
    margin-top: 10px;
}

.editing-store .product-card {
    align-self: start;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-name-button,
.edit-product-button,
.admin-cancel {
    border: 1px solid var(--dark-border, #ff6b8b);
    border-radius: 10px;
    background: var(--dark-raised, white);
    color: var(--dark-text, #9e2342);
    cursor: pointer;
}

.admin-name-button {
    padding: 4px 8px;
}

.admin-delete {
    background: #a02640;
    color: white;
}

.admin-delete:hover {
    background: #821f34;
}

.admin-delete-confirmation p {
    margin-bottom: 8px;
}

#productEditorDialog {
    position: fixed;
    inset: 0;
    max-width: 640px;
    max-height: calc(100dvh - 32px);
    margin: auto;
    border: 0;
    color: inherit;
}

#productEditorDialog[open] {
    display: flex;
    flex-direction: column;
}

#productEditorDialog::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

body:has(#productEditorDialog[open]) {
    overflow: hidden;
}

#productEditorDialog .modal-body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#productEditorDialog .close {
    font-family: inherit;
    color: inherit;
    background: transparent;
    border: 0;
}

.product-editor {
    margin: 0;
}

.admin-form .modal-input {
    margin: 4px 0 0;
    font: inherit;
}

.admin-form textarea {
    resize: vertical;
}

[data-theme="dark"] {
    color-scheme: dark;
    --dark-page: #1c171b;
    --dark-surface: #2b2229;
    --dark-raised: #372b34;
    --dark-text: #f8eef4;
    --dark-muted: #d3bfc9;
    --dark-border: #66515e;
    --dark-pink: #ff9db3;
}

[data-theme="dark"] body {
    background: var(--dark-page);
    color: var(--dark-text);
}

[data-theme="dark"] .header {
    --header-start: #4a1b31;
    --header-middle: #77304e;
    --header-end: #44305d;
}

[data-theme="dark"] :is(.product-card, .modal-content, .filter-btn, .btn-like, .quantity-btn) {
    background: var(--dark-surface);
}

[data-theme="dark"] :is(#searchInput, .search-container button, .modal-input, .detail-section, .profile-order, .btn-like:hover, .quantity-btn:hover) {
    background: var(--dark-raised);
}

[data-theme="dark"] :is(#searchInput, .modal-input, .quantity-btn, .product-title, .product-price, .modal-price, .detail-section p) {
    color: var(--dark-text);
}

[data-theme="dark"] :is(.product-description, .cart-item-info p, .register-link, .profile-empty, input::placeholder) {
    color: var(--dark-muted);
}

[data-theme="dark"] :is(.favorites-empty a, .search-empty a, .cart-empty a, .detail-section h4, .register-link span, .search-container button, .filter-btn, .btn-like) {
    color: var(--dark-pink);
}

[data-theme="dark"] :is(.filter-btn.active, .filter-btn:hover, .btn-buy, .checkout-btn, .modal-header, .remove-btn) {
    background: #a63e60;
    color: white;
}

[data-theme="dark"] :is(.btn-buy:hover:not(:disabled), .remove-btn:hover) {
    background: #89314e;
}

[data-theme="dark"] .btn-buy:disabled {
    background: var(--dark-raised);
    color: var(--dark-muted);
}

[data-theme="dark"] :is(.cart-item, .cart-total, .product-details, .composition-list li, .register-link, .modal-input, .quantity-btn) {
    border-color: var(--dark-border);
}

[data-theme="dark"] :is(.modal-input:focus, .quantity-btn:hover) {
    border-color: var(--dark-pink);
}

[data-theme="dark"] :is(.product-stock, .stock-info) {
    color: #8cda96;
}

[data-theme="dark"] .low-stock {
    color: #ff9999;
}

[data-theme="dark"] .error-message {
    background: #48232c;
    color: #ffb4bc;
}

[data-theme="dark"] .btn-like[aria-pressed="false"] svg {
    fill: var(--dark-surface);
}

[data-theme="dark"] img[src="BYN.png"] {
    filter: invert(1);
    mix-blend-mode: screen;
}

.shop-info-link {
    display: inline-block;
    padding: 8px 12px;
    border: 1px solid currentColor;
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.shop-info-link:hover,
.shop-info-link[aria-current="page"] {
    text-decoration: underline;
}

.shop-about {
    max-width: 760px;
    padding-block: 36px;
}

.shop-about-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.shop-about section {
    margin-top: 20px;
    padding: clamp(18px, 4vw, 32px);
    border: 1px solid var(--dark-border, #f3c1cd);
    border-radius: 16px;
    background: var(--dark-surface, white);
    scroll-margin-top: 24px;
}

.shop-about dt {
    margin-top: 18px;
    font-weight: 600;
}

.shop-about dd {
    margin-top: 4px;
    line-height: 1.6;
}

#checkoutStatus {
    grid-column: 1 / -1;
}

.user-icon,
.cart-icon,
.close {
    background: transparent;
    border: 0;
    color: inherit;
    font-family: inherit;
}

.header .shop-info-link {
    border-color: rgba(255, 255, 255, 0.48);
    background-color: rgba(255, 255, 255, 0.1);
}

.header .shop-info-link:hover,
.header .shop-info-link[aria-current="page"] {
    background-color: rgba(255, 255, 255, 0.18);
}

:where(a, button, input, select, textarea):focus-visible {
    outline: 2px solid var(--dark-pink, #972e50);
    outline-offset: 3px;
}

.header :where(a, button, input):focus-visible {
    outline-color: white;
}

@media (max-width: 700px) {
    .container {
        padding-inline: 12px;
    }

    .header {
        padding: 8px 0;
    }

    .store-header .container {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 4px 8px;
    }

    .store-header .logo {
        grid-area: 1 / 1;
        min-width: 0;
        flex-wrap: wrap;
    }

    .shop-logo-link {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .store-header .theme-switch {
        grid-area: 1 / 2;
        position: static;
        transform: none;
        min-height: 44px;
        border-radius: 22px;
    }

    .store-header .user-actions {
        grid-area: 2 / 1 / 3 / -1;
        justify-content: flex-end;
        gap: 6px;
    }

    .user-actions .shop-info-link {
        margin-inline-end: auto;
        font-size: 13px;
    }

    .user-actions :is(.favorites-icon, .user-icon, .cart-icon) {
        display: grid;
        width: 44px;
        height: 44px;
        place-items: center;
        transform: none;
    }

    .cart-count,
    .user-status {
        top: 0;
        right: 0;
    }

    .user-status {
        top: auto;
        bottom: 3px;
    }

    .store-header .search-container {
        grid-area: 3 / 1 / 4 / -1;
        max-width: none;
        min-width: 0;
    }

    #searchInput {
        min-width: 0;
        font-size: 16px;
    }

    .search-container button {
        flex: 0 0 44px;
        height: 44px;
    }

    .filters {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        margin-block: 12px;
        padding: 2px 2px 6px;
        gap: 8px;
    }

    .filter-btn {
        flex: none;
        min-height: 44px;
        padding: 6px 12px;
        white-space: nowrap;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 155px), 1fr));
        gap: 12px;
        margin-bottom: 24px;
    }

    .product-image {
        height: auto;
        aspect-ratio: 1;
    }

    .product-info {
        padding: 10px;
    }

    .product-title {
        font-size: 20px;
        margin-bottom: 4px;
        overflow-wrap: anywhere;
    }

    .product-description {
        font-size: 17px;
        margin: 4px 0;
    }

    .product-stock {
        font-size: 12px;
    }

    .product-card .product-actions {
        gap: 4px;
        margin-top: 8px;
    }

    .product-card .btn-buy {
        min-width: 0;
        padding: 6px;
        font-size: 13px;
        overflow-wrap: anywhere;
    }

    .product-card :is(.btn-buy, .btn-like, .edit-product-button),
    .admin-actions .btn {
        min-height: 44px;
    }

    .product-card .btn-like {
        flex-basis: 44px;
    }

    .product-card:hover,
    .product-card:hover .product-image img {
        transform: none;
    }

    .modal {
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
    }

    .modal > .modal-content {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
        margin: 0 auto;
    }

    .modal-header {
        gap: 8px;
        padding: 6px 12px;
    }

    .modal-header h2 {
        font-size: 18px;
        overflow-wrap: anywhere;
    }

    .modal-body {
        min-height: 0;
        max-height: none;
        padding: 12px;
        overscroll-behavior: contain;
        overflow-wrap: anywhere;
    }

    .close,
    .quantity-btn,
    .remove-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .product-modal-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .product-modal-image img {
        display: block;
        max-height: 38dvh;
        object-fit: contain;
    }

    .cart-item-info {
        min-width: 0;
    }

    .checkout-confirmation > label {
        min-width: 0;
    }

    .checkout-confirmation .checkout-btn {
        width: 100%;
        margin: 0;
    }

    .checkout-time {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #productEditorDialog {
        width: calc(100% - 16px);
    }

    .shop-about {
        padding-block: 24px;
    }

    .shop-about section {
        scroll-margin-top: 120px;
    }
}

@media (min-width: 490px) and (max-width: 700px) {
    .store-header .container {
        grid-template-columns: minmax(0, 1fr) auto auto;
    }

    .store-header .user-actions {
        grid-area: 1 / 2;
    }

    .store-header .theme-switch {
        grid-area: 1 / 3;
    }

    .store-header .search-container {
        grid-area: 2 / 1 / 3 / -1;
    }
}
