/* desktop/digital — layout Figma Desktop-1 (node 609:442) */

.ferramenta-desktop {
    --desktop-sidebar-width: 440px;
    --desktop-sidebar-height: calc(100vh - 50px);
    --desktop-canvas-width: calc(var(--template-scaled-width, 810.4px) + 24px);
    --desktop-art-block-height: calc(var(--template-scaled-height, 565px));
    --desktop-canvas-top-offset: 62px;
    --desktop-3d-panel-height: var(--desktop-art-block-height);
    --desktop-3d-width: 350px;
    --desktop-col-gap: 23px;
    --desktop-bg: var(--fundo-app);
    min-height: 100vh;
    background: var(--desktop-bg);
}

.ferramenta-desktop.app-wrapper {
    width: 100%;
    min-height: 100vh;
    overflow: visible;
}

.btn-cart {
    max-width: 350px;
    width: 100%;
    height: 30px;
    padding: 5px 10px;
}

.header-desktop {
    height: 50px;
    background-color: var(--verde-escuro);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 40px;
}

.header-desktop-product {
    margin: 0;
    color: #fff;
    text-align: center;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

html:has(.ferramenta-desktop),
body:has(.ferramenta-desktop) {
    position: static !important;
    inset: auto;
    width: 100%;
    min-height: 100vh;
    height: auto;
    overflow: hidden !important;
    background: var(--desktop-bg);
}

.ferramenta-desktop .desktop-layout {
    display: flex;
    align-items: start;
    /* justify-content: center; */
    width: 100%;
     /* max-width: 1440px; */
    min-height: calc(100vh - 50px);
    margin: 0 auto;
    padding: 0px 40px 0px 0px;
    box-sizing: border-box;
}

/* ── Coluna esquerda: tabs + card + carrinho ── */
.ferramenta-desktop .desktop-sidebar-col {
    width: var(--desktop-sidebar-width);
    height: var(--desktop-sidebar-height);
    gap: 12px;
    background: #fff;
    padding: 20px 15px;
}

.ferramenta-desktop .wrap-art-space {
    flex-grow: 1;
    height: calc(100vh - 50px);
    display: flex;
    align-items: flex-start;
    justify-content: space-around;
    padding-top: max(16px, calc((100vh - var(--desktop-art-block-height) - var(--desktop-canvas-top-offset) - 150px) / 2));
    box-sizing: border-box;
}

.ferramenta-desktop .desktop-menu {
    display: flex;
    gap: 0;
    width: 100%;
    padding: 0;
    margin-bottom: 10px;
    justify-content: space-around;
    align-items: flex-start;
}

.ferramenta-desktop .desktop-menu .menu-tab {
    flex: 1;
    min-width: 0;
    height: auto;
    padding: 0;
    border: none !important;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    color: #8a9a8a;
    text-transform: none;
    opacity: 1;
    gap: 4px;
}

.ferramenta-desktop .desktop-menu .menu-tab.active {
    color: var(--verde);
    opacity: 1;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.ferramenta-desktop .desktop-menu .menu-tab[data-target="panel-ai"],
.ferramenta-desktop .desktop-menu .menu-tab[data-target="panel-ai"]:not(.active),
.ferramenta-desktop .desktop-menu .menu-tab.active[data-target="panel-ai"] {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    opacity: 1;
}

.ferramenta-desktop .menu-tab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: inherit;
}

.ferramenta-desktop .menu-tab-icon svg {
    width: 24px;
    height: 24px;
    display: block;
}

.ferramenta-desktop .menu-tab[data-target="panel-ai"] .menu-tab-icon,
.ferramenta-desktop .menu-tab[data-target="panel-ai"] .menu-tab-icon svg {
    width: 27px;
    height: 27px;
}

.ferramenta-desktop .menu-tab-label {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
}

.ferramenta-desktop .desktop-sidebar-card {
    width: 100%;
    min-height: 320px;
    max-height: calc(100vh - 220px);
    padding: 15px;
    border: 1px solid #fff;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.ai-mode-card-scroll {
    overflow-y: auto;
    scrollbar-gutter: unset;
    scrollbar-width: thin;
    scrollbar-color: #c8c8c8 rgba(0, 0, 0, 0.08);
}

.ferramenta-desktop .sidebar-panels-container {
    max-height: 100%;
    overflow-y: auto;
    padding: 0;
}

.ferramenta-desktop .desktop-sidebar-footer {
    padding: 0;
    margin-top: 4px;
    border: none;
}

.ferramenta-desktop .desktop-sidebar-footer .btn-cart {
    min-height: 30px;
    height: auto;
    padding: 6px 16px;
    font-size: 14px;
    background: var(--verde);
    border: none;
    box-shadow: 0 4px 12px rgba(122, 193, 67, 0.35);
}

.ferramenta-desktop .desktop-sidebar-footer .btn-cart:hover {
    background: var(--verde-hover);
}

.ferramenta-desktop .sidebar-controls {
    width: 100%;
    max-height: 100%;
    min-width: 0;
    height: auto;
    padding: 0;
    background: transparent;
    box-shadow: unset;
    border-radius: unset;
}

.ferramenta-desktop .bg-light-grey {
    background: transparent;
}

.ferramenta-desktop .upload-dashed-box {
    min-height: 260px;
    padding: 20px;
    border-radius: 10px;
}

.ferramenta-desktop .upload-dashed-box .fs-40 {
    font-size: 40px;
}

.ferramenta-desktop .panel-content .card {
    box-shadow: none;
    padding: 0;
}

.ferramenta-desktop .panel-content {
    padding-right: 5px;
}
.ferramenta-desktop .approval-card {
    padding: 0px;
    border-radius: unset;
}
.ferramenta-desktop .approval-actions {
    padding: 0px;
    padding-bottom: 0px;
    background: #fff;
    border: unset;
    margin-top: 20px;
}

/* ── Coluna central: gabarito ── */
.ferramenta-desktop .desktop-canvas {
    width: var(--desktop-canvas-width);
    flex-shrink: 0;
    height: auto;
    min-height: unset;
    border-radius: 5px;
    padding: 12px;
    box-sizing: border-box;
}

.ferramenta-desktop .canvas-top-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    margin-bottom: 8px;
}

