/* Modal de produto — layout e hierarquia visual */

.modal-sheet--product form.product-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding-bottom: 0;
}

.modal-sheet--product .modal-form-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 4px 20px 16px;
}

.modal-sheet--product .modal-form-footer {
    flex-shrink: 0;
    padding: 12px 20px max(12px, var(--app-safe-bottom));
    border-top: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .modal-sheet--product .modal-form-footer {
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}

.modal-sheet--product .submit-btn {
    position: static;
    margin: 0;
    box-shadow: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.01em;
}

/* Seções do formulário */
.product-form-section {
    margin-bottom: 20px;
    padding: 16px;
    border-radius: 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
}

.product-form-section:last-child {
    margin-bottom: 0;
}

.product-form-section--essential {
    background: transparent;
    border-color: transparent;
    padding: 4px 0 0;
    margin-bottom: 12px;
}

.product-form-section--photo {
    padding: 14px 16px;
    margin-bottom: 12px;
}

.product-form-section--values,
.product-form-section--more {
    padding-top: 14px;
    padding-bottom: 14px;
}

.product-form-section__title {
    margin: 0 0 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.3;
}

.product-form-section--essential .product-form-section__title {
    margin-bottom: 12px;
}

.field-optional {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: lowercase;
    color: var(--text-muted, var(--text-sub));
    opacity: 0.85;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
}

/* Nome em destaque */
.form-group--name label {
    font-size: 13px;
    font-weight: 600;
}

.form-group--name input#product-name {
    font-size: 17px;
    font-weight: 500;
    padding: 14px 14px;
    border-radius: 12px;
}

/* Foto compacta horizontal */
.modal-sheet--product .photo-preview-wrap--compact {
    flex-direction: row;
    align-items: center;
    gap: 14px;
    margin-bottom: 0;
}

.modal-sheet--product .photo-preview-box {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 12px;
    position: relative;
    font-family: inherit;
    overflow: hidden;
}

.modal-sheet--product .photo-preview.show {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.modal-sheet--product .photo-preview {
    width: 72px;
    height: 72px;
    border-radius: 12px;
}

.modal-sheet--product .photo-preview-placeholder {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    border-radius: 12px;
    font-size: 0;
    transition: border-color 0.2s, background 0.2s;
}

.modal-sheet--product .photo-preview-box:active .photo-preview-placeholder,
.modal-sheet--product .photo-upload-btn:active {
    opacity: 0.85;
}

.photo-preview-placeholder__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-sub);
}

.photo-preview-placeholder__icon svg {
    width: 28px;
    height: 28px;
}

.photo-preview-actions {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-sheet--product .photo-upload-btn {
    align-self: flex-start;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    border-style: solid;
    border-color: var(--accent, #2563eb);
    color: var(--accent, #2563eb);
    background: transparent;
}

.photo-upload-hint {
    margin: 0;
    font-size: 12px;
    color: var(--text-sub);
    line-height: 1.35;
}

/* Campos dentro das seções */
.product-form-section .form-group {
    margin-bottom: 12px;
}

.product-form-section .form-group:last-child {
    margin-bottom: 0;
}

.product-form-section .form-row-2 {
    margin-bottom: 0;
}

.product-form-section .form-row-2 + .form-group,
.product-form-section .form-group + .form-row-2 {
    margin-top: 12px;
}

/* Quantidade mais tocável */
.modal-sheet--product .qty-btn {
    min-width: 44px;
    min-height: 44px;
}

.modal-sheet--product .qty-input {
    min-height: 44px;
    font-size: 16px;
    font-weight: 600;
}

#product-category.select-loading,
#fav-edit-category.select-loading {
    opacity: 0.65;
    cursor: wait;
}

@media (min-width: 480px) {
    .modal-sheet--product .modal-form-scroll {
        padding-left: 24px;
        padding-right: 24px;
    }

    .modal-sheet--product .modal-form-footer {
        padding-left: 24px;
        padding-right: 24px;
    }
}

html.overlay-open .modal-overlay.open .modal-sheet--product .modal-form-scroll {
    touch-action: pan-y;
}
