/* ==========================================================================
   SANHI STUDIO — Bàn Thiết Kế Cúp & Kỷ Niệm Chương Trực Quan (Canva / CapCut UX)
   ========================================================================== */

:root {
    --st-navy-950: #07111f;
    --st-navy-900: #0c1d36;
    --st-navy-800: #132c50;
    --st-gold-600: #a87f14;
    --st-gold-500: #c59b27;
    --st-gold-400: #dfc163;
    --st-gold-100: #fbf5e2;
    --st-bg: #f1f5f9;
    --st-surface: #ffffff;
    --st-surface-alt: #f8fafc;
    --st-border: #e2e8f0;
    --st-border-strong: #cbd5e1;
    --st-text: #0f172a;
    --st-text-muted: #64748b;
    --st-accent: #1d4ed8;
    --st-danger: #dc2626;
    --st-success: #15803d;
    --st-radius-sm: 8px;
    --st-radius-md: 12px;
    --st-radius-lg: 16px;
    --st-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
    --st-shadow-md: 0 10px 28px rgba(15, 23, 42, 0.09);
    --st-shadow-lg: 0 22px 50px rgba(7, 17, 31, 0.18);
    --st-font-ui: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: var(--st-font-ui);
    color: var(--st-text);
    background: var(--st-bg);
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
}

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

/* ==========================================================================
   COMMON BUTTONS & BADGES
   ========================================================================== */

.st-eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--st-gold-600);
    background: var(--st-gold-100);
    border: 1px solid rgba(197, 155, 39, 0.35);
    padding: 4px 10px;
    border-radius: 999px;
}

.st-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    padding: 0 15px;
    border-radius: var(--st-radius-sm);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.1s ease;
    white-space: nowrap;
}

.st-btn:active {
    transform: translateY(1px);
}

.st-btn-sm {
    height: 33px;
    padding: 0 12px;
    font-size: 12px;
}

.st-btn-full {
    width: 100%;
    height: 44px;
    font-size: 14px;
}

.st-btn-primary {
    background: var(--st-navy-900);
    color: #ffffff;
}

.st-btn-primary:hover {
    background: var(--st-navy-800);
}

.st-btn-submit {
    background: linear-gradient(135deg, #c59b27 0%, #a37910 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(168, 127, 20, 0.28);
}

.st-btn-submit:hover {
    background: linear-gradient(135deg, #d1a730 0%, #8f690c 100%);
}

.st-btn-outline {
    background: #ffffff;
    border-color: var(--st-border-strong);
    color: var(--st-text);
}

.st-btn-outline:hover {
    border-color: var(--st-navy-800);
    color: var(--st-navy-900);
    background: var(--st-surface-alt);
}

.st-btn-ghost {
    background: transparent;
    color: var(--st-text);
    border-color: transparent;
}

.st-btn-ghost:hover {
    background: var(--st-bg);
}

/* ==========================================================================
   MÀN HÌNH 1: CHỌN PHÔI SẢN PHẨM (.is-studio-catalog)
   ========================================================================== */

body.is-studio-catalog {
    min-height: 100vh;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%);
}

.st-catalog-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--st-border);
}

.st-catalog-header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.st-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--st-navy-900);
}

.st-brand img {
    height: 38px;
    width: auto;
    object-fit: contain;
}

.st-brand strong {
    display: block;
    font-size: 15px;
    letter-spacing: 0.06em;
}

.st-brand small {
    display: block;
    font-size: 12px;
    color: var(--st-text-muted);
}

.st-catalog-header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.st-link-back {
    font-size: 13px;
    font-weight: 600;
    color: var(--st-text-muted);
    text-decoration: none;
}

.st-link-back:hover {
    color: var(--st-navy-900);
}

.st-catalog-main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 24px 64px;
}

.st-catalog-hero {
    background: radial-gradient(circle at top right, rgba(197, 155, 39, 0.14), transparent 45%), #ffffff;
    border: 1px solid var(--st-border);
    border-radius: 20px;
    padding: 28px 30px;
    box-shadow: var(--st-shadow-sm);
    margin-bottom: 26px;
}

