/* ============================================================
   OrthoPlan Pro — patient photos (6 Nov 2026, package PHO)
   Loaded after public.css (OrthoPlan_Public::module_assets()).
   Function only: tokens, logical properties, existing containers.
   The look itself is package S's design layer (op-zz-design.css).
   ============================================================ */

/* ---------- One way to draw a photo (R-SYS-15) ----------
   The preview turn of ⟳ / ⇋ is a transform on the <img>; it eases so the
   doctor sees which way it went. */
.op-frontend .op-photo-img { transition: transform .18s ease; }
.op-frontend .op-photo-slot-name { overflow-wrap: anywhere; }

/* ---------- Rotate / Mirror / Crop under every photo (R-PHO-09) ----------
   Under the picture, not over it, and at least 32px (the app's tap floor). */
.op-frontend .op-photo-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-block-start: 4px;
}
.op-frontend .op-photo-tool {
    flex: 1 1 0;
    min-inline-size: 32px;
    min-block-size: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 2px 6px;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--op-text);
    background: var(--op-surface);
    border: 1px solid var(--op-border-strong);
    border-radius: var(--op-radius-sm, 6px);
    cursor: pointer;
}
.op-frontend .op-photo-tool:hover { border-color: var(--op-accent); background: var(--op-accent-light); }
.op-frontend .op-photo-tool:focus-visible { outline: 2px solid var(--op-info); outline-offset: 1px; }
.op-frontend .op-photo-tool-icon { font-size: 15px; line-height: 1; }
/* The visit tiles are small: icons only there, names as tooltip and label. */
.op-frontend .op-visit-slot .op-photo-tool-name { display: none; }
@media (max-width: 640px) {
    /* On a phone, icons only; the names stay as the tooltip and aria-label. */
    .op-frontend .op-photo-tool-name { display: none; }
}

/* ---------- Functional shift: its state in words (R-PHO-07) ---------- */
.op-frontend .op-shift-state:empty { display: none; }
.op-frontend .op-shift-state {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--op-primary-dark);
    flex: 1 1 260px;
}
.op-frontend .op-shift-hint[hidden] { display: none; }

/* ---------- Normal bite | Second bite — with shift (R-PHO-10) ---------- */
.op-frontend .op-bite-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-block-end: var(--op-sp-3);
}
.op-frontend .op-bite-tabs[hidden],
.op-frontend [data-bite-panel][hidden] { display: none; }
.op-frontend .op-bite-tab {
    min-block-size: 36px;
    padding: 6px 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--op-text-muted);
    background: var(--op-bg);
    border: 1px solid var(--op-border-strong);
    border-radius: var(--op-radius-pill, 999px);
    cursor: pointer;
}
.op-frontend .op-bite-tab.is-active {
    color: var(--op-primary-text);
    background: var(--op-primary);
    border-color: var(--op-primary);
}
.op-frontend .op-bite-tab:focus-visible { outline: 2px solid var(--op-info); outline-offset: 2px; }
.op-frontend .op-bite-count { font-weight: 500; margin-inline-start: 4px; opacity: .85; }
/* fix/complete (R16-07, STATUS (d)): the "second-bite photos kept" line is no longer printed (fix/dia); its two dead
   rules are gone, and photos_check pins that no stylesheet, script or view names its class again. */

/* ---------- The X-rays he adds (R-PHO-11) ---------- */
.op-frontend .op-xray-add { border-style: dashed; justify-content: center; }
.op-frontend .op-photo-slot.is-new { box-shadow: 0 0 0 2px var(--op-accent); }
.op-frontend .op-xray-extra-actions,
.op-frontend .op-xray-rename-box { display: flex; flex-wrap: wrap; gap: 6px; }
.op-frontend .op-xray-extra-actions[hidden],
.op-frontend .op-xray-rename-box[hidden] { display: none; }
.op-frontend .op-xray-rename-box .op-input { flex: 1 1 100%; min-inline-size: 0; }

