body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    padding-bottom: 5rem;
    background-color: #f4f4f4;
    color: #333333;
    line-height: 1.6;
}

header {
    background-color: #ffffff;
    color: #333333;
    text-align: center;
    padding: 2rem 1rem;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    border-bottom: 1px solid #e9ecef;
    position: relative;
    z-index: 100;
    overflow: visible;
}

.header-top {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-social {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.header-social-link {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #333333;
    text-decoration: none;
    border-radius: 50%;
    transition: background-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.header-social-link:hover,
.header-social-link:focus {
    background-color: #f3f4f6;
    color: #000000;
    transform: translateY(-1px);
    outline: none;
}

.header-social-link svg {
    width: 1.35rem;
    height: 1.35rem;
    display: block;
}

header nav {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 1rem;
    align-items: center;
}

header nav button {
    background: transparent;
    color: #333333;
    border: none;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
    transition: all 0.25s ease;
    position: relative;
}

header nav button::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -0.15rem;
    width: 0;
    height: 2px;
    background: #333333;
    border-radius: 999px;
    transition: width 0.3s ease, left 0.3s ease;
}

header nav button:hover,
header nav button:focus {
    color: #000000;
    transform: translateY(-1px);
    outline: none;
}

header nav button:hover::after {
    width: 100%;
    left: 0;
}

header nav button.active::after {
    width: 100%;
    left: 0;
}

header nav button.active {
    color: #000000;
}

/* Секции страниц */
.about-section, .contact-section {
    width: 70%;
    max-width: none;
    margin: 2rem auto;
    padding: 2rem;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.about-section h2 {
    color: #333333;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.about-section p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #555555;
    text-align: justify;
}

.contact-section h2 {
    color: #333333;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-info p {
    font-size: 1.1rem;
    color: #555555;
    margin: 0;
}

.contact-info strong {
    color: #333333;
}

/* Карта */
.map-container {
    margin-top: 2rem;
}

.map-container iframe {
    width: 100%;
    height: 400px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 2px solid #e9ecef;
}

/* Мобильная адаптация карты */
@media (max-width: 768px) {
    .map-container iframe {
        height: 300px;
    }
}

/* Нижняя панель действий по прототипу Telegram */
.bottom-panel {
    position: fixed;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    max-width: calc(100% - 2rem);
    background: #ffffff;
    border-radius: 16px;
    border: 3px solid #cccccc;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.16);
    padding: 0.5rem 0.75rem;
    z-index: 1000;
}

.bottom-panel.admin-panel {
    max-width: calc(100% - 2rem);
}

/* Отступ снизу, чтобы контент не перекрывался панелью */
.main-layout {
    margin-bottom: 0;
}

.bottom-panel button {
    flex: 0 1 auto;
    min-width: 90px;
    margin: 0 0.35rem;
    border: none;
    border-radius: 12px;
    background: #f8f9fa;
    color: #333333;
    padding: 0.55rem 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    white-space: nowrap;
    flex-wrap: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: normal;
    position: relative;
}

.bottom-panel button.has-chat-badge {
    padding-right: 1.35rem;
}

.bottom-panel button.has-chat-order-attention {
    background: linear-gradient(180deg, #fff9ef 0%, #fff4da 100%);
    box-shadow: 0 0 0 0 rgba(215, 160, 67, 0.18);
    animation: chat-order-attention-pulse 2.4s ease-in-out infinite;
}

.bottom-panel button.has-chat-order-attention svg {
    color: inherit;
}

@keyframes chat-order-attention-pulse {
    0%, 100% {
        transform: translateY(0);
        box-shadow: 0 0 0 0 rgba(215, 160, 67, 0.12);
        background: linear-gradient(180deg, #fffaf2 0%, #fff6e4 100%);
    }

    50% {
        transform: translateY(-1px);
        box-shadow: 0 0 0 8px rgba(215, 160, 67, 0.06), 0 8px 18px rgba(215, 160, 67, 0.14);
        background: linear-gradient(180deg, #fff4dc 0%, #ffecc7 100%);
    }
}

.chat-unread-badge {
    position: absolute;
    top: 0.2rem;
    right: 0.28rem;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.28rem;
    border-radius: 999px;
    background: #f3dfc4;
    border: 1px solid #d3b487;
    color: #7a5530;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.05rem;
    text-align: center;
    box-shadow: none;
    display: none;
    pointer-events: none;
}

.bottom-panel button svg {
    display: block;
    flex-shrink: 0;
    width: 1.2rem;
    height: 1.2rem;
}

.bottom-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    font-size: 1rem;
    vertical-align: middle;
}

.bottom-panel button:hover {
    background: #e9ecef;
}

.bottom-panel button:active {
    background: #dce0e4;
}

/* Отступ снизу, чтобы контент не перекрывался панелью */
.main-layout {
    margin-bottom: 0;
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 300;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

header h1 a {
    color: inherit;
    text-decoration: none;
}

header nav {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 1rem;
    align-items: center;
}



/* Корзина */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: #f8f9fa;
}

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

.cart-item button,
.cart-action-btn {
    background: linear-gradient(135deg, #333333 0%, #666666 50%, #333333 100%);
    background-size: 200% 200%;
    color: white;
    border: none;
    border-radius: 25px;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    margin-left: 0.5rem;
    font-weight: bold;
    transition: all 0.3s ease, background-position 0.5s ease;
    opacity: 0.8;
}

.cart-item button:hover,
.cart-action-btn:hover {
    background-position: right bottom;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(51, 51, 51, 0.4);
    opacity: 1;
}

/* Стиль для кнопки удаления - ярко-красный градиент */
.cart-action-btn.delete-btn {
    background: linear-gradient(135deg, #c62828 0%, #ef5350 50%, #c62828 100%) !important;
    background-size: 200% 200% !important;
    color: white !important;
    transition: all 0.3s ease, background-position 0.5s ease !important;
}

.cart-action-btn.delete-btn:hover {
    background: linear-gradient(135deg, #c62828 0%, #ef5350 50%, #c62828 100%) !important;
    background-size: 200% 200% !important;
    background-position: right bottom !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(198, 40, 40, 0.4) !important;
    opacity: 1 !important;
}

/* Стиль для кнопки оформления заказа - ярко-зеленый градиент */
.cart-action-btn.checkout-btn {
    background: linear-gradient(135deg, #1b5e20 0%, #4caf50 50%, #1b5e20 100%) !important;
    background-size: 200% 200% !important;
    color: white !important;
    transition: all 0.3s ease, background-position 0.5s ease !important;
}

.cart-action-btn.checkout-btn:hover {
    background: linear-gradient(135deg, #1b5e20 0%, #4caf50 50%, #1b5e20 100%) !important;
    background-size: 200% 200% !important;
    background-position: right bottom !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(27, 94, 32, 0.4) !important;
    opacity: 1 !important;
}

/* Chat page styles */
.chat-page {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 1rem;
    padding: 1rem;
    max-width: 1400px;
    margin: auto;
}

.chat-header-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

.chat-header-row h1 {
    margin: 0;
    font-size: 2rem;
}

.back-button {
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 12px;
    padding: 0.65rem 1rem;
    cursor: pointer;
    font-weight: 700;
}

.chat-sidebar {
    background: #ffffff;
    border-radius: 24px;
    border: 1px solid #e8eaed;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: calc(100vh - 6rem);
    overflow: hidden;
}

.chat-sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border-bottom: 1px solid #eef1f4;
    padding-bottom: 0.75rem;
}

.chat-sidebar-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.chat-sidebar-subtitle {
    margin: 0;
    color: #666666;
    font-size: 0.95rem;
}

.chat-mode-switcher {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.mode-btn {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #e9ecef;
    background: #fafafb;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s, border-color 0.2s;
}

.mode-btn.active {
    background: #e0f2ff;
    border-color: #3b82f6;
    color: #1e40af;
}

.mode-btn:hover {
    background: #f0f5ff;
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.25rem;
}

.chat-list-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #444444;
    margin-bottom: 0.4rem;
}

.chat-list-item {
    border: 1px solid #e9ecef;
    border-radius: 18px;
    background: #fafafb;
    padding: 0.85rem 1rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-height: 72px;
    width: 100%;
}

.chat-list-item:hover,
.chat-list-item.active {
    background: #f0f5ff;
    transform: translateY(-1px);
}

.chat-list-item-title {
    font-weight: 700;
    font-size: 1rem;
    color: #1f2937;
}

.chat-list-item-subtitle {
    font-size: 0.88rem;
    color: #6b7280;
}

.chat-badge {
    position: absolute;
    top: 12px;
    right: 14px;
    min-width: 1.35rem;
    height: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f7ead7;
    border: 1px solid #dbc29d;
    color: #7a5530;
    border-radius: 999px;
    padding: 0 0.38rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1;
    box-shadow: none;
}

.chat-main {
    background: #ffffff;
    border-radius: 24px;
    border: 1px solid #e8eaed;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 6rem);
    overflow: hidden;
}

.chat-main-header {
    border-bottom: 1px solid #eef1f4;
    padding: 1rem 1.25rem;
}

.chat-main-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.chat-order-status-panel {
    border-top: 1px solid #eef1f4;
    padding: 0.9rem 1.25rem 0;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    background: #ffffff;
}

.chat-order-select {
    min-width: 240px;
    flex: 1 1 260px;
    min-height: 42px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 0.55rem 0.75rem;
    background: #ffffff;
    font: inherit;
}

.chat-subtitle {
    margin: 0.5rem 0 0;
    color: #6b7280;
    font-size: 0.95rem;
}

.chat-thread {
    flex: 1;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    background: #f8f9fb;
    max-height: 60vh;
}

.chat-empty {
    color: #6b7280;
    padding: 1.5rem;
    text-align: center;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 18px;
}

.chat-message {
    display: flex;
    justify-content: flex-start;
}

.chat-message.chat-admin {
    justify-content: flex-end;
}

.chat-message-body {
    max-width: 85%;
    background: #ffffff;
    border-radius: 22px;
    border: 1px solid #e9ecef;
    padding: 0.95rem 1rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.chat-message.chat-admin .chat-message-body {
    background: #e0f2ff;
}

.chat-message-sender {
    font-weight: 700;
    margin-bottom: 0.45rem;
    color: #111827;
}

.chat-message-text {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
    color: #374151;
    line-height: 1.5;
}

.chat-message-image-link {
    display: inline-block;
    margin-bottom: 0.6rem;
    max-width: 100%;
}

.chat-message-media {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.55rem;
    max-width: min(360px, 100%);
    text-align: left;
}

.chat-message-media .chat-message-image-link {
    margin-bottom: 0;
}

.chat-message-caption {
    width: 100%;
    padding: 0.78rem 0.9rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
    color: #1f2937;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-message.chat-admin .chat-message-caption,
.chat-admin .chat-message-caption {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(56, 189, 248, 0.24);
}

.chat-message.chat-user .chat-message-caption,
.chat-user .chat-message-caption {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(239, 246, 255, 0.96) 100%);
    border-color: rgba(96, 165, 250, 0.28);
}

.chat-message-image {
    display: block;
    max-width: min(360px, 100%);
    max-height: 420px;
    border-radius: 16px;
    border: 1px solid #d9e2ec;
    background: #ffffff;
    object-fit: cover;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
}

.chat-message-date {
    margin-top: 0.65rem;
    font-size: 0.78rem;
    color: #9ca3af;
}

.chat-input-panel {
    border-top: 1px solid #eef1f4;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
    background: #ffffff;
}

.quick-replies-panel {
    position: relative;
    flex: 0 0 auto;
}

.quick-replies-toggle-btn {
    position: relative;
}

.quick-replies-toggle-btn.is-active {
    border-color: #3b82f6;
    color: #2563eb;
    background: #eff6ff;
}

.quick-replies-popover {
    position: absolute;
    left: 0;
    bottom: calc(100% + 0.75rem);
    width: min(420px, calc(100vw - 3rem));
    display: none;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.8rem;
    border: 1px solid #dbe5f0;
    border-radius: 18px;
    background: #f8fbff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
    z-index: 4;
}

.quick-replies-panel.is-open .quick-replies-popover {
    display: flex;
}

.quick-reply-title-input,
.quick-reply-message-input {
    width: 100%;
    font: inherit;
}

.quick-replies-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    max-height: 138px;
    overflow-y: auto;
    padding-right: 0.2rem;
}

.quick-reply-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 100%;
    border: 1px solid #d7e4f3;
    border-radius: 999px;
    background: #ffffff;
    padding: 0.35rem 0.45rem 0.35rem 0.7rem;
}

.quick-reply-chip-label {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.83rem;
    color: #1f2937;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.quick-reply-chip-delete {
    border: none;
    background: transparent;
    padding: 0.15rem 0.35rem;
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
}

.quick-reply-chip-delete {
    color: #b91c1c;
    font-size: 1rem;
    line-height: 1;
}

.quick-reply-chip-label:hover,
.quick-reply-chip-delete:hover {
    background: #eef4fb;
}

.quick-replies-create {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
    align-items: end;
}

.quick-reply-title-input {
    min-height: 40px;
}

.quick-reply-message-input {
    min-height: 74px;
    border: 1px solid #d1d5db;
    border-radius: 14px;
    padding: 0.75rem 0.85rem;
    resize: vertical;
}

.quick-replies-empty {
    color: #6b7280;
    font-size: 0.9rem;
}

.chat-composer-row {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    width: 100%;
}

.chat-attach-btn {
    width: 48px;
    min-width: 48px;
    height: 48px;
    border: 1px solid #d1d5db;
    border-radius: 14px;
    background: #ffffff;
    color: #374151;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.chat-attach-btn svg {
    width: 20px;
    height: 20px;
}

.chat-attach-btn:hover,
.chat-attach-btn:focus {
    border-color: #3b82f6;
    color: #2563eb;
    background: #eff6ff;
    transform: translateY(-1px);
    outline: none;
}

.chat-attach-btn.is-disabled,
.chat-attach-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.chat-image-preview {
    display: none;
}

.chat-image-preview.is-visible {
    display: block;
}

.chat-image-preview-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 1px solid #d8e2ee;
    border-radius: 16px;
    background: #f8fbff;
    box-sizing: border-box;
}

.chat-image-preview-thumb {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid #d8e2ee;
    background: #ffffff;
    flex: 0 0 auto;
}

.chat-image-preview-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    flex: 1;
}

.chat-image-preview-meta strong,
.chat-image-preview-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-image-preview-meta strong {
    font-size: 0.92rem;
    color: #111827;
}

.chat-image-preview-meta span {
    font-size: 0.82rem;
    color: #6b7280;
}

.chat-image-remove-btn {
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.1rem 0.25rem;
    border-radius: 10px;
}

.chat-image-remove-btn:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}

.chat-input-panel textarea {
    width: 100%;
    flex: 1;
    min-height: 84px;
    border: 1px solid #d1d5db;
    border-radius: 18px;
    padding: 1rem;
    resize: vertical;
    font-family: inherit;
    font-size: 1rem;
    overflow-y: hidden;
    transition: height 0.24s ease, border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.chat-input-panel textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.chat-input-panel textarea.chat-input-auto-grow.is-expanded,
.chat-input-container textarea.chat-input-auto-grow.is-expanded {
    background: #fcfdff;
}

@media (max-width: 1000px) {
    .chat-page {
        grid-template-columns: 1fr;
    }

    .chat-sidebar {
        min-height: auto;
    }

    .chat-main {
        min-height: auto;
    }
}

@media (max-width: 720px) {
    .chat-sidebar,
    .chat-main {
        border-radius: 18px;
    }

    .chat-order-status-panel,
    .chat-input-panel {
        flex-direction: column;
        gap: 0.75rem;
    }

    .quick-replies-create {
        grid-template-columns: 1fr;
    }

    .quick-replies-popover {
        left: 0;
        right: auto;
        width: min(340px, calc(100vw - 2.5rem));
    }

    .chat-composer-row {
        flex-direction: column;
        align-items: stretch;
    }

    .chat-attach-btn,
    .chat-composer-row .cart-action-btn {
        width: 100%;
        min-width: 0;
        height: 46px;
    }
}


#cartSummary {
    margin-top: 1rem;
    font-weight: bold;
    font-size: 1.05rem;
    color: #212529;
    text-align: right;
    display: none;
}

/* Стили корзины внутри модального окна */
#cartModal .modal-content {
    max-width: 740px;
    width: 92%;
    padding: 2rem;
    border-radius: 28px;
    background: #f7f9fb;
    box-shadow: 0 20px 50px rgba(15, 32, 64, 0.15);
}

#cartModal .modal-content h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
    letter-spacing: -0.02em;
    color: #111827;
}

#cartItems {
    display: grid;
    gap: 1rem;
}

#cartModal .cart-item {
    display: grid;
    grid-template-columns: 90px minmax(150px, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.2rem;
    border-radius: 22px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #ffffff;
}

#cartModal .cart-item img {
    width: 90px;
    height: 90px;
    border-radius: 18px;
    object-fit: contain;
    background: #f3f4f6;
    padding: 8px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

#cartModal .cart-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

#cartModal .cart-item-info strong {
    font-size: 1rem;
    color: #111827;
    line-height: 1.4;
    cursor: pointer;
    transition: color 0.2s ease;
}

#cartModal .cart-item-info strong:hover {
    color: #3b82f6;
}