.st-catalog-hero-copy h1 {
    margin: 12px 0 8px;
    font-size: clamp(22px, 3vw, 30px);
    color: var(--st-navy-900);
    letter-spacing: -0.01em;
}

.st-catalog-hero-copy p {
    margin: 0;
    max-width: 760px;
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--st-text-muted);
}

.st-catalog-search {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    max-width: 680px;
}

.st-catalog-search input {
    flex: 1;
    height: 44px;
    padding: 0 16px;
    border: 1px solid var(--st-border-strong);
    border-radius: var(--st-radius-sm);
    font-size: 14px;
    background: #ffffff;
}

.st-catalog-search input:focus {
    outline: none;
    border-color: var(--st-gold-500);
    box-shadow: 0 0 0 3px rgba(197, 155, 39, 0.16);
}

.st-catalog-search .st-btn {
    height: 44px;
    padding: 0 22px;
}

.st-category-pills {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.st-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 13px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    color: var(--st-text-muted);
    background: var(--st-surface-alt);
    border: 1px solid var(--st-border);
    transition: all 0.15s ease;
}

.st-pill small {
    opacity: 0.75;
    font-size: 11px;
}

.st-pill:hover {
    border-color: var(--st-gold-500);
    color: var(--st-navy-900);
}

.st-pill.is-active {
    background: var(--st-navy-900);
    border-color: var(--st-navy-900);
    color: #ffffff;
}

.st-product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.st-product-card {
    background: #ffffff;
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.st-product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--st-shadow-md);
    border-color: rgba(197, 155, 39, 0.55);
}

.st-product-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-decoration: none;
}

.st-product-thumb img {
    width: 88%;
    height: 88%;
    object-fit: contain;
    transition: transform 0.25s ease;
}

.st-product-card:hover .st-product-thumb img {
    transform: scale(1.04);
}

.st-hover-cta {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: rgba(12, 29, 54, 0.92);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    opacity: 0;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.st-product-card:hover .st-hover-cta {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.st-product-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.st-product-meta-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.st-sku {
    font-size: 11px;
    font-weight: 700;
    color: var(--st-gold-600);
    letter-spacing: 0.05em;
}

.st-size {
    font-size: 11px;
    color: var(--st-text-muted);
    background: var(--st-surface-alt);
    padding: 2px 7px;
    border-radius: 4px;
}

.st-product-body h2 {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 600;
    flex: 1;
}

.st-product-body h2 a {
    color: var(--st-text);
    text-decoration: none;
}

.st-product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--st-border);
}

.st-product-footer strong {
    font-size: 14px;
    color: var(--st-navy-900);
}

.st-card-btn {
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    background: var(--st-gold-100);
    color: var(--st-navy-900);
    border: 1px solid rgba(197, 155, 39, 0.4);
    transition: all 0.15s ease;
}

.st-card-btn:hover {
    background: var(--st-gold-500);
    color: #ffffff;
}

.st-empty-box {
    background: #ffffff;
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-lg);
    padding: 48px 24px;
    text-align: center;
}

.st-empty-box h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.st-empty-box p {
    margin: 0 0 20px;
    color: var(--st-text-muted);
    font-size: 14px;
}

.st-empty-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* ==========================================================================
   MÀN HÌNH 2: BÀN THIẾT KẾ TRỰC QUAN (.is-studio-editor)
   ========================================================================== */

body.is-studio-editor {
    height: 100dvh;
    overflow: hidden;
    user-select: none;
}

.st-app {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    width: 100%;
    overflow: hidden;
}

/* --- TOPBAR --- */
.st-topbar {
    height: 58px;
    flex-shrink: 0;
    background: #ffffff;
    border-bottom: 1px solid var(--st-border);
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: 30;
}

.st-topbar-left,
.st-topbar-center,
.st-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.st-topbar-left {
    min-width: 0;
    flex: 1;
}