/* ---------- The crop window (R-PHO-09) ---------- */
.op-frontend .op-crop-modal .op-crop-content { max-width: min(940px, 96vw); padding: var(--op-sp-5); }
.op-frontend .op-crop-modal h3 { margin: 0 0 4px; font-size: 16px; }
.op-frontend .op-crop-modal .op-crop-hint { margin: 0 0 var(--op-sp-3); font-size: 12.5px; }
.op-frontend .op-crop-modal .op-crop-stage {
    position: relative;
    margin-inline: auto;
    max-inline-size: 100%;
    touch-action: none;           /* the drag is the box's, not the page's */
    user-select: none;
    -webkit-user-select: none;
    background: var(--op-bg-alt);
    min-block-size: 120px;
    overflow: hidden;             /* the dimming shadow stops at the photo */
}
.op-frontend .op-crop-modal .op-crop-canvas { display: block; }
.op-frontend .op-crop-modal .op-crop-box {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid #fff;
    outline: 1px solid rgba(14, 28, 36, .7);
    /* Everything outside the box is dimmed: what stays is what is lit. */
    box-shadow: 0 0 0 9999px rgba(14, 28, 36, .45);
    cursor: move;
}
.op-frontend .op-crop-modal .op-crop-box:focus-visible { outline: 2px solid var(--op-info); }
.op-frontend .op-crop-modal .op-crop-handle {
    position: absolute;
    inline-size: 22px;
    block-size: 22px;
    background: #fff;
    border: 2px solid var(--op-primary);
    border-radius: 50%;
}
/* Physical corners: the box is drawn in the picture's own coordinates. */
.op-frontend .op-crop-modal .op-crop-nw { left: -11px; top: -11px; cursor: nwse-resize; }
.op-frontend .op-crop-modal .op-crop-ne { right: -11px; top: -11px; cursor: nesw-resize; }
.op-frontend .op-crop-modal .op-crop-sw { left: -11px; bottom: -11px; cursor: nesw-resize; }
.op-frontend .op-crop-modal .op-crop-se { right: -11px; bottom: -11px; cursor: nwse-resize; }
.op-frontend .op-crop-modal .op-crop-status {
    position: absolute;
    inset: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--op-text-muted);
}
.op-frontend .op-crop-modal .op-crop-status[hidden] { display: none; }
.op-frontend .op-crop-modal .op-crop-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--op-sp-2);
    margin-block-start: var(--op-sp-3);
}
.op-frontend .op-crop-modal .op-crop-turns,
.op-frontend .op-crop-modal .op-crop-shape { display: flex; flex-wrap: wrap; gap: 6px; }
.op-frontend .op-crop-modal .op-crop-turns .op-btn { min-inline-size: 40px; min-block-size: 36px; font-size: 16px; }
.op-frontend .op-crop-modal .op-crop-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--op-sp-2); margin-block-start: var(--op-sp-4); }
.op-frontend .op-crop-modal .op-crop-actions .op-btn:first-child { margin-inline-end: auto; }

/* ---------- fix/board24 (M24-42): Straighten on Patient Photos ----------
   The fine turn beside Rotate, Mirror and Crop: its own line icon, and a
   window like the crop's — the photo over a grid, a slider with −1° / +1°,
   Straight (0°), Cancel and Apply. 44 px to tap. */
.op-frontend .op-photo-tool-svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.op-frontend .op-tilt-modal .op-tilt-content { max-width: min(720px, 96vw); padding: var(--op-sp-5, 20px); }
.op-frontend .op-tilt-modal h3 { margin: 0 0 4px; font-size: 16px; }
.op-frontend .op-tilt-modal .op-tilt-hint { margin: 0 0 var(--op-sp-3, 12px); font-size: 12.5px; }
.op-frontend .op-tilt-modal .op-tilt-stage {
    position: relative;
    overflow: hidden;
    max-height: min(56vh, 520px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ds-n-900, #131d23);
    border-radius: var(--op-radius-sm, 6px);
}
.op-frontend .op-tilt-modal .op-tilt-img { display: block; max-width: 100%; max-height: min(56vh, 520px); transition: transform .12s ease; }
.op-frontend .op-tilt-modal .op-tilt-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, .45) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, .45) 1px, transparent 1px);
    background-size: 16.666% 16.666%;
}
.op-frontend .op-tilt-modal .op-tilt-row { display: flex; align-items: center; gap: var(--op-sp-2, 8px); margin-block-start: var(--op-sp-3, 12px); direction: ltr; }
.op-frontend .op-tilt-modal .op-tilt-range { flex: 1 1 auto; min-width: 0; height: 44px; margin: 0; accent-color: var(--op-primary); cursor: pointer; }
.op-frontend .op-tilt-modal .op-tilt-step { min-width: 52px; min-height: 44px; font-variant-numeric: tabular-nums; }
.op-frontend .op-tilt-modal .op-tilt-val { min-width: 52px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.op-frontend .op-tilt-modal .op-tilt-acts { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--op-sp-2, 8px); margin-block-start: var(--op-sp-3, 12px); }
.op-frontend .op-tilt-modal .op-tilt-acts .op-btn { min-height: 44px; }
.op-frontend .op-tilt-modal .op-tilt-zero { margin-inline-end: auto; }
@media (max-width: 480px) {
    .op-frontend .op-tilt-modal .op-tilt-content { padding: var(--op-sp-3, 12px); }
    .op-frontend .op-tilt-modal .op-tilt-zero { margin-inline-end: 0; flex-basis: 100%; }
}