#cartModal .cart-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    color: #6b7280;
    font-size: 0.95rem;
}

#cartModal .cart-item-meta span {
    display: inline-flex;
    align-items: center;
}

#cartModal .cart-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.6rem;
}

#cartModal .count-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 999px;
    background: #f3f4f6;
    padding: 0.25rem 0.4rem;
}

#cartModal .count-controls button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #ffffff;
    color: #111827;
    cursor: pointer;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

#cartModal .count-controls button:hover {
    transform: translateY(-1px);
    background: #eef2ff;
}

#cartModal .cart-quantity {
    min-width: 24px;
    text-align: center;
    font-weight: 700;
    color: #111827;
}

#cartModal .remove-button {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(59, 130, 246, 0.18);
    border-radius: 50%;
    background: #ffffff;
    color: #ef4444;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

#cartModal .remove-button:hover {
    transform: translateY(-2px);
    background: #fee2e2;
    box-shadow: 0 8px 14px rgba(239, 68, 68, 0.12);
}

#cartModal button.checkout-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: 18px;
    font-size: 1rem;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    border: none;
    background: linear-gradient(180deg, #fafcfa 0%, #f5f9f5 100%);
    box-shadow: 0 10px 26px rgba(16, 26, 48, 0.04);
}

#cartModal #checkoutTotal {
    font-size: 1rem;
    font-weight: 700;
    color: #f7fafc;
    letter-spacing: 0.02em;
}

#cartModal .checkout-divider {
    width: 1px;
    height: 24px;
    background: rgba(247, 250, 252, 0.5);
}

#cartModal #checkoutText {
    font-size: 1rem;
    font-weight: 700;
    color: #f7fafc;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#cartModal button.checkout-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(16, 26, 48, 0.12);
}


#cartModal .modal-content .close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    color: #6b7280;
}

#cartModal .modal-content .close:hover {
    color: #111827;
}

/* Прозрачность для всех кнопок в модальном окне корзины */
#cartModal button {
    opacity: 1;
}

