/* =========================================================
   JOÃO PAULO - FILTRO DE FOTO
   V1.2.2 - TROCA DE MOLDURAS CORRIGIDA + CTA MAIS LEGÍVEL
========================================================= */

* { box-sizing: border-box; }

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, Helvetica, sans-serif;
    background: #f7f7f5;
    color: #181818;
}

.jp-app {
    width: calc(100% - 48px);
    max-width: 1240px;
    margin: 55px auto 80px;
}

.jp-intro {
    max-width: 900px;
    margin: 0 auto 30px;
    text-align: center;
}

.jp-intro h1 {
    margin: 0;
    font-size: clamp(34px, 4vw, 50px);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.08;
}

.jp-steps-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 24px auto 0;
}

.jp-step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #222;
    white-space: nowrap;
}

.jp-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #c91d24;
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
}

.jp-step-item strong {
    font-size: 16px;
    font-weight: 750;
    line-height: 1.25;
}

.jp-step-separator {
    width: 34px;
    height: 1px;
    background: #d4d4d1;
}

.jp-editor-card {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(350px, .85fr);
    gap: 54px;
    padding: 34px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .06);
    border-radius: 24px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, .055);
}

.jp-editor-main {
    min-width: 0;
}

.jp-canvas-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f1f1ef;
    border-radius: 18px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
    transition: outline .15s ease, transform .15s ease;
}

#fotoCanvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    cursor: grab;
    touch-action: none;
    transition: opacity .15s ease;
}

#fotoCanvas.arrastando {
    cursor: grabbing;
}

.jp-canvas-wrapper.trocando-moldura #fotoCanvas {
    opacity: .6;
}

.jp-canvas-wrapper.drag-over {
    outline: 3px dashed #c91d24;
    outline-offset: -9px;
    transform: scale(.995);
}

.jp-upload-prompt {
    position: absolute;
    left: 57%;
    top: 45%;
    transform: translate(-50%, -50%);
    z-index: 4;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    width: min(52%, 360px);
    padding: 8px 12px;

    color: #5d5d5d;
    text-align: center;
    cursor: pointer;

    background: rgba(255, 255, 255, .58);
    border-radius: 14px;

    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);

    transition: background .15s ease, transform .15s ease;
}

.jp-upload-prompt:hover {
    background: rgba(255, 255, 255, .76);
    transform: translate(-50%, -50%) translateY(-1px);
}

.jp-upload-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 7px;
    fill: none;
    stroke: #6b6b6b;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.jp-upload-prompt span {
    color: #5c5c5c;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
}

.jp-upload-prompt strong {
    color: #c91d24;
    font-weight: 800;
}


/* A chamada de upload ocupa a zona livre específica de cada arte. */
.jp-canvas-wrapper.moldura-institucional .jp-upload-prompt {
    left: 57%;
    top: 39%;
}

.jp-canvas-wrapper.moldura-apoio .jp-upload-prompt {
    left: 57%;
    top: 44%;
}

.jp-canvas-wrapper.moldura-moderna .jp-upload-prompt {
    left: 66%;
    top: 43%;
    width: min(46%, 320px);
}

.jp-app.tem-foto .jp-upload-prompt {
    display: none !important;
}

.jp-status {
    min-height: 22px;
    margin: 12px 0 0;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
}

.jp-status:empty {
    min-height: 0;
    margin-top: 0;
}

.jp-controls {
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding-top: 18px;
}

.jp-control-section {
    padding-bottom: 30px;
    border-bottom: 1px solid #eeeeec;
}

.jp-section-title {
    margin-bottom: 19px;
}

.jp-section-title h2 {
    margin: 0 0 5px;
    font-size: 21px;
    font-weight: 750;
    line-height: 1.25;
}

.jp-section-title p {
    margin: 0;
    color: #727272;
    font-size: 15px;
    line-height: 1.5;
}

.jp-styles-section .jp-section-title {
    margin-bottom: 14px;
}

.jp-zoom-control {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 58px;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
}

.jp-zoom-control input[type="range"] {
    width: 100%;
    height: 8px;
    cursor: pointer;
    accent-color: #c91d24;
}

.jp-photo-size-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: #444;
    cursor: pointer;
}

.jp-photo-size-btn svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .15s ease, color .15s ease;
}

.jp-photo-small svg {
    width: 30px;
    height: 30px;
}

.jp-photo-large svg {
    width: 44px;
    height: 44px;
}

.jp-photo-size-btn:hover:not(:disabled) svg {
    transform: scale(1.07);
    color: #c91d24;
}

.jp-photo-size-btn:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.jp-zoom-labels {
    display: flex;
    justify-content: space-between;
    margin: -5px 55px 0;
    color: #999;
    font-size: 12px;
}

.jp-btn-secondary {
    width: 100%;
    min-height: 44px;
    margin-top: 18px;
    padding: 10px 15px;
    border: 1px solid #dcdcdc;
    border-radius: 10px;
    background: #fff;
    color: #444;
    font-family: inherit;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
}

.jp-btn-secondary:hover:not(:disabled) {
    background: #f5f5f3;
}

