/* ==========================================================================
   FiveMRides Plate Studio ([fivem_plate_studio]) - scoped to .fpl
   Shared Studio components (top bar, buttons, cards, fields, viewport frame,
   toasts) come from fmr-studio-ui.css (.fsu-*), loaded first; page backdrop =
   the theme's refined-tools.css (body.fmr-tool-surface). This sheet keeps the
   Plate Studio layout only: plates on the left, the plate canvas in the
   middle, design cards ending with the export on the right.
   ========================================================================== */

.fpl {
    position: fixed; inset: 0; z-index: 2147483000; height: 100vh; height: 100dvh;
    color: var(--fsu-text);
    font: 500 13px/1.45 var(--fsu-font);
    background:
        radial-gradient(1200px 600px at 50% -10%, rgba(168, 85, 247, .10), transparent 60%),
        radial-gradient(900px 500px at 100% 120%, rgba(0, 240, 255, .06), transparent 60%),
        var(--fsu-bg);
    isolation: isolate;
    -webkit-font-smoothing: antialiased;
    text-align: left;
}
.fpl *, .fpl *::before, .fpl *::after { box-sizing: border-box; }
.fpl [hidden] { display: none !important; }
:where(.fpl) button, :where(.fpl) input, :where(.fpl) select, :where(.fpl) textarea { font: inherit; color: inherit; }
.fpl button { text-transform: none; letter-spacing: normal; text-shadow: none; min-height: 0; min-width: 0; margin: 0; line-height: 1.2; }
.fpl button:focus { outline: none; }
.fpl button:focus-visible, .fpl [role=button]:focus-visible, .fpl input:focus-visible { outline: 2px solid rgba(0, 240, 255, .7); outline-offset: 2px; }
.fpl a { color: var(--fsu-cyan); }
.fpl a.fsu-btn { color: var(--fsu-text); }
.fpl a.fsu-btn-primary, .fpl a.fsu-btn-accent { color: #fff; }
.fpl h1, .fpl h2, .fpl h3 { margin: 0; color: var(--fsu-text); letter-spacing: 0; text-transform: none; }
.fpl p { margin: 0; }
.fpl code { font: 600 11px/1.4 var(--fsu-mono); color: #bff6ff; background: rgba(0, 240, 255, .06); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
.fpl input[type=text], .fpl select, .fpl textarea {
    width: 100%; height: 32px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--fsu-line2);
    background: var(--fsu-bg2); color: var(--fsu-text); outline: none; box-shadow: none; margin: 0;
}
.fpl textarea { height: auto; padding: 8px 9px; resize: vertical; line-height: 1.4; }
.fpl input[type=text]:focus, .fpl select:focus, .fpl textarea:focus { border-color: rgba(0, 240, 255, .55); }
.fpl input[type=color] { width: 100%; height: 32px; padding: 2px; border-radius: 8px; border: 1px solid var(--fsu-line2); background: var(--fsu-bg2); cursor: pointer; }
.fpl input[type=range] { width: 100%; accent-color: var(--fsu-pink); margin: 6px 0 0; }

.fpl-app { height: 100%; display: flex; flex-direction: column; }
.fpl .fpl-name {
    width: min(240px, 22vw); height: 26px; margin-left: 8px; padding: 0 6px; border: 1px solid transparent; background: transparent;
    font: 700 14px/1 var(--fsu-display); border-left: 1px solid var(--fsu-line); border-radius: 0 6px 6px 0;
}
.fpl .fpl-name:hover { border-color: var(--fsu-line2); }
.fpl-credits { text-decoration: none; }

.fpl-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 290px minmax(0, 1fr) 330px; gap: 10px; padding: 10px; }
.fpl-left, .fpl-right { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.fpl-stage { min-height: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px; }

/* plates list */
.fpl-slots { display: flex; flex-direction: column; gap: 6px; }
.fpl-slot { display: grid; grid-template-columns: auto 72px minmax(0, 1fr); align-items: center; gap: 9px; cursor: pointer; }
.fpl-thumb { width: 72px; height: 36px; border-radius: 5px; border: 1px solid var(--fsu-line2); background: #000; display: block; }
.fpl-slot-txt { display: flex; flex-direction: column; min-width: 0; }
.fpl-slot-txt .fsu-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fpl-slot-on { flex: none; }

/* canvas */
.fpl-canvas-wrap { width: min(100%, 860px); aspect-ratio: 2 / 1; border-radius: 14px; padding: 10px; background: rgba(255, 255, 255, .03); border: 1px solid var(--fsu-line); box-shadow: var(--fsu-shadow); }
.fpl-canvas { width: 100%; height: 100%; display: block; border-radius: 9px; touch-action: none; cursor: grab; background: #000; }
.fpl-canvas:active { cursor: grabbing; }
.fpl-vbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: center; }
.fpl .fpl-sample { width: 130px; height: 30px; text-transform: uppercase; font-family: var(--fsu-mono); }
.fpl-inkwrap { display: inline-flex; align-items: center; gap: 6px; color: var(--fsu-muted); font-size: 12px; }
.fpl .fpl-inkwrap input[type=color] { width: 38px; height: 26px; }
.fpl-hint { max-width: 760px; text-align: center; color: var(--fsu-muted); font-size: 12px; }
.fpl-previews { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; align-items: flex-end; }
.fpl-previews figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.fpl-previews figcaption { font-size: 11px; color: var(--fsu-dim); }
.fpl-car { width: 360px; height: 180px; border-radius: 10px; border: 1px solid var(--fsu-line); background: #070910; }
.fpl-small { width: 256px; height: 128px; border-radius: 6px; border: 1px solid var(--fsu-line); image-rendering: auto; }

/* right cards */
.fpl-field { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; font-size: 11.5px; color: var(--fsu-muted); }
.fpl-field > span { font-weight: 600; }
.fpl-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fpl .fsu-check { margin-top: 8px; }
.fpl .fsu-seg { margin-top: 4px; }
.fpl-upload { margin-top: 8px; cursor: pointer; }
.fpl-stickers { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-top: 10px; }
.fpl-stickers canvas { width: 22px; height: 22px; display: block; }
.fpl-sel { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--fsu-line2); display: flex; flex-direction: column; gap: 6px; }
.fpl-chips { margin: 4px 0 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.fpl-ai .fsu-btn, .fpl-export .fsu-btn-primary { margin-top: 10px; }
.fpl .fsu-note { margin-top: 6px; }
.fpl-warn { color: var(--fsu-warn) !important; }
.fpl-ok { color: var(--fsu-good) !important; }
.fpl-result { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.fpl-dl { margin-top: 4px; }
.fpl .fpl-res { font-family: var(--fsu-mono); }

/* guest + admin notes (outside the app) */
.fpl-guest { max-width: 640px; margin: 24px auto; padding: 28px; border: 1px solid rgba(255, 47, 158, .45); border-radius: 16px; text-align: center; background: #0a0a1a; color: var(--fsu-text); position: relative; z-index: 1; }
.fpl-guest h1 { color: #fff; margin-top: 0; }
.fpl-guest p { margin: 10px 0; }
.fpl-admin-flag { margin: 0 0 12px; padding: 6px 12px; border: 1px dashed #ff2f9e; border-radius: 8px; font-size: 13px; }
html:has(.fpl) { overflow: hidden; }

@media (max-width: 1180px) {
    .fpl-body { grid-template-columns: 240px minmax(0, 1fr); }
    .fpl-right { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
    .fpl { position: static; height: auto; }
    html:has(.fpl) { overflow: auto; }
    .fpl-body { grid-template-columns: 1fr; }
    .fpl-left, .fpl-right, .fpl-stage { overflow: visible; }
    .fpl .fpl-name { display: none; }
    .fpl-car { width: 100%; height: auto; }
}

/* Community: top bar button, gallery modal, share box */
.fpl-gallery span { margin-left: 2px; }
.fpl-modal { position: fixed; inset: 0; z-index: 2147483100; display: grid; place-items: center; padding: 16px; background: rgba(3, 4, 8, .66); backdrop-filter: blur(6px); }
.fpl-modal[hidden] { display: none !important; }
.fpl-modal-card { width: min(1180px, 100%); height: min(860px, calc(100vh - 32px)); display: flex; flex-direction: column; border-radius: 18px; border: 1px solid var(--fsu-line2); background: linear-gradient(180deg, #141a27, #0d1119); box-shadow: 0 30px 90px rgba(0, 0, 0, .6); }
.fpl-modal-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--fsu-line); }
.fpl-modal-head h2 { display: flex; align-items: center; gap: 8px; margin-right: auto; font: 700 20px/1.1 Rajdhani, Inter, sans-serif; }
.fpl-modal-head h2 .fsu-i { width: 20px; height: 20px; color: var(--fsu-pink); }
.fpl-modal-flag { color: var(--fsu-warn); font-size: 11.5px; }
.fpl-modal-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px; }
.fpl-share { display: grid; gap: 6px; margin-top: 12px; padding: 12px 14px; border: 1px solid var(--fsu-line2); border-radius: 10px; background: rgba(255, 255, 255, .02); }
.fpl-share > b { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.fpl-share .fsu-i { width: 16px; height: 16px; color: var(--fsu-cyan); flex: none; vertical-align: -3px; }
.fpl-why { display: flex; gap: 7px; align-items: flex-start; }
.fpl-share .fpl-field { margin-top: 2px; }
.fpl-share .fsu-check { margin-top: 2px; }
@media (max-width: 760px) { .fpl-gallery span { display: none; } .fpl-modal-head { flex-wrap: wrap; } }
