/**
 * photo-studio.css — OECTA Native Photo Studio Modal
 * Scoped under #oecta-photo-studio (and .ops-modal-backdrop) using pure
 * OECTA Design System tokens (--oecta-* / --con-*). Zero raw hex colours.
 */

.ops-modal-backdrop#oecta-photo-studio {
    position: fixed;
    inset: 0;
    z-index: var(--oecta-z-modal, 10000);
    background: var(--oecta-scrim, color-mix(in srgb, var(--oecta-primary) 72%, transparent));
    backdrop-filter: blur(var(--oecta-glass-blur, 10px));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--oecta-space-md, 16px);
    box-sizing: border-box;
    font-family: var(--oecta-font-body, Inter, system-ui, sans-serif);
    color: var(--oecta-on-surface);
}

.ops-modal-backdrop#oecta-photo-studio[hidden] {
    display: none !important;
}

#oecta-photo-studio .ops-dialog {
    width: 100%;
    max-width: 1120px;
    height: min(88dvh, 780px);
    background: var(--oecta-surface-lowest);
    border-radius: var(--oecta-radius-xl, 16px);
    box-shadow: var(--oecta-shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

/* ── Header (Fixed flex-shrink: 0) ────────────────────────────────────────── */
#oecta-photo-studio .ops-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--oecta-space-md, 16px);
    padding: var(--oecta-space-sm, 12px) var(--oecta-space-lg, 20px);
    background: var(--oecta-primary-container);
    color: var(--oecta-on-primary);
}

#oecta-photo-studio .ops-head-left {
    display: flex;
    align-items: center;
    gap: var(--oecta-space-sm, 12px);
    min-width: 0;
}

#oecta-photo-studio .ops-brand-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--oecta-space-2xs, 6px);
    padding: var(--oecta-space-3xs, 4px) var(--oecta-space-sm, 10px);
    border-radius: var(--oecta-radius-pill, 9999px);
    background: var(--oecta-accent-container);
    color: var(--oecta-on-surface);
    font-family: var(--oecta-font-display, Manrope, sans-serif) !important;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

#oecta-photo-studio .ops-title {
    margin: 0;
    font-family: var(--oecta-font-display, Manrope, sans-serif) !important;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--oecta-on-primary) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#oecta-photo-studio .ops-head-right {
    display: flex;
    align-items: center;
    gap: var(--oecta-space-xs, 8px);
}

#oecta-photo-studio .ops-dimensions-pill {
    font-family: var(--oecta-font-mono, "Roboto Mono", monospace) !important;
    font-variant-numeric: tabular-nums;
    font-size: 0.76rem;
    font-weight: 600;
    padding: var(--oecta-space-2xs, 6px) var(--oecta-space-sm, 10px);
    border-radius: var(--oecta-radius-pill, 9999px);
    background: color-mix(in srgb, var(--oecta-on-primary) 14%, transparent);
    color: var(--oecta-on-primary);
}

#oecta-photo-studio .ops-close-btn {
    min-width: 44px;
    min-height: 44px;
    border: none;
    border-radius: var(--oecta-radius-md, 8px);
    background: transparent;
    color: var(--oecta-on-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--oecta-duration-fast, 150ms) var(--oecta-ease, ease);
}

#oecta-photo-studio .ops-close-btn:hover {
    background: color-mix(in srgb, var(--oecta-on-primary) 16%, transparent);
}

#oecta-photo-studio .ops-close-btn:focus-visible {
    outline: none;
    box-shadow: var(--oecta-focus-accent);
}

/* ── Main Workbench Body (Stage + Controls Rail) ─────────────────────────── */
#oecta-photo-studio .ops-body {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 340px;
    background: var(--oecta-surface);
    overflow: hidden;
}

/* ── Left: Interactive Canvas Stage ──────────────────────────────────────── */
#oecta-photo-studio .ops-stage-col {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: var(--oecta-surface-container);
    overflow: hidden;
}

#oecta-photo-studio .ops-stage-wrap {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--oecta-space-lg, 20px);
    user-select: none;
    touch-action: none;
    overflow: hidden;
}

#oecta-photo-studio .ops-canvas-box {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
    box-shadow: var(--oecta-shadow-lg);
    border-radius: var(--oecta-radius-sm, 6px);
    overflow: hidden;
    background: var(--oecta-surface-lowest);
}

#oecta-photo-studio .ops-canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    cursor: crosshair;
}

