/* App Shots Studio — studio (step-by-step editor) */

:root {
    --ink: #0F172A;
    --ink-2: #334155;
    --muted: #475569;
    --faint: #94A3B8;
    --line: #E2E8F0;
    --line-strong: #CBD5E1;
    --ground: #FFFFFF;
    --ground-2: #F6F7F9;
    --accent: #2563EB;
    --accent-ink: #1D4ED8;
    --accent-soft: #EFF6FF;
    --accent-soft-2: #DBEAFE;
    --ok: #15803D;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Space Grotesk', 'Inter', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font-body); color: var(--ink); background: var(--ground-2); -webkit-font-smoothing: antialiased; }
button { font-family: inherit; }
a { color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.studio {
    height: 100vh; height: 100dvh;
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr) 300px;
    grid-template-rows: 64px minmax(0, 1fr);
    grid-template-areas: "top top top" "panel stage tips";
}
.topbar { grid-area: top; }
.mobile-progress { display: none; }
.panel { grid-area: panel; }
.stage { grid-area: stage; }
.tips { grid-area: tips; }

/* ---------- Top bar ---------- */
.topbar {
    background: #fff; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 20px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; white-space: nowrap; font: 700 17px/1 var(--font-display); }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

.stepper { display: flex; align-items: center; gap: 4px; }
.step-btn {
    height: 40px; padding: 0 14px 0 8px; border: none; border-radius: 20px; background: transparent;
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    font-size: 14px; font-weight: 500; color: var(--muted);
}
.step-btn:hover { background: var(--ground-2); }
.step-dot {
    width: 24px; height: 24px; border-radius: 12px; background: var(--line); color: var(--muted);
    display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.step-btn.done .step-dot { background: var(--accent-soft-2); color: var(--accent-ink); }
.step-btn[aria-current="step"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.step-btn[aria-current="step"] .step-dot { background: var(--accent); color: #fff; }

.platform { display: flex; align-items: center; gap: 12px; }
.segmented { display: flex; background: #F1F5F9; border-radius: 10px; padding: 3px; }
.seg-btn {
    height: 34px; padding: 0 14px; border: none; border-radius: 8px; background: transparent;
    font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.seg-btn[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }
.size-label { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Panel ---------- */
.panel { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.panel-body { flex: 1; overflow-y: auto; padding: 28px 28px 24px; }
.panel-foot { padding: 16px 28px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; background: #fff; }

.step-title { font: 600 24px/1.2 var(--font-display); margin: 0 0 6px; }
.step-help { font-size: 15px; line-height: 1.5; color: var(--muted); margin: 0 0 20px; }
.small-help { font-size: 13px; line-height: 1.5; color: var(--muted); margin: 8px 0 20px; }
.small-help.tight { margin: 0 0 10px; }
.field-label { display: block; font-size: 14px; font-weight: 600; margin: 0 0 8px; }
.field-label.inline { margin: 0; }
.optional { font-weight: 400; color: var(--muted); }

.text-input {
    width: 100%; height: 46px; padding: 0 14px; font: 16px var(--font-body); color: var(--ink);
    border: 1px solid var(--line-strong); border-radius: 10px; background: #fff;
}
.text-input:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft-2); outline-offset: 0; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 0 24px; border-radius: 12px; cursor: pointer;
    font: 600 15px/1 var(--font-body); border: 1px solid transparent; text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-block { width: 100%; margin-bottom: 10px; }
.link-btn { border: none; background: none; padding: 6px 0; color: var(--accent-ink); font-size: 14px; font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* Step 1 */
.dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    min-height: 160px; padding: 20px; text-align: center; cursor: pointer;
    border: 2px dashed var(--faint); border-radius: 14px; background: #F8FAFC; color: var(--accent);
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.dz-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.dz-link { font-size: 14px; font-weight: 600; color: var(--accent-ink); }

.slide-list-head { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.slide-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.slide-row .icon-btn { width: 32px; height: 36px; }
.slide-row {
    display: flex; align-items: center; gap: 6px; padding: 8px 4px 8px 8px;
    border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.slide-row.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.slide-num { font-size: 13px; font-weight: 700; color: var(--muted); width: 18px; text-align: center; }
.slide-thumb { width: 24px; height: 44px; border-radius: 4px; object-fit: cover; background: var(--line); flex-shrink: 0; }
.slide-name { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slide-name.empty { color: var(--muted); font-style: italic; }
.icon-btn {
    width: 36px; height: 36px; border: none; border-radius: 8px; background: transparent; color: var(--muted);
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { background: var(--ground-2); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; background: transparent; }

/* Step 2 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.chip {
    min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid var(--line-strong);
    background: #fff; color: var(--ink); font-size: 15px; cursor: pointer;
}
.chip[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

/* Step 3 */
.theme-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 24px; }
.theme-btn { padding: 5px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; text-align: center; }
.theme-btn[aria-checked="true"] { border: 2px solid var(--accent); padding: 4px; }
.theme-swatch { display: block; height: 40px; border-radius: 8px; }
.theme-name { display: block; font-size: 12px; margin-top: 5px; color: var(--ink-2); }

.option-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 24px; }
.option-btn { height: 44px; border-radius: 10px; border: 1px solid var(--line-strong); background: #fff; font-size: 14px; color: var(--ink); cursor: pointer; }
.option-btn[aria-checked="true"] { border: 2px solid var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

.swatch-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.device-btn {
    width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line-strong); cursor: pointer; padding: 0;
}
.device-btn[aria-checked="true"] { outline: 3px solid var(--accent); outline-offset: 2px; }

.check-row { display: flex; align-items: center; gap: 10px; font-size: 14px; margin-bottom: 20px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.highlight-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.highlight-row input[type="color"] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; cursor: pointer; }

/* Step 4 */
.checklist { list-style: none; margin: 0 0 22px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 12px; }
.checklist li { display: flex; gap: 10px; font-size: 14px; line-height: 1.45; }
.checklist svg { flex-shrink: 0; margin-top: 1px; }
.checklist li.warn { color: #9A3412; }

/* ---------- Stage ---------- */
.stage { display: flex; flex-direction: column; align-items: center; min-width: 0; min-height: 0; padding: 24px 20px 16px; }
.preview-box { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
#preview {
    display: block; width: 200px; height: auto;
    border-radius: 14px; box-shadow: 0 16px 40px rgba(15, 23, 42, .18); background: #fff;
}
.filmstrip { display: flex; gap: 10px; align-items: center; margin-top: 18px; max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: 4px 4px 12px; scrollbar-width: thin; }
.film-btn {
    flex-shrink: 0; width: 52px; height: 112px; padding: 3px; border-radius: 10px;
    border: 1px solid var(--line-strong); background: #fff; cursor: pointer; position: relative;
}
.film-btn canvas { width: 100%; height: 100%; display: block; border-radius: 6px; }
.film-btn[aria-current="true"] { border: 3px solid var(--accent); padding: 1px; }
.film-num { position: absolute; left: 50%; bottom: -2px; transform: translate(-50%, 50%); background: #fff; border: 1px solid var(--line-strong); border-radius: 9px; font-size: 11px; font-weight: 700; padding: 0 5px; color: var(--muted); }
.film-add {
    flex-shrink: 0; width: 52px; height: 112px; border: 2px dashed var(--faint); border-radius: 10px;
    background: transparent; color: var(--muted); font-size: 22px; cursor: pointer;
}
.film-add:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Tips ---------- */
.tips { padding: 24px 20px 0 0; display: flex; flex-direction: column; gap: 20px; }
.tip-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.tip-card p { font-size: 14px; line-height: 1.55; margin: 0 0 10px; }
.tip-card a { font-size: 14px; font-weight: 600; text-decoration: none; }
.eyebrow { font-size: 12px !important; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px !important; }

/* ---------- Overlays ---------- */
.drop-overlay {
    position: fixed; inset: 0; background: rgba(37, 99, 235, .12); border: 4px dashed var(--accent);
    display: flex; align-items: center; justify-content: center; z-index: 50; pointer-events: none;
}
.drop-overlay span { background: #fff; padding: 14px 22px; border-radius: 12px; font-weight: 600; box-shadow: 0 8px 24px rgba(15, 23, 42, .15); }
.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
    background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px;
    opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Narrow desktop / tablet: drop the tips column ---------- */
@media (max-width: 1100px) {
    .studio { grid-template-columns: 360px minmax(0, 1fr); grid-template-areas: "top top" "panel stage"; }
    .tips { display: none; }
}
@media (max-width: 1000px) {
    .step-label { display: none; }
    .step-btn { padding: 0 8px; }
}

/* ---------- Phone and small tablet ---------- */
@media (max-width: 860px) {
    html, body { height: auto; }
    .studio {
        height: auto; min-height: 100dvh;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto auto auto;
        grid-template-areas: "top" "progress" "stage" "panel";
    }
    .topbar { height: 56px; padding: 0 16px; }
    .brand-name { font-size: 15px; }
    .stepper { display: none; }
    .size-label { display: none; }
    .mobile-progress {
        grid-area: progress; display: flex; flex-direction: column; gap: 8px;
        padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 600;
    }
    .progress-bar { display: block; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
    .progress-bar span { display: block; height: 100%; background: var(--accent); width: 25%; transition: width .2s; }
    .stage { padding: 16px 16px 12px; }
    .preview-box { height: 46vh; flex: none; }
    .film-btn, .film-add { width: 40px; height: 86px; }
    .panel { border-right: none; border-top: 1px solid var(--line); }
    .panel-body { overflow: visible; padding: 20px 16px 24px; }
    .panel-foot { position: sticky; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(15, 23, 42, .06); }
    .panel-foot .btn { flex: 1; }
    .panel-foot #next-btn { flex: 2; }
    .theme-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
