/* =========================================================
   SVG Code Studio — Custom styles
   ========================================================= */

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #475569; background-clip: padding-box; }

/* ---------- Glass navbar ---------- */
.glass-panel {
    background: rgba(11, 18, 32, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

/* ---------- Panel (satu layer, tanpa border dobel) ---------- */
.panel {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.55) 0%, rgba(15, 23, 42, 0.65) 100%);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 1rem;
    box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
}

/* Header & footer di dalam panel */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(15, 23, 42, 0.35);
    flex-wrap: wrap;
}

.panel-footer {
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(15, 23, 42, 0.35);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #34d399; /* emerald-400 — satu warna judul konsisten */
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all 0.18s ease;
    white-space: nowrap;
    cursor: pointer;
}
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn-primary {
    background: #10b981;
    color: #052e1a;
    box-shadow: 0 6px 16px -6px rgba(16, 185, 129, 0.6);
}
.btn-primary:hover { background: #34d399; }

.btn-ghost {
    background: rgba(51, 65, 85, 0.7);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.15);
}
.btn-ghost:hover { background: rgba(71, 85, 105, 0.9); color: #fff; }

/* Icon-only buttons (header editor) */
.icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: #94a3b8;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    transition: all 0.18s ease;
    cursor: pointer;
}
.icon-btn:hover {
    color: #e2e8f0;
    background: rgba(51, 65, 85, 0.6);
    border-color: rgba(148, 163, 184, 0.15);
}
.icon-btn:disabled { opacity: 0.5; pointer-events: none; }
.icon-btn-danger:hover { color: #f87171; }

/* ---------- Editor textarea ---------- */
.editor {
    background: #0b1120;
    color: #e2e8f0;            /* netral, tidak lagi hijau menyala */
    border: none;
    outline: none;
    padding: 1rem 1.1rem;
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8125rem;
    line-height: 1.65;          /* nyaman dibaca */
    tab-size: 2;
    caret-color: #10b981;
}
.editor::placeholder { color: #475569; }
.editor:focus { box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.35); }

/* ---------- Preview area ---------- */
.preview-area {
    margin: 0;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Checkerboard transparansi yang tajam (16px) */
.checkerboard {
    background-color: #0b1120;
    background-image:
        linear-gradient(45deg, #1e293b 25%, transparent 25%),
        linear-gradient(-45deg, #1e293b 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #1e293b 75%),
        linear-gradient(-45deg, transparent 75%, #1e293b 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
    transition: background-image 0.2s ease;
}

/* Mode tanpa checkerboard */
.checkerboard.is-off {
    background-image: none;
    background-color: #0b1120;
}

/* Preview SVG: jaga rasio, tidak terdistorsi */
.preview-area svg {
    max-width: 100%;
    max-height: 460px;
    width: auto;
    height: auto;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5));
}

/* ---------- Empty state ---------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #475569;
    padding: 2rem;
    border: 1.5px dashed rgba(148, 163, 184, 0.2);
    border-radius: 0.9rem;
    transition: all 0.2s ease;
}
.empty-state.is-error { color: #f87171; border-color: rgba(248, 113, 113, 0.35); }
.empty-state.is-dragover {
    border-color: #10b981;
    color: #34d399;
    background: rgba(16, 185, 129, 0.06);
}

/* ---------- Status bar & pill ---------- */
.status-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    font-size: 0.7rem;
    color: #64748b;
    font-family: "JetBrains Mono", ui-monospace, monospace;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-weight: 500;
}
.status-neutral { color: #94a3b8; background: rgba(148, 163, 184, 0.1); }
.status-ok      { color: #34d399; background: rgba(16, 185, 129, 0.12); }
.status-error   { color: #f87171; background: rgba(248, 113, 113, 0.12); }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
    padding: 0.6rem 1rem;
    border-radius: 0.6rem;
    font-size: 0.8rem;
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.7);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.toast-ok  { border-color: rgba(16, 185, 129, 0.4); }
.toast.toast-err { border-color: rgba(248, 113, 113, 0.4); }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(2, 6, 23, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.modal-overlay:not(.hidden) { opacity: 1; }
.modal-overlay.hidden { display: none; }

.modal-panel {
    width: 100%;
    max-width: 40rem;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: #0b1120;
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 1rem;
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    transform: translateY(16px) scale(0.98);
    transition: transform 0.22s ease;
}
.modal-overlay:not(.hidden) .modal-panel { transform: translateY(0) scale(1); }

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1rem;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
}

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
}
.field-input {
    width: 100%;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 0.5rem;
    padding: 0.55rem 0.7rem;
    font-size: 0.8rem;
    color: #e2e8f0;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.field-input::placeholder { color: #475569; }
.field-input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.prompt-output {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.72rem;
    line-height: 1.6;
    color: #cbd5e1;
    resize: vertical;
    white-space: pre;
    overflow: auto;
}

/* ---------- Chips (preset cepat) ---------- */
.chip {
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: #94a3b8;
    background: rgba(51, 65, 85, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 999px;
    transition: all 0.16s ease;
    cursor: pointer;
}
.chip:hover { color: #e2e8f0; background: rgba(71, 85, 105, 0.8); }
.chip.is-active {
    color: #052e1a;
    background: #10b981;
    border-color: #10b981;
}

/* ---------- Segmented control (jenis template) ---------- */
.segmented {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.25rem;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 0.65rem;
    align-self: flex-start;
}
.segmented-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    background: transparent;
    border-radius: 0.5rem;
    transition: all 0.16s ease;
    cursor: pointer;
}
.segmented-item:hover { color: #e2e8f0; }
.segmented-item.is-active {
    color: #052e1a;
    background: #10b981;
    box-shadow: 0 4px 12px -4px rgba(16, 185, 129, 0.6);
}

/* Hide scrollbar untuk segmented container (UI lebih rapi) */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Prevent body scroll saat modal terbuka */
body.modal-open { overflow: hidden; }

/* ---------- Keyboard shortcut hints ---------- */
.kbd {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.6rem;
    font-weight: 600;
    color: #94a3b8;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-bottom-width: 2px;
    border-radius: 0.25rem;
    padding: 0.05rem 0.28rem;
    line-height: 1.4;
}

/* ---------- Zoom preview ---------- */
.preview-area svg {
    transition: transform 0.18s ease;
    transform-origin: center center;
}

/* ---------- Galeri template ---------- */
.template-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.55rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 0.7rem;
    cursor: pointer;
    transition: all 0.16s ease;
    text-align: left;
}
.template-card:hover {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.06);
    transform: translateY(-2px);
}
.template-thumb {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0b1120;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.08);
}
.template-thumb svg {
    max-width: 86%;
    max-height: 86%;
    width: auto;
    height: auto;
}
.template-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: #cbd5e1;
    text-align: center;
    line-height: 1.3;
}