#cartModal button:hover {
    opacity: 1;
}

@media (max-width: 768px) {
    header nav {
        position: static;
        text-align: center;
        margin-top: 1rem;
    }

    header nav button {
        margin: 0.25rem;
    }

    .header-social {
        position: static;
        transform: none;
        margin-top: 0.75rem;
        justify-content: center;
    }

    .header-top {
        flex-direction: column;
    }
}

/* Основная разметка */
.main-layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    margin-bottom: 2rem;
}

/* Категории */
.categories-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
    background-color: #ffffff;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    margin-bottom: 2rem;
    overflow: visible;
}

.categories-list {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 1rem;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.categories-section {
    position: relative;
}

.category-item {
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
    white-space: nowrap;
    flex-shrink: 0;
    color: #333333;
    text-decoration: none;
}

#subcategoriesList {
    display: none;
    width: 100%;
    background: #ffffff;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    z-index: 1000;
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    white-space: nowrap;
    overflow-x: auto;
    margin-top: 0.5rem;
}

#subcategoriesList .category-item {
    background: #f7f7f7;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.25rem 0.6rem;
}

#subcategoriesList .category-item.active {
    background: linear-gradient(135deg, #333333 0%, #666666 50%, #333333 100%);
    background-size: 200% 200%;
    color: #ffffff;
    border-color: #333333;
    font-weight: bold;
    transition: all 0.3s ease, background-position 0.5s ease;
}


.category-group:hover .subcategory-list {
    display: flex;
}


.subcategory-item {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    color: #555555;
    width: auto;
}

.subcategory-item:hover {
    text-decoration: underline;
}

.category-item:hover {
    text-decoration: underline;
}

.category-item.active {
    font-weight: bold;
    text-decoration: underline;
}

.subcategory-item {
    padding-left: 0.8rem;
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Основной контент */
.main-content {
    width: 100%;
    min-width: 0;
    padding-right: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
}

/* Баннеры */
.banners-section {
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 1;
    transform: translateY(0);
    position: relative;
    z-index: 1;
}

.banners-container {
    position: relative;
    width: 1280px;
    height: 524px;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    z-index: 1;
}

@media (max-width: 1300px) {
    .banners-container {
        width: 100%;
        max-width: 1280px;
        height: 400px;
    }
}

@media (max-width: 768px) {
    .banners-container {
        height: 300px;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutToLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

.banner-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
}

.banner-slide.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
    z-index: 10;
}

.banner-slide.prev {
    animation: slideOutToLeft 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.banner-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-click-area {
    display: block;
    background: rgba(0, 0, 0, 0.0);
    border: none;
    cursor: pointer;
    z-index: 2;
}

.banner-nav {
    position: absolute;
    top: 25%;
    height: 50%;
    width: 50px;
    background: #6c757d;
    color: white;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 28px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
    opacity: 0.1;
}

.banner-nav.prev {
    left: 0;
    border-radius: 0 15px 15px 0;
}

.banner-nav.next {
    right: 0;
    border-radius: 15px 0 0 15px;
}

.banner-nav:hover {
    background: #5a6268;
    opacity: 0.4;
    box-shadow: 0 6px 16px rgba(108, 117, 125, 0.5);
}

.banner-nav:active {
    transform: scale(0.98);
}

/* Товары */
.products-section {
    background-color: #ffffff;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 1;
    transform: translateY(0);
}

.products-section h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
}

.product-controls {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(170px, 220px) minmax(150px, 190px);
    gap: 0.65rem;
    margin-bottom: 1rem;
    align-items: center;
    padding: 0.65rem;
    border: 1px solid #e3e8ef;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(17, 24, 39, 0.06);
}

.search-input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 0.65rem 0.85rem;
    border: 1px solid #dbe3eb;
    border-radius: 8px;
    background: #f8fafc;
    color: #111827;
    font: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.sort-select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 0.65rem 2rem 0.65rem 0.85rem;
    border: 1px solid #dbe3eb;
    border-radius: 8px;
    background: #f8fafc;
    color: #111827;
    font: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input::placeholder {
    color: #8a94a6;
}

.search-input:focus,
.sort-select:focus {
    outline: none;
    border-color: #111827;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

.catalog-filters-button {
    width: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 44px;
    margin: 0;
    padding: 0.65rem 0.95rem;
    border: 1px solid #1f2937;
    border-radius: 8px;
    background: #111827;
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0;
    opacity: 0.5;
    box-shadow: 0 10px 22px rgba(17, 24, 39, 0.16);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.catalog-filters-button:hover {
    background: #0f172a;
    border-color: #0f172a;
    opacity: 1;
    box-shadow: 0 14px 28px rgba(17, 24, 39, 0.2);
    transform: translateY(-1px);
}

.catalog-filters-button:focus {
    outline: 2px solid rgba(17, 24, 39, 0.22);
    outline-offset: 3px;
}

.catalog-filters-button[aria-expanded="true"] {
    background: #ffffff;
    color: #111827;
    border-color: #d7dde5;
    opacity: 1;
    box-shadow: 0 8px 20px rgba(17, 24, 39, 0.08);
}

.catalog-filters-button-icon {
    position: relative;
    width: 18px;
    height: 14px;
    border-top: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
}

.catalog-filters-button-icon::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 3px;
    right: 3px;
    border-top: 2px solid currentColor;
}

.catalog-filters {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 1px solid #e3e8ef;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(17, 24, 39, 0.06);
}

.catalog-filters-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.catalog-filters-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.catalog-filters-head h3 {
    margin: 0 0 0.15rem;
    font-size: 0.98rem;
}

.catalog-filters-head p {
    margin: 0;
    color: #667085;
    font-size: 0.84rem;
    line-height: 1.35;
}

.catalog-filters-clear {
    border: 1px solid #d8dee4;
    border-radius: 8px;
    background: #ffffff;
    color: #344054;
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.catalog-filters-clear:hover {
    border-color: #c5d1dc;
    background: #eff4f9;
    transform: translateY(-1px);
}

.catalog-filters-clear:focus {
    outline: 2px solid rgba(59, 130, 246, 0.25);
    outline-offset: 2px;
}

.catalog-filter-grid {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 0.75rem;
}

.catalog-filter-card {
    padding: 0.8rem 0;
    border-top: 1px solid #eef2f6;
    background: #ffffff;
}

.catalog-filter-card h4 {
    margin: 0 0 0.6rem;
    font-size: 0.9rem;
}

.catalog-price-slider {
    position: relative;
    height: 34px;
    margin: 0.1rem 0 0.7rem;
}

.catalog-price-slider-track {
    position: absolute;
    left: 0;
    right: 0;
    top: 16px;
    height: 4px;
    border-radius: 999px;
    background: #e5e7eb;
}

.catalog-price-slider input[type="range"] {
    position: absolute;
    left: 0;
    top: 8px;
    width: 100%;
    height: 20px;
    margin: 0;
    pointer-events: none;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
}

.catalog-price-slider input[type="range"]::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
    border: 2px solid #111827;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    pointer-events: auto;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: 0 2px 8px rgba(17, 24, 39, 0.18);
}

.catalog-price-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.08);
}

.catalog-price-slider input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 2px solid #111827;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 8px rgba(17, 24, 39, 0.18);
}

.catalog-price-slider input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.08);
}

#priceRangeMin::-webkit-slider-thumb {
    border-color: #111827;
}

#priceRangeMax::-webkit-slider-thumb {
    border-color: #4b5563;
}

#priceRangeMin::-moz-range-thumb {
    border-color: #111827;
}

#priceRangeMax::-moz-range-thumb {
    border-color: #4b5563;
}

.catalog-price-slider input[type="range"]::-webkit-slider-runnable-track {
    background: transparent;
}

.catalog-price-slider input[type="range"]::-moz-range-track {
    background: transparent;
}

.catalog-price-range {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.catalog-price-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: #475467;
}

.catalog-price-field input {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid #dbe3eb;
    border-radius: 8px;
    font: inherit;
}

.catalog-characteristic-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.55rem;
    align-items: start;
}

.catalog-characteristic-group {
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.catalog-characteristic-group-title {
    margin: 0 0 0.4rem;
    font-size: 0.84rem;
    font-weight: 700;
    color: #344054;
}

.catalog-characteristic-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.45rem;
    align-items: flex-start;
}

.catalog-characteristic-option {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    padding: 0.3rem 0.55rem;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e6ebf1;
    color: #475467;
    font-size: 0.82rem;
    line-height: 1.2;
}

.catalog-characteristic-option:hover {
    border-color: #cfd8e3;
    background: #f3f6f9;
}

.catalog-characteristic-option input {
    margin: 0;
    width: 0.82rem;
    height: 0.82rem;
}

.catalog-characteristic-empty {
    grid-column: 1 / -1;
    color: #98a2b3;
    font-size: 0.84rem;
}