.st-brand-compact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: var(--st-radius-sm);
    color: var(--st-text);
    text-decoration: none;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.st-brand-compact:hover {
    background: var(--st-bg);
}

.st-brand-compact img {
    height: 28px;
    width: auto;
}

.st-active-product {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 10px;
    border-left: 1px solid var(--st-border);
    min-width: 0;
}

.st-active-product-info {
    min-width: 0;
}

.st-active-product-info strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--st-navy-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

.st-active-product-info span {
    display: block;
    font-size: 11px;
    color: var(--st-text-muted);
}

.st-switch-product-btn {
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--st-border-strong);
    background: var(--st-surface-alt);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--st-navy-900);
    flex-shrink: 0;
}

.st-switch-product-btn:hover {
    border-color: var(--st-gold-500);
    background: var(--st-gold-100);
}

.st-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--st-radius-sm);
    border: 1px solid var(--st-border);
    background: #ffffff;
    color: var(--st-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.st-icon-btn:hover:not(:disabled) {
    background: var(--st-surface-alt);
    border-color: var(--st-border-strong);
}

.st-icon-btn:disabled {
    opacity: 0.38;
    cursor: default;
}

.st-save-indicator {
    font-size: 12px;
    color: var(--st-text-muted);
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--st-surface-alt);
    white-space: nowrap;
}

.st-save-indicator.is-saving {
    color: var(--st-gold-600);
    background: var(--st-gold-100);
}

.st-save-indicator.is-saved {
    color: var(--st-success);
    background: #dcfce7;
}

/* --- WORKSPACE LAYOUT --- */
.st-workspace {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

/* --- LEFT DOCK (ICON RAIL + PANEL DRAWER) --- */
.st-dock {
    width: 420px;
    flex-shrink: 0;
    display: flex;
    background: #ffffff;
    border-right: 1px solid var(--st-border);
    z-index: 20;
    min-height: 0;
}

.st-rail {
    width: 78px;
    flex-shrink: 0;
    background: var(--st-navy-950);
    display: flex;
    flex-direction: column;
    padding: 10px 6px;
    gap: 6px;
}

.st-rail-btn {
    border: none;
    background: transparent;
    color: #94a3b8;
    border-radius: 10px;
    padding: 10px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.15s ease;
}

.st-rail-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.07);
}

.st-rail-btn.is-active {
    color: #ffffff;
    background: linear-gradient(180deg, rgba(197, 155, 39, 0.28), rgba(197, 155, 39, 0.14));
    box-shadow: inset 0 0 0 1px rgba(223, 193, 99, 0.45);
}

.st-rail-btn.is-active svg {
    color: var(--st-gold-400);
}

.st-drawer {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 18px 16px 28px;
    user-select: text;
}

.st-panel {
    display: none;
}

.st-panel.is-active {
    display: block;
}

.st-panel-head {
    margin-bottom: 14px;
}

.st-panel-head h2 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    color: var(--st-navy-900);
}

.st-panel-head p {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--st-text-muted);
}

.st-subhead {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--st-text-muted);
    margin: 16px 0 8px;
}

/* --- PANEL 1: PRESET TEMPLATES --- */
.st-theme-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.st-chip {
    border: 1px solid var(--st-border);
    background: var(--st-surface-alt);
    color: var(--st-text-muted);
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.15s ease;
}

.st-chip:hover {
    border-color: var(--st-gold-500);
    color: var(--st-navy-900);
}

.st-chip.is-active {
    background: var(--st-navy-900);
    border-color: var(--st-navy-900);
    color: #ffffff;
}

.st-preset-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.st-preset-card {
    width: 100%;
    text-align: left;
    border: 1px solid var(--st-border);
    background: #ffffff;
    border-radius: var(--st-radius-md);
    padding: 11px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.16s ease;
}

.st-preset-card:hover {
    border-color: var(--st-gold-500);
    box-shadow: var(--st-shadow-sm);
}