#oecta-photo-studio .ops-stage-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--oecta-space-sm, 12px);
    padding: var(--oecta-space-xs, 8px) var(--oecta-space-md, 16px);
    background: var(--oecta-surface-low);
    color: var(--oecta-on-surface-variant);
    font-size: 0.8rem;
}

#oecta-photo-studio .ops-stage-hint {
    display: inline-flex;
    align-items: center;
    gap: var(--oecta-space-2xs, 6px);
    color: var(--oecta-text-muted);
    font-weight: 500;
}

#oecta-photo-studio .ops-stage-quick {
    display: inline-flex;
    align-items: center;
    gap: var(--oecta-space-xs, 8px);
}

/* ── Right: Controls Inspector Rail ──────────────────────────────────────── */
#oecta-photo-studio .ops-rail-col {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--oecta-surface-lowest);
    box-shadow: var(--oecta-shadow-sm);
    z-index: 2;
}

#oecta-photo-studio .ops-tabs {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: var(--oecta-surface-low);
    padding: var(--oecta-space-2xs, 6px);
    gap: var(--oecta-space-3xs, 4px);
}

#oecta-photo-studio .ops-tab {
    min-height: 44px;
    border: none;
    border-radius: var(--oecta-radius-md, 8px);
    background: transparent;
    color: var(--oecta-on-surface-variant);
    font-family: var(--oecta-font-body, Inter, sans-serif);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--oecta-space-2xs, 6px);
    transition: background var(--oecta-duration-fast, 150ms) var(--oecta-ease, ease),
                color var(--oecta-duration-fast, 150ms) var(--oecta-ease, ease);
}

#oecta-photo-studio .ops-tab:hover {
    background: var(--oecta-surface-container);
    color: var(--oecta-on-surface);
}

#oecta-photo-studio .ops-tab.is-active {
    background: var(--oecta-surface-lowest);
    color: var(--oecta-primary-container);
    box-shadow: var(--oecta-shadow-xs);
    border-bottom: 3px solid var(--oecta-accent);
}

#oecta-photo-studio .ops-tab:focus-visible {
    outline: none;
    box-shadow: var(--oecta-focus-ring);
}

#oecta-photo-studio .ops-pane {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: var(--oecta-space-md, 16px);
    display: flex;
    flex-direction: column;
    gap: var(--oecta-space-md, 16px);
}

#oecta-photo-studio .ops-pane[hidden] {
    display: none !important;
}

#oecta-photo-studio .ops-group {
    display: flex;
    flex-direction: column;
    gap: var(--oecta-space-xs, 8px);
    background: var(--oecta-surface-low);
    padding: var(--oecta-space-sm, 12px);
    border-radius: var(--oecta-radius-lg, 12px);
}

#oecta-photo-studio .ops-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--oecta-space-xs, 8px);
}

#oecta-photo-studio .ops-label {
    font-family: var(--oecta-font-display, Manrope, sans-serif) !important;
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--oecta-on-surface-variant);
    margin: 0;
}

#oecta-photo-studio .ops-val-mono {
    font-family: var(--oecta-font-mono, "Roboto Mono", monospace) !important;
    font-variant-numeric: tabular-nums;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--oecta-on-surface);
}

#oecta-photo-studio .ops-chip-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--oecta-space-2xs, 6px);
}

#oecta-photo-studio .ops-chip-grid--2 {
    grid-template-columns: repeat(2, 1fr);
}

#oecta-photo-studio .ops-chip-btn {
    min-height: 44px;
    padding: var(--oecta-space-2xs, 6px) var(--oecta-space-xs, 8px);
    border: none;
    border-radius: var(--oecta-radius-md, 8px);
    background: var(--oecta-surface-lowest);
    color: var(--oecta-on-surface);
    font-family: var(--oecta-font-body, Inter, sans-serif);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--oecta-space-3xs, 4px);
    box-shadow: var(--oecta-shadow-xs);
    transition: background var(--oecta-duration-fast, 150ms) var(--oecta-ease, ease),
                color var(--oecta-duration-fast, 150ms) var(--oecta-ease, ease);
}

#oecta-photo-studio .ops-chip-btn:hover {
    background: var(--oecta-surface-container);
}

#oecta-photo-studio .ops-chip-btn.is-active {
    background: var(--oecta-primary-container);
    color: var(--oecta-on-primary);
}

#oecta-photo-studio .ops-chip-btn:focus-visible {
    outline: none;
    box-shadow: var(--oecta-focus-ring);
}

#oecta-photo-studio .ops-chip-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#oecta-photo-studio .ops-slider-row {
    display: flex;
    flex-direction: column;
    gap: var(--oecta-space-3xs, 4px);
}

