/* ==========================================
   PASSPORT PHOTO MAKER
========================================== */

.passport-photo-page .tool-page-title {
    font-size: 2.25rem;
    font-weight: 700;
}

.passport-photo-page .tool-page-description {
    font-size: 1.075rem;
    color: var(--gray-color, #6b7280);
    max-width: 720px;
    margin: 0 auto;
}

/* ---------- Crop stage ---------- */
.pp-stage {
    position: relative;
    display: block;
    margin: 0 auto;
    width: -moz-fit-content;
    width: fit-content;
    max-width: 100%;
    line-height: 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    touch-action: none;
    /* The crop box dims everything outside itself with a huge spread
       box-shadow. This clip keeps that dimming inside the photo instead
       of letting it bleed across the whole page. */
    overflow: hidden;
    border-radius: 6px;
}

#ppCanvas {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    background: #fff;
}

/* ---------- Crop box ---------- */
.pp-crop-box {
    position: absolute;
    top: 0;
    left: 0;
    box-sizing: border-box;
    border: 2px solid #fff;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    cursor: move;
    z-index: 2;
}

.pp-crop-box::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px dashed rgba(37, 99, 235, 0.9);
    pointer-events: none;
}

/* Head / chin / eye guides inside the crop box */
.pp-guide {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-top: 1px dashed rgba(255, 255, 255, 0.85);
    pointer-events: none;
}

.pp-guide::before {
    position: absolute;
    left: 4px;
    top: -16px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    line-height: 1;
    white-space: nowrap;
}

.pp-guide-head::before {
    content: 'Top of head';
}

.pp-guide-chin::before {
    content: 'Chin';
}

.pp-guide-eye {
    border-top-style: dotted;
    border-top-color: rgba(255, 214, 0, 0.9);
}

.pp-guide-eye::before {
    content: 'Eye line';
    color: #ffd600;
}

.pp-guide-center {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 0;
    border-left: 1px dotted rgba(255, 255, 255, 0.5);
    pointer-events: none;
}

/* ---------- Resize handles ---------- */
.pp-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fff;
    border: 2px solid var(--primary-color, #2563eb);
    border-radius: 3px;
    z-index: 3;
}

/* Handles sit just inside the box so the stage's overflow clip
   never cuts them off when the crop reaches the photo edge. */
.pp-handle-nw {
    top: -1px;
    left: -1px;
    cursor: nwse-resize;
}

.pp-handle-ne {
    top: -1px;
    right: -1px;
    cursor: nesw-resize;
}

.pp-handle-sw {
    bottom: -1px;
    left: -1px;
    cursor: nesw-resize;
}

.pp-handle-se {
    bottom: -1px;
    right: -1px;
    cursor: nwse-resize;
}

/* ---------- Background swatches ---------- */
.pp-swatch {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #dee2e6;
    padding: 0;
    background: #fff;
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.pp-swatch:hover {
    transform: translateY(-2px);
    border-color: var(--primary-light, #60a5fa);
}

.pp-swatch.active {
    border-color: var(--primary-color, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* ---------- Result ---------- */
.pp-result-frame {
    background: #f1f3f5;
    background-image:
        linear-gradient(45deg, #e9ecef 25%, transparent 25%),
        linear-gradient(-45deg, #e9ecef 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e9ecef 75%),
        linear-gradient(-45deg, transparent 75%, #e9ecef 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    border-radius: 10px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
}

.pp-result-frame img {
    max-height: 340px;
    width: auto;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    background: #fff;
}

/* ---------- Busy state ---------- */
.pp-busy {
    opacity: 0.6;
    pointer-events: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
    .passport-photo-page .tool-page-title {
        font-size: 1.75rem;
    }

    .pp-result-frame img {
        max-height: 260px;
    }
}

@media (max-width: 575px) {
    .pp-swatch {
        width: 34px;
        height: 34px;
    }

    /* Bigger touch targets on phones, still inside the clip. */
    .pp-handle {
        width: 20px;
        height: 20px;
    }
}