.st-preset-card.is-active {
    border-color: var(--st-gold-500);
    background: var(--st-gold-100);
    box-shadow: 0 0 0 1px var(--st-gold-500);
}

.st-preset-swatch {
    width: 48px;
    height: 58px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px;
    border: 1px solid rgba(15, 23, 42, 0.12);
}

.st-preset-swatch span {
    display: block;
    height: 3px;
    border-radius: 99px;
}

.st-preset-meta {
    min-width: 0;
    flex: 1;
}

.st-preset-meta strong {
    display: block;
    font-size: 13px;
    color: var(--st-navy-900);
    margin-bottom: 3px;
}

.st-preset-meta small {
    display: block;
    font-size: 11.5px;
    line-height: 1.4;
    color: var(--st-text-muted);
}

/* --- PANEL 2: QUICK TEXT INPUTS --- */
.st-add-text-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 6px;
    margin-bottom: 14px;
}

.st-add-btn[hidden] {
    display: none !important;
}

.st-add-btn {
    height: 36px;
    border-radius: var(--st-radius-sm);
    border: 1px dashed var(--st-border-strong);
    background: var(--st-surface-alt);
    color: var(--st-navy-900);
    font-size: 12px;
    font-weight: 600;
}

.st-add-btn:hover {
    border-color: var(--st-gold-500);
    background: var(--st-gold-100);
}

.st-text-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.st-field-card {
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-sm);
    padding: 9px 10px;
    background: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.st-field-card.is-selected {
    border-color: var(--st-gold-500);
    box-shadow: 0 0 0 2px rgba(197, 155, 39, 0.16);
}

.st-field-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
}

.st-field-top label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--st-navy-900);
}

.st-field-del {
    border: none;
    background: transparent;
    color: var(--st-text-muted);
    font-size: 11px;
    padding: 2px 5px;
    border-radius: 4px;
}

.st-field-del:hover {
    color: var(--st-danger);
    background: #fee2e2;
}

.st-field-card textarea,
.st-field-card input[type="text"] {
    width: 100%;
    border: 1px solid var(--st-border);
    border-radius: 6px;
    padding: 7px 9px;
    font-size: 13px;
    color: var(--st-text);
    background: var(--st-surface-alt);
    resize: vertical;
}

.st-field-card textarea:focus,
.st-field-card input[type="text"]:focus {
    outline: none;
    background: #ffffff;
    border-color: var(--st-gold-500);
}

/* --- PANEL 3: UPLOAD LOGO & PHOTO --- */
.st-upload-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    padding: 20px 14px;
    border: 1.5px dashed var(--st-border-strong);
    border-radius: var(--st-radius-md);
    background: var(--st-surface-alt);
    cursor: pointer;
    transition: all 0.16s ease;
}

.st-upload-dropzone:hover,
.st-upload-dropzone.is-dragover {
    border-color: var(--st-gold-500);
    background: var(--st-gold-100);
}

.st-upload-dropzone svg {
    color: var(--st-gold-600);
}

.st-upload-dropzone strong {
    font-size: 13px;
    color: var(--st-navy-900);
}

.st-upload-dropzone span {
    font-size: 11.5px;
    color: var(--st-text-muted);
}

.st-media-inspector {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-md);
    background: var(--st-surface-alt);
}

.st-media-inspector .st-subhead:first-child {
    margin-top: 0;
}

.st-frame-grid,
.st-shape-grid,
.st-plate-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.st-frame-grid button,
.st-shape-grid button,
.st-plate-grid button {
    padding: 7px 8px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 7px;
    border: 1px solid var(--st-border);
    background: #ffffff;
    color: var(--st-text);
    text-align: center;
}

.st-frame-grid button.is-active,
.st-shape-grid button.is-active,
.st-plate-grid button.is-active {
    background: var(--st-navy-900);
    border-color: var(--st-navy-900);
    color: #ffffff;
}

.st-slider-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--st-text);
}

.st-slider-row input[type="range"] {
    width: 100%;
    accent-color: var(--st-gold-500);
}