#oecta-photo-studio .ops-slider-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--oecta-on-surface);
}

#oecta-photo-studio .ops-range {
    width: 100%;
    min-height: 32px;
    font-size: 16px;
    accent-color: var(--oecta-primary-container);
    cursor: pointer;
}

#oecta-photo-studio .ops-range:focus-visible {
    outline: none;
    box-shadow: var(--oecta-focus-ring);
    border-radius: var(--oecta-radius-xs, 4px);
}

#oecta-photo-studio .ops-help {
    font-size: 0.76rem;
    line-height: 1.4;
    color: var(--oecta-text-muted);
    margin: 0;
}

/* ── Footer Bar (Fixed flex-shrink: 0) ───────────────────────────────────── */
#oecta-photo-studio .ops-foot {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--oecta-space-md, 16px);
    padding: var(--oecta-space-sm, 12px) var(--oecta-space-lg, 20px);
    background: var(--oecta-surface-low);
    flex-wrap: wrap;
}

#oecta-photo-studio .ops-foot-left,
#oecta-photo-studio .ops-foot-right {
    display: flex;
    align-items: center;
    gap: var(--oecta-space-sm, 10px);
}

#oecta-photo-studio .ops-btn {
    min-height: 44px;
    padding: 0 var(--oecta-space-md, 16px);
    border: none;
    border-radius: var(--oecta-radius-md, 8px);
    font-family: var(--oecta-font-body, Inter, sans-serif);
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--oecta-space-2xs, 6px);
    transition: filter var(--oecta-duration-fast, 150ms) var(--oecta-ease, ease),
                background var(--oecta-duration-fast, 150ms) var(--oecta-ease, ease);
}

#oecta-photo-studio .ops-btn--ghost {
    background: var(--oecta-surface-lowest);
    color: var(--oecta-on-surface);
    box-shadow: var(--oecta-shadow-xs);
}

#oecta-photo-studio .ops-btn--ghost:hover {
    background: var(--oecta-surface-container);
}

#oecta-photo-studio .ops-btn--accent {
    background: var(--oecta-accent-container);
    color: var(--oecta-on-surface);
    box-shadow: var(--oecta-shadow-accent);
}

#oecta-photo-studio .ops-btn--accent:hover {
    filter: brightness(1.04);
}

#oecta-photo-studio .ops-btn:focus-visible {
    outline: none;
    box-shadow: var(--oecta-focus-ring);
}

#oecta-photo-studio .ops-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ── Dark Mode Overrides ─────────────────────────────────────────────────── */
body.dark-mode #oecta-photo-studio .ops-dialog {
    background: var(--surface-card);
    color: var(--ink);
}

body.dark-mode #oecta-photo-studio .ops-head {
    background: var(--oecta-primary);
}

body.dark-mode #oecta-photo-studio .ops-rail-col {
    background: var(--surface-card);
}

body.dark-mode #oecta-photo-studio .ops-group,
body.dark-mode #oecta-photo-studio .ops-tabs,
body.dark-mode #oecta-photo-studio .ops-foot,
body.dark-mode #oecta-photo-studio .ops-stage-bar {
    background: var(--surface-sunk);
}

body.dark-mode #oecta-photo-studio .ops-chip-btn,
body.dark-mode #oecta-photo-studio .ops-btn--ghost,
body.dark-mode #oecta-photo-studio .ops-tab.is-active {
    background: var(--surface);
    color: var(--ink);
}

body.dark-mode #oecta-photo-studio .ops-chip-btn.is-active {
    background: var(--oecta-primary-container);
    color: var(--oecta-on-primary);
}

/* ── Responsive Mobile (<= 768px) ────────────────────────────────────────── */
@media (max-width: 768px) {
    .ops-modal-backdrop#oecta-photo-studio {
        padding: 0;
    }

    #oecta-photo-studio .ops-dialog {
        height: 100dvh;
        max-width: 100%;
        border-radius: 0;
    }

    #oecta-photo-studio .ops-body {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(220px, 44dvh) 1fr;
    }

    #oecta-photo-studio .ops-stage-wrap {
        padding: var(--oecta-space-sm, 10px);
    }

    #oecta-photo-studio .ops-foot {
        padding: var(--oecta-space-xs, 10px) var(--oecta-space-sm, 12px);
    }
}

@media (prefers-reduced-motion: reduce) {
    #oecta-photo-studio *,
    #oecta-photo-studio *::before,
    #oecta-photo-studio *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
