:root {
    --brand: #1b2a4a;
    --brand-2: #2c3f6b;
    --accent: #c9a227;
    --panel-bg: #ffffff;
    --workspace-bg: #e9ecf2;
    --border: #e3e6ec;
}

body { font-family: 'Poppins', system-ui, sans-serif; background: #f5f6fa; }

.bg-brand { background: var(--brand) !important; }
.btn-brand { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-brand:hover, .btn-brand:focus { background: var(--brand-2); color: #fff; border-color: var(--brand-2); }

/* ================= GALERI ================= */
.size-card {
    background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px 10px;
    text-align: center; transition: .15s; cursor: pointer;
}
.size-card:hover { border-color: var(--brand); box-shadow: 0 6px 18px rgba(27, 42, 74, .12); transform: translateY(-2px); }
.size-shape-wrap { height: 90px; display: flex; align-items: center; justify-content: center; }
.size-shape {
    max-height: 90px; max-width: 90px; height: 90px; border-radius: 8px;
    background: linear-gradient(135deg, var(--brand), #3b5998); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
}
.size-shape.dashed { background: #f1f3f7; color: #6c757d; border: 2px dashed #b9c0cc; }

.design-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; transition: .15s; }
.design-card:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, .08); }
.design-thumb {
    position: relative; display: flex; align-items: center; justify-content: center;
    background: repeating-conic-gradient(#f0f1f4 0% 25%, #fff 0% 50%) 50% / 16px 16px;
    width: 100%; max-height: 320px; overflow: hidden;
}
.design-thumb img { width: 100%; height: 100%; object-fit: cover; }
.empty-box { background: #fff; border: 2px dashed #d5dae3; border-radius: 12px; padding: 24px; color: #6c757d; text-align: center; }

/* ================= EDITOR ================= */
.editor-page { overflow: hidden; }
.editor { display: flex; flex-direction: column; height: 100vh; }
.editor-top {
    height: 56px; flex: 0 0 56px; background: var(--brand); color: #fff;
    display: flex; align-items: center; gap: .5rem; padding: 0 .75rem;
}
.name-input { max-width: 260px; background: rgba(255, 255, 255, .1); color: #fff; border-color: transparent; }
.name-input:focus { background: #fff; color: #000; }
.zoom-select { width: 120px; background-color: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .3); }
.zoom-select option { color: #000; }

.editor-body { flex: 1; display: flex; min-height: 0; }
.panel { background: var(--panel-bg); border-color: var(--border); flex: 0 0 auto; }
.panel-left { width: 290px; border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.panel-right { width: 300px; border-left: 1px solid var(--border); padding: 14px; }
.panel-scroll { overflow-y: auto; }
.panel-left .tab-content { flex: 1; padding: 14px; }

.panel-tabs { border-bottom: 1px solid var(--border); padding: 6px; gap: 4px; }
.panel-tabs .nav-link { color: #555; font-size: .78rem; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; border-radius: 8px; }
.panel-tabs .nav-link i { font-size: 1.15rem; }
.panel-tabs .nav-link.active { background: var(--brand); color: #fff; }

.panel-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #7a8394; margin-bottom: .6rem; }
.form-label.small { font-size: .78rem; color: #444; margin-bottom: .2rem; }
.form-label .val { color: var(--brand); font-weight: 600; }
.form-control-color { width: 40px; height: 32px; padding: 2px; flex: 0 0 40px; }

.preset-text {
    background: #3a4a6b; border: 0; border-radius: 10px; padding: 12px; color: #fff; text-align: center; transition: .15s;
    background-image: linear-gradient(135deg, #52698f, #2d3b58);
}
.preset-text:hover { filter: brightness(1.15); transform: translateY(-1px); }
.preset-label { background: #1b2a4a; color: #fff; padding: 4px 12px; border-radius: 8px; font-weight: 700; font-size: 13px; border: 1px solid #ffffff55; }

.shape-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.shape-grid button { background: #f4f6fa; border: 1px solid var(--border); border-radius: 10px; padding: 8px 2px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.shape-grid button:hover { border-color: var(--brand); background: #eef2fa; }
.shape-grid small { font-size: .62rem; color: #555; line-height: 1.1; }
.sh { width: 36px; height: 36px; border-radius: 4px; }
.sh-grad-top { background: linear-gradient(#000, transparent), #9bb3d6; }
.sh-grad-bottom { background: linear-gradient(transparent, #000), #9bb3d6; }
.sh-dim { background: rgba(0, 0, 0, .55); }
.sh-footer { background: #9bb3d6; position: relative; }
.sh-footer::after { content: ''; position: absolute; left: 3px; right: 3px; bottom: 3px; height: 8px; border-radius: 4px; background: var(--brand); }
.sh-rect { background: var(--brand); border-radius: 0; }
.sh-round { background: var(--brand); border-radius: 10px; }
.sh-circle { background: #ffd43b; border-radius: 50%; }
.sh-line { height: 5px; margin: 15px 0; background: #333; border-radius: 3px; }

.upload-drop {
    border: 2px dashed #b9c3d6; border-radius: 12px; padding: 16px; text-align: center; cursor: pointer; color: var(--brand);
    background: #f7f9fc; transition: .15s;
}
.upload-drop:hover { border-color: var(--brand); background: #eef2fa; }

.asset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.asset-item {
    position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; cursor: pointer; border: 1px solid var(--border);
    background: repeating-conic-gradient(#eceef2 0% 25%, #fff 0% 50%) 50% / 12px 12px;
}
.asset-item img { width: 100%; height: 100%; object-fit: contain; }
.asset-item .asset-actions { position: absolute; inset: auto 0 0 0; display: none; justify-content: space-between; padding: 3px; background: linear-gradient(transparent, rgba(0, 0, 0, .6)); }
.asset-item:hover .asset-actions { display: flex; }
.asset-item .asset-actions button { border: 0; border-radius: 5px; font-size: .7rem; padding: 1px 5px; background: #fff; }
.asset-item .asset-actions button.del { background: #dc3545; color: #fff; }

.layer-list { display: flex; flex-direction: column; gap: 4px; }
.layer-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; font-size: .8rem; background: #fff; }
.layer-row:hover { background: #f4f6fa; }
.layer-row.active { border-color: var(--brand); background: #eaf0fb; }
.layer-row.is-hidden .layer-name { opacity: .45; text-decoration: line-through; }
.layer-row .layer-thumb { width: 28px; height: 28px; border-radius: 5px; background: #eef1f6; display: flex; align-items: center; justify-content: center; overflow: hidden; flex: 0 0 28px; }
.layer-row .layer-thumb img { width: 100%; height: 100%; object-fit: cover; }
.layer-row .layer-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-row .layer-btn { border: 0; background: transparent; padding: 0 3px; color: #6c757d; }
.layer-row .layer-btn:hover { color: var(--brand); }
.layer-row .layer-btn.on { color: #dc3545; }

.workspace {
    flex: 1; position: relative; overflow: auto; background: var(--workspace-bg);
    display: flex; align-items: center; justify-content: center; padding: 30px;
}
.canvas-wrap { box-shadow: 0 10px 40px rgba(0, 0, 0, .18); background: #fff; margin: auto; flex: 0 0 auto; }
.drop-hint {
    position: absolute; inset: 12px; border: 3px dashed var(--brand); border-radius: 16px; background: rgba(27, 42, 74, .08);
    display: none; align-items: center; justify-content: center; font-size: 1.3rem; color: var(--brand); gap: 8px; pointer-events: none;
}
.workspace.dragging .drop-hint { display: flex; }

.prop-sec { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.prop-sec:last-child { border-bottom: 0; }
.sub-box { background: #f6f8fb; border-radius: 10px; padding: 10px; }
.sel-hint { font-size: .72rem; background: #fff6d6; border-radius: 6px; padding: 4px 8px; margin-bottom: 6px; }
.hint-box { background: #f6f8fb; border-radius: 10px; padding: 12px; font-size: .8rem; }

.swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.swatches button { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .15); padding: 0; }

.align-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.align-grid button { border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 4px 0; }
.align-grid button:hover { border-color: var(--brand); background: #eef2fa; }

.btn-outline-secondary.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.loading-overlay {
    position: fixed; inset: 0; background: rgba(15, 22, 40, .6); z-index: 2000;
    display: none; flex-direction: column; align-items: center; justify-content: center;
}
.loading-overlay.show { display: flex; }

@media (max-width: 991px) {
    .panel-left { width: 240px; }
    .panel-right { width: 250px; }
}

/* ================= GALERI: TAB BRAND ================= */
.brand-bar { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.brand-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0; }
.brand-tab {
    --brand-color: var(--brand);
    display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px;
    color: #444; text-decoration: none; white-space: nowrap; border: 1px solid var(--border); background: #fff; transition: .15s;
}
.brand-tab:hover { border-color: var(--brand-color); color: var(--brand-color); }
.brand-tab.active { background: var(--brand-color); border-color: var(--brand-color); color: #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .12); }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand-color); }
.brand-tab.active .brand-dot { background: #fff; }
.brand-count { font-size: .72rem; padding: 1px 8px; border-radius: 999px; background: rgba(0, 0, 0, .06); }
.brand-tab.active .brand-count { background: rgba(255, 255, 255, .25); }
.brand-text { color: var(--brand-color, var(--brand)); font-weight: 600; }

/* ================= GALERI: FILTER UKURAN ================= */
.ratio-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.ratio-pill {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
    border: 1px solid var(--border); background: #fff; font-size: .82rem; color: #444; transition: .15s;
}
.ratio-pill:hover { border-color: var(--brand-color, var(--brand)); }
.ratio-pill.active { background: var(--brand-color, var(--brand)); border-color: var(--brand-color, var(--brand)); color: #fff; }
.ratio-pill-count { font-size: .7rem; opacity: .7; }
.ratio-icon { display: inline-block; height: 14px; border: 1.5px solid currentColor; border-radius: 2px; }
.ratio-group + .ratio-group { margin-top: 28px; }
.ratio-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1px dashed #d5dae3; font-size: .9rem; }

/* Klik gambar template = pakai */
button.design-thumb { width: 100%; cursor: pointer; }
.design-thumb .thumb-hover {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px;
    background: rgba(15, 25, 45, .55); color: #fff; font-weight: 600; font-size: .85rem; opacity: 0; transition: .15s;
}
.design-thumb:hover .thumb-hover { opacity: 1; }
.brand-select { width: 170px; background-color: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .3); }
.brand-select option { color: #000; }
/* Ikon ukuran & tombol utama mengikuti warna brand aktif */
main[style*="--brand-color"] .size-shape:not(.dashed) { background: linear-gradient(135deg, var(--brand-color), color-mix(in srgb, var(--brand-color) 60%, #fff)); }
main[style*="--brand-color"] .btn-brand { background: var(--brand-color); border-color: var(--brand-color); }
main[style*="--brand-color"] .size-card:hover { border-color: var(--brand-color); }
#journeyShapes { grid-template-columns: repeat(3, 1fr); }
#journeyShapes button { padding: 6px 6px 5px; min-width: 0; }
.sh-svg { overflow: hidden; border-radius: 6px; width: 100%; height: auto; aspect-ratio: 3 / 4; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); }
.sh-svg svg { width: 100%; height: 100%; display: block; }
.shape-grid button { min-width: 0; }
.shape-grid small { word-break: break-word; text-align: center; }
.panel-left .tab-content { overflow-x: hidden; }