.st-media-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.st-image-layers {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.st-img-layer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-sm);
    background: #ffffff;
    cursor: pointer;
}

.st-img-layer-item.is-selected {
    border-color: var(--st-gold-500);
    background: var(--st-gold-100);
}

.st-img-layer-thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    color: var(--st-text-muted);
}

.st-img-layer-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.st-img-layer-info {
    flex: 1;
    min-width: 0;
}

.st-img-layer-info strong {
    display: block;
    font-size: 12.5px;
    color: var(--st-navy-900);
}

.st-img-layer-info small {
    font-size: 11px;
    color: var(--st-text-muted);
}

/* --- PANEL 4: STICKERS --- */
.st-sticker-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.st-sticker-btn {
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-md);
    background: #ffffff;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--st-gold-600);
    transition: all 0.15s ease;
}

.st-sticker-btn:hover {
    border-color: var(--st-gold-500);
    background: var(--st-gold-100);
    transform: translateY(-1px);
}

.st-sticker-btn svg {
    width: 68px;
    height: 44px;
}

.st-sticker-btn span {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--st-text);
    text-align: center;
}

/* --- PANEL 5: PALETTES & BACKDROP --- */
.st-palette-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.st-palette-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-radius: var(--st-radius-sm);
    border: 1px solid var(--st-border);
    background: #ffffff;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--st-text);
}

.st-palette-btn:hover {
    border-color: var(--st-gold-500);
}

.st-palette-dots {
    display: inline-flex;
    gap: 5px;
}

.st-palette-dots i {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.18);
}

.st-segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 3px;
    background: var(--st-bg);
    border-radius: var(--st-radius-sm);
    border: 1px solid var(--st-border);
}

.st-segmented button {
    border: none;
    background: transparent;
    padding: 7px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--st-text-muted);
}

.st-segmented button.is-active {
    background: #ffffff;
    color: var(--st-navy-900);
    box-shadow: var(--st-shadow-sm);
}

.st-reset-box {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--st-border);
}

.st-reset-box .st-btn {
    width: 100%;
}

/* ==========================================================================
   CENTER CANVAS SHELL & FLOATING CONTEXT BAR
   ========================================================================== */

.st-canvas-shell {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    background: radial-gradient(circle at 50% 42%, #ffffff 0%, #e9eff6 72%, #dde6f0 100%);
}

.st-floating-bar {
    position: absolute;
    top: 48px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    max-width: calc(100% - 24px);
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid var(--st-border-strong);
    border-radius: 12px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--st-shadow-md);
}

.st-fb-group {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding-right: 10px;
    border-right: 1px solid var(--st-border);
    flex-shrink: 0;
}

.st-fb-group:last-child {
    padding-right: 0;
    border-right: none;
}

#stFbFont {
    height: 30px;
    max-width: 158px;
    border: 1px solid var(--st-border);
    border-radius: 6px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--st-text);
    background: #ffffff;
}

.st-fb-btn {
    height: 30px;
    padding: 0 9px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: var(--st-surface-alt);
    color: var(--st-text);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.st-fb-btn:hover {
    border-color: var(--st-border-strong);
    background: #ffffff;
}

.st-fb-btn.is-active {
    background: var(--st-navy-900);
    color: #ffffff;
}

.st-fb-btn.is-danger {
    color: var(--st-danger);
    background: #fef2f2;
}

.st-fb-btn.is-danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.st-fb-edit-btn {
    background: var(--st-gold-100);
    color: var(--st-navy-900);
    border-color: rgba(197, 155, 39, 0.4);
}

.st-fb-size {
    min-width: 24px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--st-navy-900);
}

.st-color-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.st-color-dot {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 1.5px solid rgba(15, 23, 42, 0.22);
    padding: 0;
}

.st-color-dot.is-active {
    transform: scale(1.16);
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--st-navy-900);
}

#stFbCustomColor {
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

