/* Общие override для Jinja preview-страниц под preview-chrome */

html.preview-chrome-page .page-hero {
    min-height: 0;
    padding: 0;
    margin: 0;
}

/* Пустой spacer-hero не должен добавлять gap в flex-контейнере */
html.preview-chrome-page .page-hero:empty,
html.preview-chrome-page .page-hero.page-hero--omit {
    display: none !important;
}

html.preview-chrome-page .main-content {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

html.preview-chrome-page .account-layout {
    margin-top: 0 !important;
}

/* ЛК: account.css не должен сдвигать шапку вниз (padding-top контейнера) */
html.account-preview-page.preview-chrome-page .container {
    padding-top: 0 !important;
    gap: 12px !important;
}

@media (max-width: 768px) {
    html.account-preview-page.preview-chrome-page .container {
        padding: 0 12px !important;
        gap: 12px !important;
    }

    html.preview-chrome-page .page-section {
        padding-top: 0;
        padding-left: 0;
        padding-right: 0;
    }

    html.preview-chrome-page .contacts-section {
        padding-top: 0;
        padding-left: 0;
        padding-right: 0;
    }

    html.preview-chrome-page .page-hero {
        padding: 0 !important;
        margin: 0 !important;
    }
}

@media (max-width: 480px) {
    html.account-preview-page.preview-chrome-page .container {
        padding: 0 10px !important;
        gap: 12px !important;
    }
}

html.preview-chrome-page .content-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
}

html.preview-chrome-page .auth-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
}

html.preview-chrome-page .header .back-link {
    color: #fff;
}

html.preview-chrome-page .main-title,
html.preview-chrome-page .subtitle {
    color: #fff;
}

html.preview-chrome-page .site-header {
    background: transparent !important;
}

html.preview-chrome-page .site-footer {
    display: none;
}

html.preview-chrome-page .navbar {
    display: none;
}

html.preview-chrome-page body.account-page .main-content,
html.preview-chrome-page body.checkout-page .main-content,
html.preview-chrome-page body.collect-page .main-content {
    color: #333;
}

html.preview-chrome-page .main-content {
    flex: none;
    min-height: 0;
}

/* retail-price: не перебивать фон preview-chrome */
html.retail-price-preview-page.preview-chrome-page body {
    background-image: url('/static/img/Vector.svg') !important;
    background-repeat: no-repeat !important;
    background-size: 120% auto !important;
    background-position: 108% -5% !important;
    background-attachment: fixed !important;
    background-color: #622ADB !important;
}

html.retail-price-preview-page.preview-chrome-page .footer.footer {
    margin-top: 32px;
    margin-bottom: 0;
}

/* Account preview: лейаут сайдбар+контент внутри flex-контейнера chrome */
html.account-preview-page.preview-chrome-page .account-layout {
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
    width: 100%;
}

html.account-preview-page.preview-chrome-page .sidebar {
    align-self: start;
}

html.account-preview-page.preview-chrome-page .content-area {
    min-height: auto !important;
    align-self: stretch;
}

html.account-preview-page.preview-chrome-page .content-body {
    min-height: 0;
    flex: 1 1 auto;
}

html.account-preview-page.preview-chrome-page .footer {
    background: #622ADB !important;
    background-image: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 2px solid rgba(255, 255, 255, 1) !important;
    border-bottom: none !important;
    padding-bottom: 16px !important;
    margin-bottom: 0 !important;
    box-shadow: none !important;
}

@media (max-width: 768px) {
    html.account-preview-page.preview-chrome-page .footer {
        padding: 20px 16px 14px !important;
        border-radius: 20px 20px 0 0 !important;
    }
}

@media (max-width: 480px) {
    html.account-preview-page.preview-chrome-page .footer {
        padding: 16px 12px 12px !important;
        border-radius: 16px 16px 0 0 !important;
    }
}

/* Account preview: плоские кнопки и пункты меню без градиентов */
html.account-preview-page .sidebar-link.active {
    background: #7231FF !important;
    background-image: none !important;
}

html.account-preview-page .btn-primary,
html.account-preview-page .btn-primary:hover,
html.account-preview-page .btn-primary:active,
html.account-preview-page .btn-primary:focus,
html.account-preview-page .product-card-action .btn-primary,
html.account-preview-page .product-card-action .btn-primary:hover,
html.account-preview-page .avatar-upload-controls-modal .btn-primary,
html.account-preview-page .avatar-upload-controls-modal .btn-primary:hover,
html.account-preview-page .product-detail-modal .modal-footer .btn-primary,
html.account-preview-page .product-quantity-modal .modal-footer .btn-primary,
html.account-preview-page .avatar-modal .btn-primary,
html.account-preview-page .avatar-modal .btn-primary:hover {
    background: #7231FF !important;
    background-image: none !important;
}