.ferramenta-desktop .history-controls-container {
    position: static;
    right: auto;
    bottom: auto;
    flex-direction: row;
    gap: 8px;
}

.ferramenta-desktop .canvas-workspace {
    position: relative;
    width: 100%;
    min-height: var(--desktop-art-block-height);
    height: var(--desktop-art-block-height);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.ferramenta-desktop .desktop-canvas .template {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    border: unset;
}

.ui-resizable-handle.ui-resizable-se {
    bottom: -100px !important;
    right: -100px !important;
    width: 140px !important;
    height: 140px !important;
}
.ui-rotatable-handle {
    bottom: -190px !important;
    width: 140px !important;
    height: 140px !important;
}

/* ── Coluna direita: 3D ── */
.ferramenta-desktop .desktop-3d-col {
    width: var(--desktop-3d-width);
    flex-shrink: 0;
    margin-top: var(--desktop-canvas-top-offset);
    gap: 12px;
}

.ferramenta-desktop .desktop-3d-panel {
    width: 100%;
    flex-shrink: 0;
    height: var(--desktop-3d-panel-height);
    min-height: var(--desktop-3d-panel-height);
    padding: 0;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.ferramenta-desktop .desktop-3d-stage {
    flex: 1;
    width: 100%;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ferramenta-desktop #custom-3d-container {
    height: 100%;
    max-height: none;
    margin: 0 auto;
}

.ferramenta-desktop #custom-3d-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.ferramenta-desktop .btn-atualizar-3d {
    flex-shrink: 0;
    height: 29px;
    margin: 0;
    padding: 4px 20px;
    border: 1px solid var(--verde-escuro);
    border-radius: 20px;
    background: #fff;
    color: var(--verde-escuro);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.ferramenta-desktop .desktop-3d-cart {
    max-width: var(--desktop-3d-width);
    min-height: 30px;
    max-height: 30px;
    height: auto;
    padding: 6px 16px;
    font-size: 14px;
    background: var(--verde);
    border: none;
    box-shadow: 0 4px 12px rgba(122, 193, 67, 0.35);
}

.ferramenta-desktop .desktop-3d-cart:hover {
    background: var(--verde-hover);
}

.ferramenta-desktop .btn-atualizar-3d:hover {
    background: #f7fcf9;
}

.ferramenta-desktop .cup-3d-generate,
.ferramenta-desktop .sidebar-drawer-handle {
    display: none !important;
}

.ferramenta-desktop .ai-panel-actions {
    position: sticky;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #fff 24%);
    padding-top: 8px;
}

.form-actions, .medidor-actions {
    justify-content: center;
}

.ferramenta-desktop .btn-accent {
    height: 30px;
    min-height: 30px;
    max-height: 30px;
    padding: 0 16px;
    box-sizing: border-box;
}

.ai-edit-modal-inner {
    margin: 0 auto;
    max-width: min(1180px, 94vw);
    /* height: auto; */
    max-height: calc(100dvh - 48px);
    min-height: 0;
    padding:
        max(24px, env(safe-area-inset-top, 0px))
        max(32px, env(safe-area-inset-right, 32px))
        max(28px, env(safe-area-inset-bottom, 28px))
        max(32px, env(safe-area-inset-left, 32px));
}

.ai-edit-overlay--desktop {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.ai-edit-overlay--desktop .ai-edit-modal {
    height: auto;
    width: 100%;
    display: flex;
    justify-content: center;
}

.ai-edit-overlay--desktop .ai-edit-step.is-active {
    flex: 0 0 auto;
}

.ai-edit-overlay--desktop .ai-edit-prompt-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
    gap: 24px;
    width: 100%;
    height: min(52vh, 460px);
    min-height: 340px;
    max-height: 460px;
    align-items: stretch;
}

.ai-edit-overlay--desktop .ai-edit-prompt-form {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.ai-edit-overlay--desktop .ai-edit-preview-wrap--compact {
    height: 100%;
    min-height: 0;
    max-height: none;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.ai-edit-overlay--desktop .ai-edit-preview-wrap--compact .ai-edit-preview {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
    object-fit: contain;
}

.ai-edit-overlay--desktop .ai-edit-label {
    flex-shrink: 0;
    margin-bottom: 10px;
}

.ai-edit-overlay--desktop .ai-edit-textarea {
    flex: 1 1 auto;
    min-height: 96px;
    max-height: none;
    height: auto;
    margin-bottom: 14px;
    resize: none;
}

.ai-edit-overlay--desktop .ai-edit-prompt-form .ai-edit-primary-btn {
    flex-shrink: 0;
    width: auto;
    min-width: 160px;
    max-width: 200px;
    margin: 0;
    align-self: flex-start;
    margin-top: auto;
}

/* ── Edição IA: passo resultado (imagem não pode empurrar os botões) ── */
.ai-edit-overlay--desktop .ai-edit-step[data-ai-edit-step="result"] .ai-edit-preview-wrap,
.ai-edit-overlay--desktop .ai-edit-step[data-ai-edit-step="processing"] .ai-edit-preview-wrap--compact {
    flex: 0 1 auto;
    width: 100%;
    max-height: min(48vh, 420px);
    min-height: 160px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.ai-edit-overlay--desktop .ai-edit-step[data-ai-edit-step="result"] .ai-edit-preview,
.ai-edit-overlay--desktop .ai-edit-step[data-ai-edit-step="processing"] .ai-edit-preview {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(44vh, 388px);
    object-fit: contain;
}

.ai-edit-overlay--desktop .ai-edit-step[data-ai-edit-step="result"] .ai-edit-result-label {
    flex-shrink: 0;
}

.ai-edit-overlay--desktop .ai-edit-step[data-ai-edit-step="result"] .ai-edit-result-actions {
    flex-shrink: 0;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    padding-top: 8px;
}

.ai-edit-close {
    position: absolute;
}

@media (max-width: 960px) {
    .ai-edit-overlay--desktop .ai-edit-prompt-layout {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
        max-height: none;
    }

    .ai-edit-overlay--desktop .ai-edit-preview-wrap--compact {
        height: auto;
        min-height: 220px;
        max-height: min(42vh, 360px);
    }

    .ai-edit-overlay--desktop .ai-edit-textarea {
        min-height: 120px;
    }
}

@media (max-width: 1320px) {
    .ferramenta-desktop .desktop-layout {
        grid-template-columns: minmax(280px, 320px) minmax(0, 1fr) minmax(280px, 320px);
        /* padding: 32px 24px; */
        gap: 16px;
    }

    .ferramenta-desktop .desktop-canvas {
        width: 100%;
    }
}

@media (max-width: 1024px) {
    .ferramenta-desktop .desktop-layout {
        grid-template-columns: 1fr;
        max-width: 720px;
    }

    .ferramenta-desktop .desktop-canvas {
        height: auto;
        min-height: 360px;
    }

    .ferramenta-desktop .desktop-3d-panel {
        height: auto;
        min-height: 360px;
    }

    .ferramenta-desktop .desktop-3d-col {
        width: 100%;
        max-width: 320px;
    }

    .ferramenta-desktop #custom-3d-container {
        width: 100%;
        max-width: 220px;
    }
}

/* ── Ampliar arte (fullscreen) — desktop menor que mobile ── */
.ferramenta-desktop .template-fullscreen-stage {
    width: min(82vw, 920px);
    max-height: 76vh;
    height: auto;
}

.ferramenta-desktop .template-fullscreen-overlay.is-open {
    padding: 24px;
}

.ferramenta-desktop .btn-close-fullscreen {
    top: 24px;
    left: 24px;
}

.btn-close-fullscreen {
    left: unset;
    right: max(30px, env(safe-area-inset-right, 16px));
}