/* --- STAGE VIEWPORT & INTERACTIVE SELECTION OVERLAY --- */
.st-stage-viewport {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 52px 20px 14px;
    overflow: auto;
}

.st-stage-card {
    position: relative;
    width: min(100%, 490px);
    aspect-ratio: 500 / 560;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: var(--st-shadow-lg), 0 0 0 1px rgba(15, 23, 42, 0.06);
    overflow: visible;
    transform-origin: center center;
    transition: transform 0.12s ease;
    touch-action: none;
}

#stSvgStage {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 18px;
    overflow: hidden;
    touch-action: none;
}

#stSvgStage [data-el-id] {
    cursor: grab;
}

#stSvgStage [data-el-id]:active {
    cursor: grabbing;
}

.st-selection-box {
    position: absolute;
    border: 1.8px solid #2563eb;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.75);
    pointer-events: none;
    z-index: 15;
    border-radius: 3px;
}

.st-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: #ffffff;
    border: 2.5px solid #2563eb;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.25);
    pointer-events: auto;
    padding: 0;
}

/* Mở rộng vùng chạm vô hình cho mobile dễ kéo */
.st-handle::after {
    content: '';
    position: absolute;
    inset: -10px;
}

.st-handle-nw {
    top: -7px;
    left: -7px;
    cursor: nwse-resize;
}

.st-handle-ne {
    top: -7px;
    right: -7px;
    cursor: nesw-resize;
}

.st-handle-sw {
    bottom: -7px;
    left: -7px;
    cursor: nesw-resize;
}

.st-handle-se {
    bottom: -7px;
    right: -7px;
    cursor: nwse-resize;
}

.st-rotate-handle {
    position: absolute;
    left: 50%;
    top: -32px;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #ffffff;
    border: 1.5px solid #2563eb;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
    pointer-events: auto;
    cursor: grab;
    padding: 0;
}

/* --- CANVAS FOOTER --- */
.st-canvas-footer {
    height: 40px;
    flex-shrink: 0;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(255, 255, 255, 0.78);
    border-top: 1px solid rgba(203, 213, 225, 0.7);
}

.st-canvas-hint {
    font-size: 12px;
    color: var(--st-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.st-zoom-bar {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.st-zoom-bar button {
    height: 26px;
    min-width: 26px;
    padding: 0 8px;
    border: 1px solid var(--st-border);
    border-radius: 6px;
    background: #ffffff;
    font-size: 12px;
    font-weight: 600;
    color: var(--st-text);
}

.st-zoom-bar output {
    min-width: 44px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--st-navy-900);
}

/* ==========================================================================
   INLINE TEXT EDITOR & MODALS
   ========================================================================== */

.st-inline-editor-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(7, 17, 31, 0.48);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.st-inline-editor-card {
    width: min(100%, 420px);
    background: #ffffff;
    border-radius: var(--st-radius-lg);
    padding: 18px;
    box-shadow: var(--st-shadow-lg);
}

.st-inline-editor-card label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--st-navy-900);
    margin-bottom: 8px;
}

.st-inline-editor-card textarea {
    width: 100%;
    border: 1.5px solid var(--st-border-strong);
    border-radius: var(--st-radius-sm);
    padding: 10px 12px;
    font-size: 15px;
    line-height: 1.45;
    resize: vertical;
}

.st-inline-editor-card textarea:focus {
    outline: none;
    border-color: var(--st-gold-500);
}

.st-inline-editor-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.st-modal {
    border: none;
    border-radius: 20px;
    padding: 0;
    width: min(94vw, 820px);
    max-height: 88dvh;
    background: #ffffff;
    color: var(--st-text);
    box-shadow: var(--st-shadow-lg);
}

.st-modal::backdrop {
    background: rgba(7, 17, 31, 0.58);
    backdrop-filter: blur(4px);
}