html.account-preview-page .product-card-action .btn-primary::before {
    display: none !important;
}

html.account-preview-page .btn-create-product,
html.account-preview-page .btn-create-product:hover {
    background: #FFE343 !important;
    background-image: none !important;
}

html.account-preview-page .product-filter-btn.active {
    background: #7231FF !important;
    background-image: none !important;
}

html.account-preview-page .empty-state .btn-primary,
html.account-preview-page .empty-state .btn-primary:hover {
    background: #7231FF !important;
    background-image: none !important;
}

html.account-preview-page .product-detail-modal .btn-primary::before,
html.account-preview-page .product-quantity-modal .btn-primary::before {
    display: none !important;
}

/* Account preview: скрыть иконки, кроме соцсетей, аватарки и указанных исключений */
html.account-preview-page body i.fas,
html.account-preview-page body i.far {
    display: none !important;
}

html.account-preview-page body .profile-avatar i.fas,
html.account-preview-page body .avatar-placeholder i.fas,
html.account-preview-page body .avatar-placeholder-large i.fas,
html.account-preview-page body .btn-create-product i.fas,
html.account-preview-page body .empty-state .btn-primary i.fas,
html.account-preview-page body .product-card-delete i.fas,
html.account-preview-page body .addresses-list i.fas,
html.account-preview-page body .address-form i.fas,
html.account-preview-page body .logout-btn i.fas,
html.account-preview-page body .password-change-form .password-toggle i.fas {
    display: inline-block !important;
}

html.account-preview-page body .ghost-icon i.fas {
    display: block !important;
}

html.account-preview-page .sidebar-link {
    gap: 0;
}

/* Account preview: профиль — единая сетка, высоты полей и отступы */
html.account-preview-page .profile-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 100%;
}

html.account-preview-page .profile-form .form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 20px;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    html.account-preview-page .profile-form .form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

html.account-preview-page .profile-form .form-grid .form-group,
html.account-preview-page .profile-form > .form-group {
    margin-bottom: 0;
    margin-top: 0;
    gap: 6px;
}

html.account-preview-page .profile-form > .form-group:last-of-type {
    margin-bottom: 0;
}

html.account-preview-page .profile-form .form-label,
html.account-preview-page .profile-form .social-link-label {
    margin-bottom: 0;
    font-size: 13px;
    line-height: 1.3;
}

html.account-preview-page .profile-form .form-input,
html.account-preview-page .profile-form .form-select {
    width: 100%;
    min-height: 48px;
    box-sizing: border-box;
    padding: 12px 16px;
    line-height: 1.5;
    border: 1px solid #dee2e6;
    border-radius: 12px;
}

html.account-preview-page .profile-form .phone-input-wrapper {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: stretch;
}

html.account-preview-page .profile-form .phone-country-code {
    min-height: 48px;
    min-width: 96px;
    max-width: 110px;
    padding: 12px 14px;
    border: 1px solid #dee2e6;
    border-right: none;
    border-radius: 12px 0 0 12px;
    box-sizing: border-box;
    font-size: 14px;
}

html.account-preview-page .profile-form .phone-input-wrapper .form-input,
html.account-preview-page .profile-form .phone-input-wrapper .phone-input {
    min-height: 48px;
    border-left: none;
    border-radius: 0 12px 12px 0;
}

html.account-preview-page .profile-form .phone-input-wrapper:focus-within .phone-country-code {
    border-color: #7231FF;
}

html.account-preview-page .profile-form .btn-upload-avatar {
    width: 100%;
    min-height: 48px;
    margin: 0;
    box-sizing: border-box;
}

html.account-preview-page .profile-form .social-links-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 16px;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    html.account-preview-page .profile-form .social-links-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

html.account-preview-page .profile-form .social-link-item {
    gap: 6px;
}

html.account-preview-page .profile-form #personal-social-links-group {
    margin-bottom: 0;
}

html.account-preview-page .profile-form #save-profile-btn {
    align-self: flex-start;
    margin-top: 0;
}