@media (max-width: 860px) {
    .product-controls {
        grid-template-columns: 1fr;
        padding: 0.55rem;
    }

    .catalog-filters-head,
    .catalog-filter-grid {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .catalog-price-range {
        grid-template-columns: 1fr;
    }

    .catalog-characteristic-groups {
        grid-template-columns: 1fr;
    }
}

.products-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.product {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    transition: transform 0.3s, box-shadow 0.3s;
}

.product:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.product img {
    width: 100%;
    height: 280px;
    object-fit: contain;
    border-radius: 10px;
    margin-bottom: 1rem;
    background-color: #f8f9fa;
}

.product h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.product p {
    margin: 0.25rem 0;
    color: #666;
    font-size: 0.9rem;
}

.add-to-cart-btn {
    background: linear-gradient(135deg, #333333 0%, #666666 50%, #333333 100%);
    background-size: 200% 200%;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease, background-position 0.5s ease;
    width: 100%;
    margin-top: 0.5rem;
    opacity: 0.8;
}

.add-to-cart-btn:hover {
    background-position: right bottom;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(51, 51, 51, 0.4);
    opacity: 1;
}

.add-to-cart-btn:active {
    transform: translateY(0);
}

/* Страница товара */
.product-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
}

.product-gallery {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.product-main-image {
    width: 100%;
    max-width: 500px;
    height: 500px;
    object-fit: contain;
    border-radius: 10px;
    background-color: #f8f9fa;
    margin-bottom: 1rem;
}

.image-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #333333 0%, #666666 50%, #333333 100%);
    background-size: 200% 200%;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease, background-position 0.5s ease;
    opacity: 0.35;
}

.image-nav-btn:hover {
    background-position: right bottom;
    transform: translateY(-50%) translateY(-2px);
    box-shadow: 0 4px 12px rgba(51, 51, 51, 0.4);
    opacity: 1;
}

.prev-btn {
    left: 10px;
}

.next-btn {
    right: 10px;
}

.thumbnail-gallery {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.3s;
}

.thumbnail.active {
    border-color: #333;
}

/* ===== Полноэкранный просмотр фото ===== */
.image-modal {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 999;
    align-items: center;
    justify-content: center;
}

.image-modal.show {
    display: flex !important;
}

.image-modal-content {
    position: relative;
    width: 90%;
    height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: pointer;
    transition: none;
    user-select: none;
}

.fullscreen-image.zoomed {
    cursor: grab;
    transform: scale(2);
}

.product-info h1 {
    margin-top: 0;
    margin-bottom: 1rem;
}

/* ===== Кнопки навигации в полноэкранным просмотре ===== */
.fullscreen-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #333333 0%, #666666 50%, #333333 100%);
    background-size: 200% 200%;
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease, background-position 0.5s ease;
    z-index: 999;
    opacity: 0.35;
}

.fullscreen-nav-btn:hover {
    background-position: right bottom;
    transform: translateY(-50%) translateY(-2px);
    box-shadow: 0 4px 12px rgba(51, 51, 51, 0.4);
    opacity: 1;
}

.fullscreen-nav-btn.prev-btn {
    left: 20px;
}

.fullscreen-nav-btn.next-btn {
    right: 20px;
}

/* Product gallery refresh */
.product-gallery {
    gap: 1rem;
}

.product-gallery-stage {
    position: relative;
    width: 100%;
    max-width: 540px;
    padding: 1rem;
    border-radius: 28px;
    background: #ffffff;
    border: 1px solid #e8eaed;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.product-gallery-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0));
    pointer-events: none;
}

.product-gallery-meta {
    position: absolute;
    top: 0.9rem;
    left: 0.9rem;
    right: 0.9rem;
    z-index: 3;
    display: none;
    justify-content: flex-start;
    align-items: center;
    gap: 0.75rem;
}

.gallery-image-counter {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #1f2937;
    border: 1px solid rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

.gallery-image-counter {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.product-gallery-track {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    border-radius: 22px;
    background: #ffffff;
    overflow: hidden;
    border: 1px solid #eceff2;
    transition: border-color 0.28s ease, transform 0.28s ease, background-color 0.32s ease;
    cursor: grab;
    touch-action: pan-y;
}

.product-gallery-track.is-dragging {
    cursor: grabbing;
    border-color: #dcdfe4;
    background: #fbfbfc;
}

.product-main-image {
    position: absolute;
    inset: 1rem;
    width: calc(100% - 2rem);
    height: calc(100% - 2rem);
    margin-bottom: 0;
    border-radius: 18px;
    background-color: transparent;
    object-fit: contain;
    user-select: none;
    will-change: transform, opacity, filter;
    transition: transform 0.3s ease, filter 0.3s ease, opacity 0.3s ease;
    z-index: 1;
}

.product-main-image-ghost {
    opacity: 0;
    pointer-events: none;
    z-index: 2;
}

.product-gallery-track:hover .product-main-image {
    filter: none;
}

.product-gallery-stage .image-nav-btn,
.fullscreen-nav-btn,
.image-modal-close-btn {
    width: 50px;
    height: 50px;
    border-radius: 25px;
    background: linear-gradient(135deg, #333333 0%, #666666 50%, #333333 100%);
    background-size: 200% 200%;
    color: #ffffff;
    border: none;
    opacity: 0.35;
    box-shadow: none;
    transition: all 0.3s ease, background-position 0.5s ease;
}

.product-gallery-stage .image-nav-btn {
    z-index: 6;
}

.product-gallery-stage:hover .image-nav-btn,
.product-gallery-stage:focus-within .image-nav-btn {
    opacity: 0.35;
}

.product-gallery-stage .image-nav-btn:hover,
.fullscreen-nav-btn:hover,
.image-modal-close-btn:hover {
    background-position: right bottom;
    box-shadow: 0 4px 12px rgba(51, 51, 51, 0.4);
    opacity: 1;
}

.product-gallery-stage .prev-btn {
    left: 1rem;
}

.product-gallery-stage .next-btn {
    right: 1rem;
}

.thumbnail-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(72px, 88px));
    gap: 0.75rem;
    width: 100%;
    justify-content: center;
}

.thumbnail {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    object-position: center;
    border-radius: 16px;
    border: 1px solid rgba(203, 213, 225, 0.8);
    background: #fff;
    padding: 0.2rem;
    opacity: 0.72;
    transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease, opacity 0.24s ease;
}

.thumbnail:hover {
    transform: translateY(-2px);
    opacity: 1;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
}

.thumbnail.active {
    border-color: #2f2f2f;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
    opacity: 1;
    transform: translateY(-2px) scale(1.03);
}

.image-modal {
    inset: 0;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.9);
}

.image-modal-content {
    width: min(96vw, 1400px);
    height: min(92vh, 980px);
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.03);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.image-modal-topbar {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 5rem;
    z-index: 3;
    display: none;
    justify-content: flex-start;
    align-items: center;
    gap: 0.75rem;
}

.fullscreen-image-viewport {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: grab;
}

.fullscreen-image-viewport.is-dragging {
    cursor: grabbing;
}

.fullscreen-image {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 100%;
    height: 100%;
    max-width: min(88vw, 1100px);
    max-height: min(84vh, 860px);
    object-fit: contain;
    cursor: inherit;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease, filter 0.28s ease;
    will-change: transform, opacity, filter;
    filter: none;
    z-index: 1;
}

.fullscreen-image-ghost {
    opacity: 0;
    pointer-events: none;
    z-index: 2;
}

.image-modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 4;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: translateY(0);
}

.image-modal-close-btn:hover {
    transform: translateY(-2px);
}

.fullscreen-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    z-index: 999;
}

.fullscreen-nav-btn:hover {
    transform: translateY(-50%) translateY(-2px);
}

.fullscreen-nav-btn.prev-btn {
    left: 1.25rem;
}

.fullscreen-nav-btn.next-btn {
    right: 1.25rem;
}

@media (max-width: 768px) {
    .admin-product-summary,
    .admin-product-characteristic {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-product-grid {
        grid-template-columns: 1fr;
    }

    .product-gallery-stage {
        padding: 0.75rem;
        border-radius: 22px;
    }

    .product-gallery-meta,
    .image-modal-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .product-gallery-track,
    .product-main-image {
        min-height: 360px;
        height: 360px;
    }

    .product-gallery-stage .image-nav-btn,
    .fullscreen-nav-btn {
        width: 44px;
        height: 44px;
    }

    .thumbnail-gallery {
        grid-template-columns: repeat(auto-fit, minmax(64px, 76px));
        gap: 0.55rem;
    }

    .image-modal {
        padding: 0.75rem;
    }

    .image-modal-content {
        width: 100%;
        height: 100%;
        border-radius: 22px;
    }

    .image-modal-topbar {
        right: 4rem;
    }

    .fullscreen-image {
        max-width: 94vw;
        max-height: 78vh;
    }
}

.back-btn {
    background: linear-gradient(135deg, #333333 0%, #666666 50%, #333333 100%);
    background-size: 200% 200%;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease, background-position 0.5s ease;
    margin-bottom: 1rem;
    opacity: 0.35;
}

.back-btn:hover {
    background-position: right bottom;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(51, 51, 51, 0.4);
    opacity: 1;
}

.product-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 0.5rem;
}

.product-stock, .product-status, .product-category {
    margin: 0.25rem 0;
    color: #666;
}

.product-description {
    margin: 1.5rem 0;
}

.product-description p {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: normal;
}

.product-description h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.product-size-chart-section {
    margin: 1.25rem 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.product-size-chart-section h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: #2f3a45;
    text-align: center;
}

.product-size-chart-image-frame {
    display: none;
    position: relative;
    width: min(100%, 320px);
    aspect-ratio: 4 / 5;
    margin-bottom: 0.8rem;
    border-radius: 14px;
    border: 1px solid #e3e8ef;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.product-size-chart-image-frame::after,
.product-size-chart-table-wrap::after {
    content: "SHILETTO SHOP";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(-18deg);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1rem, 2.2vw, 1.5rem);
    font-style: italic;
    font-weight: 600;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: rgba(71, 84, 103, 0.1);
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    z-index: 1;
}

.product-size-chart-image {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: 0;
    background: #fff;
    object-fit: contain;
    object-position: center;
    position: relative;
    z-index: 2;
}

.product-size-chart-table-wrap {
    width: 100%;
    position: relative;
    overflow-x: auto;
    margin-bottom: 0.8rem;
    border: 1px solid #e8edf3;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
    isolation: isolate;
}

.product-size-chart-table {
    width: 100%;
    min-width: 360px;
    border-collapse: collapse;
    background: transparent;
    border: 0;
    position: relative;
    z-index: 2;
}

.product-size-chart-table th,
.product-size-chart-table td {
    border: 1px solid #e8edf3;
    padding: 0.55rem 0.7rem;
    text-align: left;
    color: #334155;
    font-size: 0.9rem;
}

.product-size-chart-table th {
    background: #f6f8fb;
    font-weight: 600;
}

.product-size-select-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.92rem;
    color: #475467;
}