.st-modal-head {
    padding: 18px 22px;
    border-bottom: 1px solid var(--st-border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.st-modal-head h2 {
    margin: 6px 0 0;
    font-size: 18px;
    color: var(--st-navy-900);
}

.st-modal-close {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid var(--st-border);
    background: var(--st-surface-alt);
    font-size: 20px;
    line-height: 1;
    color: var(--st-text-muted);
}

.st-modal-search {
    padding: 14px 22px 0;
}

.st-modal-search input {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--st-border-strong);
    border-radius: var(--st-radius-sm);
    font-size: 13.5px;
}

.st-modal-product-grid {
    padding: 16px 22px 22px;
    max-height: 60dvh;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.st-modal-prod-item {
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-md);
    background: #ffffff;
    padding: 10px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.15s ease;
}

.st-modal-prod-item:hover,
.st-modal-prod-item.is-active {
    border-color: var(--st-gold-500);
    background: var(--st-gold-100);
}

.st-modal-prod-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: #f8fafc;
    border-radius: 8px;
}

.st-modal-prod-item small {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--st-gold-600);
}

.st-modal-prod-item strong {
    font-size: 12.5px;
    line-height: 1.35;
    color: var(--st-navy-900);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- SUBMIT MODAL --- */
.st-submit-body {
    padding: 20px 22px 24px;
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 22px;
    overflow-y: auto;
    max-height: calc(88dvh - 80px);
}

.st-submit-preview-col {
    background: var(--st-surface-alt);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
}

.st-submit-preview-col img {
    width: 100%;
    max-height: 250px;
    object-fit: contain;
    border-radius: 8px;
    background: #ffffff;
}

.st-submit-preview-col span {
    font-size: 12px;
    font-weight: 600;
    color: var(--st-navy-900);
}

.st-submit-intro {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--st-text-muted);
}

.st-submit-fields-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.st-form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.st-submit-fields-col label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--st-navy-900);
}

.st-submit-fields-col label b {
    color: var(--st-danger);
    display: inline;
}

.st-submit-fields-col input:not([type="checkbox"]),
.st-submit-fields-col select,
.st-submit-fields-col textarea {
    border: 1px solid var(--st-border-strong);
    border-radius: var(--st-radius-sm);
    padding: 9px 11px;
    font-size: 13.5px;
    font-weight: 400;
    background: #ffffff;
    color: var(--st-text);
}

.st-submit-fields-col input:not([type="checkbox"]):focus,
.st-submit-fields-col select:focus,
.st-submit-fields-col textarea:focus {
    outline: none;
    border-color: var(--st-gold-500);
    box-shadow: 0 0 0 3px rgba(197, 155, 39, 0.15);
}

.st-submit-success {
    padding: 30px 26px 32px;
    text-align: center;
}

.st-success-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    background: #dcfce7;
    color: var(--st-success);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.st-submit-success h3 {
    margin: 12px 0 8px;
    font-size: 20px;
    color: var(--st-navy-900);
}

.st-submit-success p {
    margin: 0 auto 18px;
    max-width: 520px;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--st-text-muted);
}

.st-share-link-box {
    max-width: 500px;
    margin: 0 auto 20px;
    display: flex;
    gap: 8px;
}

.st-share-link-box input {
    flex: 1;
    height: 36px;
    padding: 0 11px;
    border: 1px solid var(--st-border-strong);
    border-radius: var(--st-radius-sm);
    background: var(--st-surface-alt);
    font-size: 12px;
    color: var(--st-text-muted);
}

.st-success-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* --- TOAST --- */
.st-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 80;
    background: var(--st-navy-950);
    color: #ffffff;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--st-shadow-md);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.st-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   RESPONSIVE: TABLET & MOBILE CAPCUT BOTTOM-DOCK EXPERIENCE
   ========================================================================== */

@media (max-width: 1080px) {
    .st-product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .st-dock {
        width: 370px;
    }
}