.jp-btn-secondary:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.jp-molduras-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.jp-moldura-miniatura {
    display: block;
    width: 100%;
    padding: 6px;
    overflow: hidden;
    border: 1px solid #e1e1e1;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.jp-moldura-miniatura:hover {
    transform: translateY(-2px);
    border-color: #aaa;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .07);
}

.jp-moldura-miniatura img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    border-radius: 8px;
    background: #f5f5f3;
}


.jp-actions-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.jp-btn-primary {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    padding: 12px 22px;
    border: 1px solid #c91d24;
    border-radius: 10px;
    background: #fff;
    color: #c91d24;
    font-size: 16px;
    font-weight: 750;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}

.jp-app.tem-foto .jp-btn-primary {
    display: flex;
}

.jp-btn-primary:hover {
    background: #fff4f4;
    transform: translateY(-1px);
}

.jp-btn-final {
    width: 100%;
    min-height: 52px;
    padding: 13px 24px;
    border: 0;
    border-radius: 10px;
    background: #c91d24;
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 750;
    cursor: pointer;
    box-shadow: 0 9px 22px rgba(201, 29, 36, .18);
    transition: transform .15s ease, opacity .15s ease;
}

.jp-btn-final:hover:not(:disabled) {
    transform: translateY(-1px);
}

.jp-btn-final:disabled {
    opacity: .35;
    cursor: not-allowed;
    box-shadow: none;
}

.jp-btn-final.gerando {
    opacity: .65;
    cursor: wait;
    transform: none;
}

.jp-btn-final.gerado {
    background: #176f37;
    box-shadow: 0 9px 22px rgba(23, 111, 55, .18);
}

.jp-btn-final.gerado:hover:not(:disabled) {
    background: #145f30;
}

.jp-privacy {
    margin: 3px 0 0;
    color: #888;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
}

@media (max-width: 980px) {

    .jp-steps-bar {
        flex-wrap: wrap;
        gap: 12px 16px;
    }

    .jp-step-separator {
        width: 24px;
    }

    .jp-editor-card {
        grid-template-columns: 1fr;
        max-width: 760px;
        margin: 0 auto;
        gap: 34px;
    }

    .jp-controls {
        padding-top: 0;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 30px;
    }

    .jp-actions-area {
        grid-column: 1 / -1;
        max-width: 480px;
        width: 100%;
        margin: 0 auto;
    }
}

@media (max-width: 650px) {

    body {
        background: #fff;
    }

    .jp-app {
        width: calc(100% - 22px);
        margin: 26px auto 45px;
    }

    .jp-intro {
        margin-bottom: 20px;
    }

    .jp-intro h1 {
        font-size: 30px;
        line-height: 1.1;
    }

    .jp-steps-bar {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        margin-top: 18px;
        padding: 0 4px;
        text-align: left;
    }

    .jp-step-item {
        justify-content: flex-start;
        white-space: normal;
    }

    .jp-step-separator {
        display: none;
    }

    .jp-step-number {
        flex-basis: 28px;
        width: 28px;
        height: 28px;
        font-size: 13px;
    }

    .jp-step-item strong {
        font-size: 15px;
    }

    .jp-editor-card {
        display: block;
        padding: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .jp-canvas-wrapper {
        border-radius: 14px;
    }

    .jp-upload-prompt {
        left: 57%;
        top: 49%;
        width: min(58%, 260px);
        padding: 8px 10px;
        border-radius: 12px;
    }


    .jp-canvas-wrapper.moldura-institucional .jp-upload-prompt {
        left: 57%;
        top: 40%;
    }

    .jp-canvas-wrapper.moldura-apoio .jp-upload-prompt {
        left: 57%;
        top: 45%;
    }

    .jp-canvas-wrapper.moldura-moderna .jp-upload-prompt {
        left: 65%;
        top: 44%;
        width: min(50%, 240px);
    }

    .jp-upload-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 5px;
    }

    .jp-upload-prompt span {
        font-size: 14px;
        line-height: 1.35;
    }

    .jp-controls {
        display: block;
        margin-top: 14px;
    }

    .jp-controls .jp-control-section:first-child .jp-section-title {
        display: none;
    }

    .jp-control-section {
        margin-bottom: 24px;
        padding-bottom: 0;
        border-bottom: 0;
    }

    .jp-section-title {
        margin-bottom: 12px;
    }

    .jp-section-title h2 {
        font-size: 20px;
    }

    .jp-zoom-control {
        grid-template-columns: 42px minmax(0, 1fr) 52px;
        gap: 10px;
        padding: 2px 0 4px;
    }

    .jp-photo-small svg {
        width: 28px;
        height: 28px;
    }

    .jp-photo-large svg {
        width: 40px;
        height: 40px;
    }

    .jp-zoom-labels {
        margin: -2px 48px 0;
        font-size: 12px;
    }

    .jp-btn-secondary {
        min-height: 40px;
        margin-top: 10px;
        padding: 8px 12px;
    }

    .jp-btn-primary,
    .jp-btn-final {
        font-size: 16px;
    }

    .jp-privacy {
        font-size: 12px;
    }
}