.product-size-select {
    display: none;
}

.product-size-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    width: 100%;
    max-width: 100%;
}

.product-size-option {
    min-width: 52px;
    max-width: 240px;
    min-height: 40px;
    border: 1px solid #d7dee8;
    border-radius: 10px;
    padding: 0.55rem 0.85rem;
    background: #ffffff;
    font: inherit;
    color: #1f2937;
    font-weight: 600;
    cursor: pointer;
    box-shadow: none;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.product-size-option:hover {
    border-color: #b8c4d3;
    background: #f8fafc;
    transform: translateY(-1px);
}

.product-size-option.is-selected {
    border-color: #2f3a45;
    background: #2f3a45;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(47, 58, 69, 0.16);
}

.product-size-options.is-disabled {
    opacity: 0.75;
}

.product-size-options-empty {
    padding: 0.15rem 0;
    color: #667085;
    font-size: 0.92rem;
}

@media (max-width: 768px) {
    .product-size-chart-section {
        padding: 0;
        border-radius: 0;
    }

    .product-size-chart-image-frame {
        width: min(100%, 280px);
        margin-bottom: 0.75rem;
    }

    .product-size-chart-table {
        min-width: 320px;
    }

    .product-size-chart-table th,
    .product-size-chart-table td {
        padding: 0.5rem 0.6rem;
        font-size: 0.86rem;
    }

    .product-size-options {
        gap: 0.45rem;
    }

    .product-size-option {
        max-width: 100%;
        min-width: 48px;
        padding: 0.5rem 0.75rem;
    }
}

.admin-product-panel {
    margin: 1rem 0 1.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fafafa;
    overflow: hidden;
}

.admin-product-summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    cursor: pointer;
    user-select: none;
}

.admin-product-summary::-webkit-details-marker {
    display: none;
}

.admin-product-summary-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #111827;
}

.admin-product-summary-meta {
    font-size: 0.82rem;
    color: #6b7280;
}

.admin-product-body {
    padding: 0 1rem 1rem;
}

.admin-product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 0.85rem;
}

.admin-product-item,
.admin-product-section,
.admin-product-characteristic {
    border: 1px solid #eceff3;
    border-radius: 10px;
    background: #fff;
}

.admin-product-item {
    padding: 0.7rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.admin-product-item span,
.admin-product-section > span,
.admin-product-characteristic span {
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #6b7280;
}

.admin-product-item strong,
.admin-product-characteristic strong {
    color: #111827;
    font-size: 0.95rem;
    word-break: break-word;
}

.admin-product-item-wide {
    grid-column: 1 / -1;
}

.admin-product-section {
    padding: 0.8rem;
    margin-top: 0.7rem;
}

.admin-product-section p {
    margin: 0.45rem 0 0;
    color: #374151;
    line-height: 1.5;
}

.admin-product-bullets {
    margin: 0.5rem 0 0;
    padding-left: 1.1rem;
    color: #374151;
    display: grid;
    gap: 0.45rem;
}

.admin-product-bullets li {
    line-height: 1.5;
}

.admin-product-bullets-empty {
    margin-top: 0.5rem;
    color: #6b7280;
}

.supplier-info-textarea {
    line-height: 1.55;
    white-space: pre-wrap;
}

.admin-product-links {
    display: grid;
    gap: 0.65rem;
    margin-top: 0.45rem;
}

.admin-product-links a {
    color: #1f2937;
    text-decoration: underline;
    text-underline-offset: 0.15em;
    word-break: break-all;
}

.admin-product-characteristics {
    display: grid;
    gap: 0.55rem;
    margin-top: 0.45rem;
}

.admin-product-characteristic {
    padding: 0.7rem 0.8rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.admin-product-characteristic-empty {
    justify-content: flex-start;
    color: #6b7280;
    font-size: 0.9rem;
}

.reviews-section {
    background:
        radial-gradient(circle at top right, rgba(255, 210, 116, 0.18), transparent 32%),
        linear-gradient(180deg, #ffffff 0%, #fcfcfd 100%);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 12px 34px rgba(27, 31, 35, 0.08);
    border: 1px solid rgba(222, 226, 230, 0.95);
}

.reviews-section h2 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.55rem;
}

.reviews-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
}

.reviews-heading {
    max-width: 560px;
}

.reviews-eyebrow {
    display: none;
}

.reviews-subtitle {
    margin: 0;
    color: #6b7280;
    line-height: 1.6;
}

.reviews-summary {
    min-width: 190px;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(255, 214, 102, 0.45);
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.06);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.reviews-average-score {
    font-size: 2rem;
    line-height: 1;
    font-weight: 800;
    color: #1f2937;
}

.reviews-count {
    color: #6b7280;
    font-size: 0.95rem;
}

.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.review {
    padding: 1.1rem 1.2rem;
    border: 1px solid #eceff3;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.review-author-block {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.review-author {
    font-size: 1rem;
    color: #111827;
}

.review-date {
    color: #6b7280;
    white-space: nowrap;
}

.review-comment {
    margin: 0;
    color: #374151;
    line-height: 1.65;
}

.review-empty {
    margin: 0;
    padding: 1.25rem 1.35rem;
    border-radius: 12px;
    background: rgba(249, 250, 251, 0.92);
    border: 1px dashed #d7dce3;
    color: #6b7280;
    line-height: 1.6;
}

.review-stars {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.review-stars-display {
    justify-content: flex-end;
}

.review-star {
    font-size: 1.05rem;
    line-height: 1;
    color: #d7dde5;
    text-shadow: none;
}

.review-star.is-filled {
    color: #f6b318;
    text-shadow: 0 2px 8px rgba(246, 179, 24, 0.26);
}

.add-review-form {
    border-top: 1px solid #ebeef2;
    padding-top: 1.5rem;
    background: rgba(255, 255, 255, 0.72);
    position: relative;
    z-index: 1;
}

.add-review-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.add-review-form h3 {
    margin-top: 0;
    margin-bottom: 0.35rem;
}

.add-review-form p {
    margin: 0;
    color: #6b7280;
    line-height: 1.55;
}

.review-form-field {
    margin-bottom: 1rem;
}

.review-field-label {
    display: block;
    margin-bottom: 0.55rem;
    color: #374151;
    font-weight: 600;
}

.review-stars-input {
    gap: 0.35rem;
    margin-bottom: 0.4rem;
}

.review-star-btn {
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 999px;
    background: rgba(255, 194, 51, 0.08);
    color: #d3d9e1;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.review-star-btn:hover,
.review-star-btn:focus-visible {
    transform: translateY(-1px) scale(1.04);
    background: rgba(255, 194, 51, 0.16);
    color: #f6b318;
    box-shadow: 0 8px 16px rgba(246, 179, 24, 0.18);
    outline: none;
}

.review-star-btn.is-active {
    color: #f6b318;
    background: rgba(255, 194, 51, 0.12);
    text-shadow: 0 2px 10px rgba(246, 179, 24, 0.28);
}

.review-rating-hint {
    display: inline-block;
    color: #9a6b00;
    font-size: 0.95rem;
    font-weight: 600;
}

.add-review-form textarea {
    display: block;
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid #dde3ea;
    border-radius: 12px;
    margin-bottom: 0;
    resize: vertical;
    min-height: 128px;
    box-sizing: border-box;
    font: inherit;
    color: #1f2937;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    z-index: 2;
    pointer-events: auto;
    user-select: text;
    -webkit-user-select: text;
}

.add-review-form textarea:focus {
    outline: none;
    border-color: rgba(246, 179, 24, 0.7);
    box-shadow: 0 0 0 4px rgba(246, 179, 24, 0.12);
}

.review-form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.review-form-actions .cart-action-btn {
    margin-left: 0;
}

.review-cancel-btn {
    border: 1px solid #d7dde5;
    border-radius: 999px;
    background: #ffffff;
    color: #374151;
    padding: 0.4rem 0.95rem;
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.review-cancel-btn:hover,
.review-cancel-btn:focus-visible {
    transform: translateY(-1px);
    border-color: #c3cad4;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    outline: none;
}

@media (max-width: 768px) {
    .reviews-section {
        padding: 1.35rem;
    }

    .reviews-section-head,
    .review-header {
        flex-direction: column;
    }

    .reviews-summary {
        width: 100%;
        align-items: flex-start;
    }

    .review-stars-display {
        justify-content: flex-start;
    }

    .review-date {
        white-space: normal;
    }
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: #ffffff;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 1.5rem;
    border-radius: 20px;
    width: 95%;
    max-width: 600px;
    min-width: 320px;
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Специфические стили для модала чата */
#chatModal .modal-content {
    width: min(1180px, calc(100vw - 1rem));
    min-width: 320px;
    height: min(92vh, 960px);
    min-height: min(680px, calc(100vh - 1rem));
    max-height: calc(100vh - 1rem);
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 1rem 1.1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    box-sizing: border-box;
}

#chatModal .modal-content > h2,
#chatModal .chat-modal-header {
    margin: 0;
    flex-shrink: 0;
}

#chatModal .modal-content > .close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    float: none;
    z-index: 1;
}

#chatModal .modal-content > h2 {
    padding-right: 2.4rem;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.confirm-modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
    z-index: 1002;
    width: 90%;
    max-width: 380px;
    min-width: 280px;
    padding: 1rem;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    height: auto;
    max-height: 80vh;
    overflow: hidden;
}

.confirm-modal-content h2 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    align-self: flex-start;
}