/* Account preview: смена пароля — как профиль, одна колонка, узкая форма */
html.account-preview-page .password-change-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
    max-width: 500px;
    width: 100%;
}

html.account-preview-page .password-change-form .form-group {
    width: 100%;
    max-width: 500px;
    margin-bottom: 0;
    margin-top: 0;
    gap: 6px;
}

html.account-preview-page .password-change-form .form-label {
    margin-bottom: 0;
    font-size: 13px;
    line-height: 1.3;
}

html.account-preview-page .password-change-form .form-input {
    width: 100%;
    min-height: 48px;
    box-sizing: border-box;
    padding: 12px 16px;
    padding-right: 50px;
    line-height: 1.5;
    border: 1px solid #dee2e6;
    border-radius: 12px;
}

html.account-preview-page .password-change-form .password-input-wrapper {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: stretch;
    position: relative;
}

html.account-preview-page .password-change-form .password-input-wrapper .form-input {
    min-height: 48px;
}

html.account-preview-page .password-change-form .password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

html.account-preview-page .password-change-form .password-toggle:hover,
html.account-preview-page .password-change-form .password-toggle:focus {
    color: #7231FF;
    outline: none;
}

html.account-preview-page .password-change-form #change-password-btn {
    align-self: flex-start;
    margin-top: 0;
}

/* Collect page: chrome-совместимый лейаут */
html.collect-preview-page.preview-chrome-page .container {
    max-width: min(1400px, 100vw) !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-top: 0 !important;
    gap: 12px !important;
}

@media (max-width: 768px) {
    html.collect-preview-page.preview-chrome-page .container {
        padding: 0 12px !important;
        gap: 12px !important;
    }
}

@media (max-width: 480px) {
    html.collect-preview-page.preview-chrome-page .container {
        padding: 0 10px !important;
        gap: 12px !important;
    }
}

html.collect-preview-page.preview-chrome-page .main-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

html.collect-preview-page.preview-chrome-page .footer {
    background: #622ADB !important;
    background-image: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 2px solid rgba(255, 255, 255, 1) !important;
    border-bottom: none !important;
    padding-bottom: 16px !important;
    margin-bottom: 0 !important;
    box-shadow: none !important;
}

@media (max-width: 768px) {
    html.collect-preview-page.preview-chrome-page .footer {
        padding: 20px 16px 14px !important;
        border-radius: 20px 20px 0 0 !important;
    }
}

@media (max-width: 480px) {
    html.collect-preview-page.preview-chrome-page .footer {
        padding: 16px 12px 12px !important;
        border-radius: 16px 16px 0 0 !important;
    }
}

html.collect-preview-page .btn-primary,
html.collect-preview-page .btn-primary:hover,
html.collect-preview-page .btn-primary:active,
html.collect-preview-page .btn-primary:focus {
    background: #7231FF !important;
    background-image: none !important;
    border-color: #7231FF !important;
}

/* Checkout page: chrome-совместимый лейаут */
html.checkout-preview-page.preview-chrome-page .container {
    max-width: min(1400px, 100vw) !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-top: 0 !important;
    gap: 12px !important;
}

@media (max-width: 768px) {
    html.checkout-preview-page.preview-chrome-page .container {
        padding: 0 12px !important;
        gap: 12px !important;
    }
}

@media (max-width: 480px) {
    html.checkout-preview-page.preview-chrome-page .container {
        padding: 0 10px !important;
        gap: 12px !important;
    }
}

html.checkout-preview-page.preview-chrome-page .main-content {
    width: 100%;
    min-width: 0;
}

html.checkout-preview-page.preview-chrome-page .main-content.collect-checkout-empty,
html.checkout-preview-page.preview-chrome-page .main-content:has(.cart-section.collect-checkout-hidden) {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
}

html.checkout-preview-page.preview-chrome-page .footer {
    background: #622ADB !important;
    background-image: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 2px solid rgba(255, 255, 255, 1) !important;
    border-bottom: none !important;
    padding-bottom: 16px !important;
    margin-bottom: 0 !important;
    box-shadow: none !important;
}

@media (max-width: 768px) {
    html.checkout-preview-page.preview-chrome-page .footer {
        padding: 20px 16px 14px !important;
        border-radius: 20px 20px 0 0 !important;
    }
}

@media (max-width: 480px) {
    html.checkout-preview-page.preview-chrome-page .footer {
        padding: 16px 12px 12px !important;
        border-radius: 16px 16px 0 0 !important;
    }
}