@media (max-width: 900px) {
    .st-topbar {
        height: 52px;
        padding: 0 10px;
    }

    .st-topbar-center {
        display: none;
    }

    .st-active-product-info strong {
        max-width: 130px;
        font-size: 12px;
    }

    .st-active-product-info span {
        display: none;
    }

    .st-topbar-right .st-btn {
        height: 33px;
        padding: 0 10px;
        font-size: 12px;
    }

    .st-topbar-right [data-action="download-png"] span {
        display: none;
    }

    /* Chuyển sang bố cục CapCut trên điện thoại: Canvas trên — Khay công cụ dưới */
    .st-workspace {
        flex-direction: column;
    }

    .st-canvas-shell {
        order: 1;
        flex: 0 0 48dvh;
    }

    .st-stage-viewport {
        padding: 50px 12px 6px;
    }

    .st-stage-card {
        height: 100%;
        width: auto;
        max-width: 92vw;
    }

    .st-canvas-footer {
        height: 30px;
        padding: 0 10px;
    }

    .st-canvas-hint {
        font-size: 11px;
    }

    .st-zoom-bar {
        display: none;
    }

    .st-dock {
        order: 2;
        width: 100%;
        flex: 1;
        flex-direction: column-reverse;
        border-right: none;
        border-top: 1px solid var(--st-border);
    }

    .st-rail {
        width: 100%;
        height: 56px;
        flex-direction: row;
        justify-content: space-around;
        padding: 4px 6px;
    }

    .st-rail-btn {
        flex: 1;
        padding: 6px 2px;
        font-size: 10.5px;
        gap: 3px;
    }

    .st-drawer {
        padding: 12px 14px 18px;
    }

    .st-submit-body {
        grid-template-columns: 1fr;
    }

    .st-form-row-2 {
        grid-template-columns: 1fr;
    }

    .st-modal-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .st-catalog-header-inner {
        padding: 10px 14px;
    }

    .st-link-back {
        display: none;
    }

    .st-catalog-main {
        padding: 16px 14px 48px;
    }

    .st-catalog-hero {
        padding: 20px 16px;
    }

    .st-catalog-search {
        flex-direction: column;
    }

    .st-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
}

/* ==========================================================================
   MAKET 2D COREL LAYOUT, MULTI-ZONE PANEL & DIRECT PRODUCTION EXTENSIONS
   ========================================================================== */

.st-order-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--st-gold-100);
    border: 1px solid rgba(197, 155, 39, 0.45);
    color: var(--st-navy-900);
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}

.st-canvas-mode-bar {
    height: 40px;
    flex-shrink: 0;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    z-index: 18;
}

.st-mode-pills {
    display: inline-flex;
    align-items: center;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 8px;
    gap: 2px;
}

.st-mode-pills button {
    border: none;
    background: transparent;
    color: var(--st-text-muted);
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 11px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.st-mode-pills button.is-active {
    background: var(--st-navy-900);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
}

.st-phys-dim-tag {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--st-navy-900);
    background: #f1f5f9;
    border: 1px solid var(--st-border);
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.st-zone-divider {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 9px;
    margin-top: 4px;
    border-radius: 6px;
    background: var(--st-navy-900);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.st-zone-divider.is-base {
    background: #3f2b1d;
    border-left: 3px solid var(--st-gold-400);
}

.st-zone-divider small {
    font-weight: 500;
    color: #cbd5e1;
    text-transform: none;
    letter-spacing: 0;
}

.st-submit-scale-note {
    display: block;
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid var(--st-border);
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--st-text-muted);
    text-align: left;
}

.st-approve-check {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start;
    gap: 9px !important;
    padding: 9px 11px;
    border-radius: 8px;
    background: var(--st-gold-100);
    border: 1px solid rgba(197, 155, 39, 0.35);
    cursor: pointer;
}

.st-approve-check input[type="checkbox"] {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: var(--st-navy-900);
}

.st-approve-check span {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--st-navy-900);
}

@media (max-width: 900px) {
    .st-canvas-mode-bar {
        height: 36px;
        padding: 0 10px;
    }

    .st-phys-dim-tag {
        display: none;
    }

    .st-floating-bar {
        top: 42px;
    }

    .st-stage-viewport {
        padding: 44px 12px 6px;
    }
}