.confirm-modal-content p {
    margin: 0 0 1rem 0;
    color: #444;
    font-size: 0.95rem;
    align-self: flex-start;
}

.confirm-modal-content .confirm-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    flex-wrap: wrap;
}

.confirm-modal-content .confirm-actions button {
    flex: 1 1 140px;
}

.notification-modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1002;
    width: min(420px, 90%);
    padding: 1.25rem;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notification-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.site-notification-root {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-end;
}

.site-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 260px;
    max-width: 360px;
    padding: 1rem 1rem;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
    background: #ffffff;
    border-left: 4px solid #007bff;
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    cursor: pointer;
}

.site-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.site-toast.success {
    border-left-color: #28a745;
}

.site-toast.error {
    border-left-color: #dc3545;
}

.site-toast.warning {
    border-left-color: #ffc107;
}

.site-toast .toast-icon {
    font-size: 1.1rem;
    line-height: 1;
    margin-top: 0.1rem;
    color: inherit;
}

.site-toast .toast-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.site-toast strong {
    font-size: 0.95rem;
}

.site-toast p {
    margin: 0;
    font-size: 0.92rem;
    color: #2f343a;
}

.confirm-modal-content .close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-modal-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 0.75rem;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    border-radius: 10px;
    border: 1px solid #ccc;
    background: #fbfbfb;
    padding: 0.9rem 1rem;
    margin-bottom: 0;
}

.chat-input-container {
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
    padding-top: 0.75rem;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

/* Для модального окна чата - переопределяем display flex */
#chatModal .chat-message {
    display: block !important;
    max-width: 82% !important;
}

#chatModal .chat-message:has(.order-receipt) {
    max-width: min(92%, 27rem) !important;
}

#chatModal .chat-message.chat-admin {
    margin-right: auto;
    margin-left: 0;
}

#chatModal .chat-message.chat-user {
    margin-left: auto;
    margin-right: 0;
}

#chatModal .message-html {
    display: inline-block;
    margin-top: 0;
    width: auto;
    max-width: 100%;
}

#chatModal .order-receipt {
    width: min(100%, 24rem);
    max-width: 100%;
    padding: 0.65rem 0.7rem;
    font-size: 0.9rem;
}

#chatModal .chat-message-image {
    max-width: min(420px, 100%);
    max-height: 500px;
}

#chatModal .chat-message-media {
    max-width: min(420px, 100%);
}

/* Стили для страницы чата админа */
.chat-page .chat-message {
    display: block;
    max-width: 80%;
    width: auto;
}

.chat-page .chat-message.chat-admin {
    margin-right: auto;
    margin-left: 0;
}

.chat-page .chat-message.chat-user {
    margin-left: auto;
    margin-right: 0;
}

.chat-page .chat-message-body {
    display: inline-block;
    width: auto;
    min-width: 0;
    max-width: 100%;
}

.chat-page .chat-message-image {
    max-width: min(460px, 100%);
    max-height: 520px;
}

.chat-page .chat-message-media {
    max-width: min(460px, 100%);
}

.chat-page .chat-message-text {
    white-space: normal;
}

.chat-page .message-html,
.chat-page .chat-message-body .message-html,
.chat-page .chat-message-body .order-receipt {
    display: inline-block;
    width: auto;
    max-width: 100%;
}

.chat-page .message-html {
    margin-top: 0;
}

.chat-page .order-receipt {
    box-sizing: border-box;
    width: min(100%, 24rem);
    padding: 0.65rem 0.7rem;
    font-size: 0.9rem;
}

.chat-page .order-receipt-header {
    margin-bottom: 0.4rem;
    font-size: 0.92rem;
    line-height: 1.3;
}

.chat-page .order-receipt-meta > div {
    margin-bottom: 0.2rem;
    font-size: 0.84rem;
    line-height: 1.35;
}

.chat-page .order-receipt-item {
    gap: 0.45rem;
    padding: 0.3rem 0;
}

.chat-page .order-receipt-item-title {
    margin-bottom: 0.1rem;
    font-size: 0.9rem;
}

.chat-page .order-receipt-item-meta {
    font-size: 0.8rem;
    margin-bottom: 0;
}

.chat-page .order-receipt-total {
    margin-top: 0.45rem;
    padding-top: 0.5rem;
    font-size: 0.9rem;
}

.chat-page .order-receipt-note {
    margin-top: 0.45rem;
    font-size: 0.84rem;
}

.chat-page .order-receipt-status-row,
#chatModal .order-receipt-status-row {
    align-items: stretch;
    gap: 0.5rem;
}

.chat-page .order-receipt-status-label,
#chatModal .order-receipt-status-label {
    font-size: 0.84rem;
}

.chat-page .order-status-badge,
#chatModal .order-status-badge {
    width: min(100%, 12rem);
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
    line-height: 1.25;
}

.message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.4rem;
    clear: both;
    width: 100%;
    margin-left: 0;
}

.message-actions {
    display: flex;
    gap: 5px;
}

.chat-input-container textarea {
    width: 100%;
    flex: 1;
    padding: 0.65rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    resize: none;
    min-height: 52px;
    max-height: 320px;
    overflow-y: hidden;
    transition: height 0.24s ease, border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.chat-message {
    border-radius: 10px;
    padding: 0.5rem;
    line-height: 1.3;
    max-width: 80%;
    margin-bottom: 0.6rem;
}

.message-html {
    margin-top: 0.25rem;
}

.order-receipt {
    display: block;
    border: 1px solid #e6ecf0;
    border-radius: 14px;
    background: #ffffff;
    padding: 0.75rem;
    font-size: 0.95rem;
    color: #242f40;
    width: fit-content;
    max-width: min(100%, 36rem);
}

.order-receipt-header {
    font-weight: 700;
    margin-bottom: 0.75rem;
    letter-spacing: 0.02em;
}

.order-receipt-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid #f0f2f4;
    flex-wrap: wrap;
}

.order-receipt-item:last-child {
    border-bottom: none;
}

.order-receipt-img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 8px;
    background: #fafbfc;
}

/* OAuth кнопки */
.oauth-buttons {
    margin-bottom: 1.5rem;
}

.oauth-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #dadce0;
    border-radius: 8px;
    background: #ffffff;
    color: #3c4043;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
}

.oauth-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3);
}

.oauth-btn.google-btn {
    border-color: #dadce0;
}

.oauth-btn.google-btn:hover {
    background: #f8f9fa;
}

.divider {
    position: relative;
    text-align: center;
    margin: 1.5rem 0;
    color: #6b7280;
    font-size: 0.9rem;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e5e7eb;
}

.divider span {
    background: #ffffff;
    padding: 0 1rem;
    position: relative;
    z-index: 1;
}

.auth-status-text {
    margin: 0.85rem 0 0;
    padding: 0.85rem 1rem;
    border-radius: 16px;
    background: linear-gradient(180deg, #f8fbff 0%, #f3f7fb 100%);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #52606d;
    font-size: 0.95rem;
    line-height: 1.45;
    text-align: left;
}

.auth-links-row,
.auth-inline-links {
    margin: 0.9rem 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.55rem 0.9rem;
    color: #6b7280;
    font-size: 0.95rem;
    text-align: center;
}

.auth-links-row.auth-compact-links,
.auth-inline-links.auth-compact-links {
    display: inline-flex;
    vertical-align: middle;
    margin-top: 0.75rem;
}

.auth-inline-links {
    margin-top: 0.75rem;
}

.auth-inline-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: #f4f6f8;
    border: 1px solid rgba(148, 163, 184, 0.22);
    color: #1f2937;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.auth-inline-link:hover {
    background: #eaf1f8;
    border-color: rgba(59, 130, 246, 0.26);
    color: #0f172a;
    transform: translateY(-1px);
}

.auth-links-row .auth-inline-link {
    margin-left: 0.15rem;
}

.order-receipt-item-content {
    flex: 1;
    min-width: 0;
}

.order-receipt-item-title {
    font-weight: 600;
    margin-bottom: 0.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
}

.order-receipt-item-meta {
    font-size: 0.88rem;
    color: #5f6d7a;
}

.order-receipt-item-price {
    font-weight: 700;
    color: #1b1f23;
    white-space: nowrap;
}

.order-receipt-total {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f2f4;
    font-size: 0.98rem;
}

.order-receipt-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.order-receipt-note {
    margin-top: 0.75rem;
    color: #5f6d7a;
    font-size: 0.9rem;
}

.order-receipt-status-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.order-receipt-status-label {
    color: #223046;
    font-weight: 600;
}

.order-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    text-align: center;
    line-height: 1.3;
    width: min(100%, 14rem);
    max-width: 100%;
    flex-shrink: 1;
}

.order-status-badge.awaiting-confirmation {
    background: #fff1cf;
    color: #8a5a00;
}

.order-status-badge.accepted {
    background: #dff4e4;
    color: #1f6b3a;
}

.order-status-badge.in-delivery {
    background: #dcecff;
    color: #1e5da8;
}

.order-status-badge.received {
    background: #def7f0;
    color: #0f766e;
}

.order-status-badge.refused {
    background: #ffe1de;
    color: #a33128;
}

.order-receipt-link {
    color: #1a73e8;
    text-decoration: none;
}

.order-receipt-link:hover {
    text-decoration: underline;
}

.chat-user .order-receipt,
.chat-admin .order-receipt {
    max-width: 100%;
}

.chat-user .order-receipt-item-title,
.chat-admin .order-receipt-item-title {
    color: inherit;
}

.chat-user .order-receipt-link,
.chat-admin .order-receipt-link {
    color: #1a73e8;
}

.chat-user .order-receipt-link:hover,
.chat-admin .order-receipt-link:hover {
    color: #1669c1;
}

.chat-user .order-receipt-item-meta,
.chat-admin .order-receipt-item-meta,
.chat-user .order-receipt-note,
.chat-admin .order-receipt-note {
    color: #5f6d7a;
}

.chat-user .order-receipt-item-price,
.chat-admin .order-receipt-item-price {
    color: #242f40;
}

.chat-user .order-receipt-total strong,
.chat-admin .order-receipt-total strong {
    color: #242f40;
}

/* Компактный чек только на странице админа */
.chat-page .message-html {
    margin-top: 0.15rem;
}

.chat-page .order-receipt {
    width: min(100%, 24rem);
    padding: 0.65rem 0.7rem;
    font-size: 0.9rem;
}

.chat-page .order-receipt-header {
    margin-bottom: 0.4rem;
    font-size: 0.92rem;
    line-height: 1.3;
}

.chat-page .order-receipt-item {
    gap: 0.5rem;
    padding: 0.3rem 0;
}

.chat-page .order-receipt-item-title {
    margin-bottom: 0.12rem;
    font-size: 0.9rem;
}

.chat-page .order-receipt-item-meta {
    font-size: 0.8rem;
}

.chat-page .order-receipt-item-price {
    font-size: 0.86rem;
}

.chat-page .order-receipt-total {
    margin-top: 0.45rem;
    padding-top: 0.5rem;
    font-size: 0.9rem;
}

.chat-page .order-receipt-note {
    margin-top: 0.45rem;
    font-size: 0.84rem;
}

.chat-page .chat-message:has(.order-receipt) {
    max-width: min(100%, 29rem);
}

.chat-page .order-receipt-status-row {
    align-items: stretch;
    gap: 0.5rem;
}

.chat-page .order-receipt-status-label {
    font-size: 0.84rem;
}

.chat-page .order-status-badge {
    width: min(100%, 12rem);
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
    line-height: 1.25;
}

.chat-receipt-admin-tools {
    margin-top: 0.7rem;
    padding-top: 0.65rem;
    border-top: 1px dashed #d9e2ec;
}

.chat-receipt-prepayment-toggle {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: #223046;
    font-size: 0.88rem;
}

.chat-receipt-prepayment-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex: 0 0 auto;
}

.chat-receipt-prepayment-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
    margin-top: 0.55rem;
}

.chat-receipt-prepayment-input {
    min-height: 40px;
    border: 1px solid #cfd8e3;
    border-radius: 10px;
    padding: 0.5rem 0.7rem;
    background: #fff;
    font: inherit;
}

.chat-receipt-save-btn {
    border: none;
    border-radius: 10px;
    background: #1f8f5f;
    color: #fff;
    padding: 0.55rem 0.9rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.chat-receipt-save-btn:hover {
    background: #16724b;
}

.chat-receipt-save-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

@media (max-width: 640px) {
    .chat-receipt-prepayment-row {
        grid-template-columns: 1fr;
    }
}

.chat-user {
    background: #e6f4ff;
    text-align: right;
    margin-left: auto;
}

.chat-user > strong,
.chat-user .message-text,
.chat-user .message-html {
    text-align: left;
    display: block;
}

.chat-admin {
    background: #f6f6f6;
    text-align: left;
    margin-right: auto;
}

#chatModal.user-chat-modal {
    background: rgba(18, 24, 38, 0.5);
    backdrop-filter: blur(12px) saturate(1.1);
    -webkit-backdrop-filter: blur(12px) saturate(1.1);
}

#chatModal.user-chat-modal .modal-content {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 22px;
    box-shadow:
        0 26px 80px rgba(15, 23, 42, 0.28),
        0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

#chatModal.user-chat-modal .modal-content > h2 {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.1rem 3rem 0.75rem 0;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    color: #111827;
    font-size: clamp(1.18rem, 2vw, 1.45rem);
    letter-spacing: 0;
}

#chatModal.user-chat-modal .modal-content > h2::before {
    content: "";
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 14px;
    background:
        linear-gradient(135deg, #111827 0%, #334155 58%, #0f766e 100%);
    box-shadow:
        0 10px 24px rgba(15, 23, 42, 0.22),
        inset 0 0 0 10px rgba(255, 255, 255, 0.08);
}

#chatModal.user-chat-modal .modal-content > .close {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(203, 213, 225, 0.8);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #475569;
    font-size: 1.35rem;
    line-height: 1;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

#chatModal.user-chat-modal .modal-content > .close:hover,
#chatModal.user-chat-modal .modal-content > .close:focus {
    background: #111827;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.2);
}

#chatModal.user-chat-modal .chat-modal-body {
    gap: 0.85rem;
}

#chatModal.user-chat-modal .chat-messages {
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(244, 247, 251, 0.92) 100%);
    padding: 1rem;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.78),
        inset 0 -16px 32px rgba(15, 23, 42, 0.025);
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 transparent;
}

#chatModal.user-chat-modal .chat-messages::-webkit-scrollbar {
    width: 10px;
}

#chatModal.user-chat-modal .chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#chatModal.user-chat-modal .chat-messages::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 999px;
    background: #94a3b8;
    background-clip: padding-box;
}

#chatModal.user-chat-modal .chat-message {
    position: relative;
    padding: 0.78rem 0.9rem;
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 18px;
    color: #172033;
    line-height: 1.45;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

#chatModal.user-chat-modal .chat-message > strong {
    display: block;
    margin-bottom: 0.28rem;
    color: inherit;
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.02em;
}

#chatModal.user-chat-modal .chat-message.chat-admin {
    background: #ffffff;
    border-top-left-radius: 8px;
}

#chatModal.user-chat-modal .chat-message.chat-user {
    background: linear-gradient(135deg, #101827 0%, #1f2937 68%, #0f766e 100%);
    border-color: rgba(15, 23, 42, 0.14);
    border-top-right-radius: 8px;
    color: #ffffff;
    text-align: left;
}

#chatModal.user-chat-modal .chat-user > strong,
#chatModal.user-chat-modal .chat-user .message-text,
#chatModal.user-chat-modal .chat-user .message-html {
    color: #ffffff;
}

#chatModal.user-chat-modal .chat-message.chat-user .message-footer,
#chatModal.user-chat-modal .chat-message.chat-user .message-footer div[style*="color"] {
    color: rgba(255, 255, 255, 0.72) !important;
}

#chatModal.user-chat-modal .chat-message.chat-admin .message-footer,
#chatModal.user-chat-modal .chat-message.chat-admin div[style*="color"] {
    color: #64748b !important;
}

#chatModal.user-chat-modal .message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.45rem;
}

#chatModal.user-chat-modal .message-actions {
    display: inline-flex;
    gap: 0.2rem;
    align-items: center;
}

#chatModal.user-chat-modal .message-actions button {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0 !important;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16) !important;
    transition: background-color 0.18s ease, transform 0.18s ease;
}

#chatModal.user-chat-modal .message-actions button:hover {
    background: rgba(255, 255, 255, 0.26) !important;
    transform: translateY(-1px);
}

#chatModal.user-chat-modal .message-actions svg path {
    stroke: currentColor;
}

#chatModal.user-chat-modal .chat-input-container {
    padding: 0.85rem;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
}

#chatModal.user-chat-modal .chat-composer-row {
    align-items: flex-end;
    gap: 0.65rem;
}

#chatModal.user-chat-modal .chat-attach-btn {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    border: 1px solid #dbe3eb;
    background: #f8fafc;
    color: #334155;
    box-shadow: none;
}

#chatModal.user-chat-modal .chat-attach-btn:hover,
#chatModal.user-chat-modal .chat-attach-btn:focus {
    border-color: #94a3b8;
    background: #ffffff;
    color: #111827;
    transform: translateY(-1px);
}

#chatModal.user-chat-modal .chat-input-container textarea {
    min-height: 46px;
    border: 1px solid #dbe3eb;
    border-radius: 14px;
    background: #f8fafc;
    color: #111827;
    padding: 0.72rem 0.85rem;
    line-height: 1.45;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
    resize: none;
}

#chatModal.user-chat-modal .chat-input-container textarea:focus {
    border-color: #334155;
    background: #ffffff;
    box-shadow:
        0 0 0 3px rgba(51, 65, 85, 0.1),
        inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

#chatModal.user-chat-modal .chat-composer-row .cart-action-btn {
    min-width: 132px;
    height: 46px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #111827 0%, #334155 58%, #0f766e 100%);
    color: #ffffff;
    font-weight: 750;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.22);
}

#chatModal.user-chat-modal .chat-composer-row .cart-action-btn:hover,
#chatModal.user-chat-modal .chat-composer-row .cart-action-btn:focus {
    transform: translateY(-1px);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.28);
}

#chatModal.user-chat-modal .chat-image-preview-card {
    border: 1px solid #dbe3eb;
    border-radius: 14px;
    background: #f8fafc;
}

#chatModal.user-chat-modal .chat-message-image,
#chatModal.user-chat-modal .chat-message-media {
    border-radius: 14px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

input, textarea, select {
    width: 100%;
    max-width: 100%;
    padding: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    resize: vertical;
    background: white;
}

textarea {
    min-height: 96px;
    overflow: hidden;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
    width: 100%;
    max-width: 100%;
}

input[type="file"] {
    cursor: pointer;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    font-size: 1rem;
    color: #333;
    width: 100%;
    max-width: 100%;
}



button[type="submit"] {
    background: linear-gradient(135deg, #333333 0%, #666666 50%, #333333 100%);
    background-size: 200% 200%;
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease, background-position 0.5s ease;
    opacity: 0.8;
}

button[type="submit"]:hover {
    background-position: right bottom;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(51, 51, 51, 0.4);
    opacity: 1;
}

/* Стили для выпадающего меню каталога */
.catalog-dropdown {
    position: relative;
    display: inline-block;
    z-index: 2001;
    overflow: visible;
}



#catalogMenu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    width: 800px;
    max-width: 90vw;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
    z-index: 99999;
    pointer-events: none;
}

#catalogMenu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.catalog-menu-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
}

.catalog-menu-category {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.catalog-menu-category:last-child {
    border-bottom: none;
}

.catalog-menu-main-item {
    font-weight: 600;
    color: #333333;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: color 0.2s ease;
    user-select: none;
    padding: 0;
    border: none;
    background: none;
}

.catalog-menu-main-item:hover {
    color: #000000;
}

.catalog-menu-sub-items {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.catalog-menu-sub-item {
    padding: 0.25rem 0;
    cursor: pointer;
    color: #666666;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    user-select: none;
}

.catalog-menu-sub-item:hover {
    color: #000000;
}

/* Скроллбар для меню */
#catalogMenu::-webkit-scrollbar {
    width: 6px;
}

#catalogMenu::-webkit-scrollbar-track {
    background: transparent;
}

#catalogMenu::-webkit-scrollbar-thumb {
    background: #cccccc;
    border-radius: 3px;
}

#catalogMenu::-webkit-scrollbar-thumb:hover {
    background: #999999;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    #chatModal .modal-content {
        width: calc(100vw - 0.4rem);
        height: calc(100vh - 0.4rem);
        min-height: min(520px, calc(100vh - 0.4rem));
        max-height: calc(100vh - 0.4rem);
        padding: 0.95rem 0.8rem 0.8rem;
        border-radius: 16px;
        gap: 0.5rem;
    }

    .chat-modal-body {
        gap: 0.5rem;
    }

    .chat-messages {
        padding: 0.75rem;
    }

    #chatModal .chat-message {
        max-width: 92% !important;
    }

    #chatModal .chat-message:has(.order-receipt) {
        max-width: 92% !important;
    }

    #chatModal .order-receipt {
        width: 100%;
    }

    .chat-input-container,
    .chat-input-panel {
        gap: 0.6rem;
        padding-top: 0.6rem;
    }

    .chat-image-preview-card {
        padding: 0.65rem 0.7rem;
        gap: 0.65rem;
    }

    .chat-image-preview-thumb {
        width: 56px;
        height: 56px;
    }

    .chat-composer-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
    }

    .chat-attach-btn,
    .chat-composer-row .cart-action-btn {
        width: 100%;
        min-width: 0;
        height: 46px;
    }
    
    #catalogMenu {
        width: calc(100vw - 2rem);
        left: 50%;
        transform: translateX(-50%) translateY(-10px);
    }
    
    .catalog-dropdown:hover #catalogMenu {
        transform: translateX(-50%) translateY(0);
    }
    
    .catalog-menu-content {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    .main-layout {
        display: block;
    }
    .sidebar {
        width: 100%;
        position: relative;
        top: auto;
        left: auto;
        margin-bottom: 1rem;
        transform: none;
        min-width: auto;
    }
    .sidebar.collapsed {
        width: 0;
        height: 0;
        padding: 0;
        margin: 0;
        border: none;
        box-shadow: none;
        visibility: hidden;
    }
    .toggle-btn {
        position: static;
        margin: 1rem;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    .main-content {
        margin-left: 0;
    }
    .banners-container {
        grid-template-columns: 1fr;
    }
    .products-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* Анимация перемещения блоков */
.sections-animating .banners-section,
.sections-animating .products-section {
    opacity: 0;
    transform: translateY(20px);
}

/* ===== Mobile storefront adaptation ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

img,
video,
iframe {
    max-width: 100%;
}

@media (max-width: 900px) {
    body {
        padding-bottom: calc(6.25rem + env(safe-area-inset-bottom, 0px));
        overflow-x: hidden;
    }

    header {
        margin-bottom: 1rem;
        padding: 1rem 0.75rem 0.85rem;
        border-radius: 0 0 14px 14px;
    }

    .header-top {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 0.75rem;
        align-items: center;
    }

    header h1 {
        grid-column: 1 / -1;
        margin: 0;
        font-size: clamp(1.45rem, 7vw, 2rem);
        line-height: 1.1;
    }

    header nav {
        position: static;
        transform: none;
        order: 2;
        grid-column: 1 / 2;
        width: 100%;
        min-width: 0;
        display: flex;
        gap: 0.45rem;
        overflow-x: auto;
        padding: 0.2rem 0 0.1rem;
        scrollbar-width: none;
    }

    header nav::-webkit-scrollbar {
        display: none;
    }

    header nav button {
        flex: 0 0 auto;
        min-height: 38px;
        padding: 0.45rem 0.65rem;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        background: #ffffff;
        font-size: 0.9rem;
    }

    header nav button::after {
        display: none;
    }

    .header-social {
        position: static;
        transform: none;
        order: 3;
        grid-column: 2 / 3;
        align-self: center;
        margin: 0;
    }

    .main-layout,
    .main-content {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin-left: 0;
        margin-right: 0;
    }

    .banners-section,
    .products-section,
    .reviews-section,
    .about-section,
    .contact-section,
    .profile-section,
    .checkout-section {
        width: auto;
        max-width: none;
        margin: 0.75rem 0.75rem 1rem;
        padding: 1rem;
        border-radius: 10px;
    }

    .banners-container {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        border-radius: 10px;
    }

    .banner-slide,
    .banner-slide img {
        width: 100%;
        height: 100%;
    }

    .product-controls {
        grid-template-columns: 1fr;
        gap: 0.55rem;
        padding: 0.55rem;
    }

    .search-input,
    .sort-select,
    .catalog-filters-button {
        min-height: 46px;
        font-size: 0.95rem;
    }

    .catalog-filters {
        margin-bottom: 1rem;
        padding: 0.85rem;
        border-radius: 10px;
    }

    .catalog-filters-head {
        align-items: stretch;
    }

    .catalog-filters-actions,
    .catalog-filters-clear {
        width: 100%;
    }

    .catalog-filter-grid,
    .catalog-characteristic-groups,
    .catalog-price-range {
        grid-template-columns: 1fr;
    }

    .products-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .product {
        padding: 0.75rem;
        border-radius: 10px;
    }

    .product img {
        height: auto;
        aspect-ratio: 1 / 1;
        object-fit: contain;
    }

    .product h3 {
        font-size: 0.95rem;
        line-height: 1.25;
    }

    .product p {
        font-size: 0.88rem;
    }

    .add-to-cart-btn,
    .cart-action-btn,
    .review-cancel-btn,
    .back-btn {
        min-height: 44px;
        width: 100%;
    }

    .product-details {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin: 0.75rem;
        padding: 1rem;
        border-radius: 10px;
    }

    .product-gallery-stage {
        width: 100%;
        max-width: none;
        aspect-ratio: 1 / 1;
        min-height: 0;
    }

    .product-main-image {
        width: 100%;
        height: 100%;
        max-width: none;
    }

    .thumbnail-gallery {
        width: 100%;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 0.25rem;
    }

    .thumbnail {
        flex: 0 0 56px;
        width: 56px;
        height: 56px;
    }

    .product-info h1 {
        font-size: clamp(1.35rem, 7vw, 1.8rem);
        line-height: 1.15;
    }

    .reviews-section-head,
    .add-review-header,
    .review-form-actions {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .modal-content,
    #cartModal .modal-content {
        width: calc(100vw - 1rem);
        min-width: 0;
        max-width: none;
        max-height: calc(100dvh - 1rem);
        padding: 1rem;
        border-radius: 14px;
    }

    #cartModal .cart-item {
        grid-template-columns: 64px 1fr;
        align-items: start;
        gap: 0.75rem;
    }

    #cartModal .cart-item-actions {
        grid-column: 1 / -1;
        width: 100%;
        justify-content: space-between;
    }

    .site-notification-root {
        left: 0.75rem;
        right: 0.75rem;
        top: 0.75rem;
        align-items: stretch;
    }

    .site-toast {
        min-width: 0;
        max-width: none;
        width: 100%;
    }

    .bottom-panel {
        left: 0.5rem;
        right: 0.5rem;
        bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
        transform: none;
        max-width: none;
        gap: 0.25rem;
        padding: 0.35rem;
        border-width: 1px;
        border-radius: 14px;
        overflow-x: auto;
        justify-content: flex-start;
        scrollbar-width: none;
    }

    .bottom-panel::-webkit-scrollbar {
        display: none;
    }

    .bottom-panel button {
        flex: 1 0 68px;
        min-width: 68px;
        min-height: 48px;
        padding: 0.35rem 0.25rem;
        font-size: 0.72rem;
        line-height: 1.1;
        border-radius: 10px;
        white-space: normal;
    }

    .bottom-panel button svg,
    .bottom-icon {
        width: 18px;
        height: 18px;
        margin-right: 0;
    }
}

@media (max-width: 520px) {
    .products-list {
        grid-template-columns: 1fr;
    }

    .product {
        display: grid;
        grid-template-columns: 104px 1fr;
        gap: 0.75rem;
        align-items: start;
    }

    .product img {
        grid-row: span 4;
        width: 104px;
        height: 104px;
    }

    .product .add-to-cart-btn {
        grid-column: 1 / -1;
    }

    .product:not(:has(img)) {
        display: block;
    }

    .about-section p,
    .contact-info p {
        text-align: left;
        font-size: 1rem;
    }

    .map-container iframe {
        height: 240px;
    }

    #chatModal .modal-content {
        width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }

    .chat-message,
    .chat-page .chat-message,
    #chatModal .chat-message {
        max-width: 95% !important;
    }
}
