@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
    --slate-900: #1e2430; --slate-700: #3c495e; --slate-500: #5c6c82; --slate-100: #f0f3f7;
    --peach: #dfbead; --sand: #c7b5a3; --sage: #95b3aa;
    --ink: #1a202c; --muted: #718096; --paper: #ffffff; --bg-body: #edf2f7; --line: #e2e8f0;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --shadow-hover: 0 8px 24px -10px rgba(30, 36, 48, 0.12);
}

body.dark-theme {
    --slate-900: #ffffff; --slate-700: #a0aec0; --slate-500: #718096; --slate-100: #2a3441;
    --ink: #f0f3f7; --muted: #a0aec0; --paper: #1e2430; --bg-body: #0f131a; --line: #2d3748;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-body);
    color: var(--ink);
    min-height: 100vh;
    transition: background 0.5s, color 0.5s;
}
body.no-transitions * { transition: none !important; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
:focus-visible { outline: 2px solid var(--slate-700); outline-offset: 2px; }

#app { width: 100%; }

.card {
    display: flex;
    background: var(--paper);
    overflow: hidden;
    min-height: 100vh;
    min-height: 100dvh;
    transition: background 0.5s;
}

/* Hero */
.hero {
    width: 350px;
    flex: none;
    position: relative;
    overflow: hidden;
    padding: 40px 32px;
    color: #fff;
    background: radial-gradient(circle at 20% 10%, #5c6c82, #3c495e 55%, #1e2430);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.hero__title { font-family: 'Space Grotesk', sans-serif; font-size: 36px; font-weight: 700; line-height: 1.1; position: relative; z-index: 1; }
.hero__text { margin-top: 16px; font-size: 14px; line-height: 1.6; opacity: 0.85; max-width: 90%; position: relative; z-index: 1; }
.hero__foot { position: relative; z-index: 1; font-size: 13px; opacity: 0.85; }
.hero__foot strong { display: block; font-family: 'Space Grotesk', sans-serif; font-size: 16px; margin-bottom: 2px; }

.hero__blob {
    position: absolute; right: -70px; bottom: -70px; width: 240px; height: 240px;
    background: rgba(149, 179, 170, 0.25);
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    animation: morph 12s ease-in-out infinite;
}
.hero__shape { position: absolute; animation: float 6s ease-in-out infinite; }
.hero__shape--cube { top: 150px; right: 44px; width: 44px; height: 44px; background: var(--sand); border-radius: 10px; transform: rotate(18deg); }
.hero__shape--ball { top: 250px; right: 110px; width: 32px; height: 32px; background: var(--sage); border-radius: 50%; animation-delay: -2s; }
.hero__shape--tri { top: 96px; right: 120px; width: 0; height: 0; border-left: 20px solid transparent; border-right: 20px solid transparent; border-bottom: 34px solid var(--peach); animation-delay: -4s; }

@keyframes morph {
    0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    50% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
}
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }

/* Panel utama */
.main { flex: 1; padding: 36px; display: flex; flex-direction: column; min-width: 0; }
.main__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.main__title { font-family: 'Space Grotesk', sans-serif; font-size: 24px; font-weight: 600; }

.badge {
    width: 44px; height: 44px; border-radius: 999px; background: var(--slate-100);
    display: flex; align-items: center; justify-content: center; cursor: pointer; border: none;
    font-size: 18px; transition: transform 0.3s var(--ease), background 0.5s;
}
.badge:hover { transform: scale(1.06); }

/* Form */
.form { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--slate-700); }
.field__input {
    width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px;
    background: var(--bg-body); color: var(--ink); font: inherit; font-size: 15px; outline: none;
    transition: border-color 0.2s, background 0.5s, color 0.5s;
}
.field__input:focus { border-color: var(--slate-500); }
textarea.field__input { min-height: 160px; resize: vertical; line-height: 1.6; }
.field__count { align-self: flex-end; font-size: 12px; color: var(--muted); }

.form__foot { display: flex; align-items: center; gap: 16px; margin-top: auto; }
.btn {
    height: 48px; padding: 0 28px; border: none; border-radius: 14px; cursor: pointer;
    background: var(--slate-900); color: var(--paper); font: inherit; font-weight: 600; font-size: 15px;
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), opacity 0.2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

.status { flex: 1; padding: 12px 16px; border-radius: 14px; font-size: 14px; display: none; }
.status.ok { display: block; background: rgba(37, 211, 102, 0.1); color: #1b8a45; border: 1px solid rgba(37, 211, 102, 0.2); }
.status.err { display: block; background: rgba(214, 100, 85, 0.1); color: #b94b3e; border: 1px solid rgba(214, 100, 85, 0.25); }
body.dark-theme .status.ok { color: #4ade80; }
body.dark-theme .status.err { color: #f0907f; }

/* Daftar prompt */
.list-head { display: flex; align-items: center; justify-content: space-between; margin-top: 32px; padding-top: 28px; border-top: 1px solid var(--line); }
.list-title { font-family: 'Space Grotesk', sans-serif; font-size: 18px; font-weight: 600; }
.list-count { font-size: 13px; color: var(--muted); }
.list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.list-item {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%;
    padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-body);
    color: var(--ink); font: inherit; text-align: left; cursor: pointer;
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background 0.5s;
}
.list-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.list-item__name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item__date { flex: none; font-size: 12px; color: var(--muted); }
.list-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 14px; border: 1px dashed var(--line); border-radius: 14px; }

/* Popup */
.modal { display: none; position: fixed; inset: 0; background: rgba(15, 19, 26, 0.6); backdrop-filter: blur(4px); align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal.active { display: flex; }
.modal__box { background: var(--paper); color: var(--ink); width: 100%; max-width: 640px; max-height: 85vh; border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25); }
.modal__title { font-family: 'Space Grotesk', sans-serif; font-size: 20px; font-weight: 600; }
.modal__body { flex: 1; min-height: 0; overflow: auto; background: var(--bg-body); border: 1px solid var(--line); border-radius: 14px; padding: 16px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; user-select: text; }
.modal__actions { display: flex; gap: 12px; justify-content: flex-end; }
.btn--ghost { background: var(--slate-100); color: var(--slate-700); }

/* Responsif */
@media (max-width: 1024px) { .hero { width: 300px; } }
@media (max-width: 900px) {
    .card { flex-direction: column; }
    .hero { width: 100%; padding: 32px 28px; min-height: 220px; }
    .hero__shape--cube { top: 28px; }
    .hero__shape--ball { top: 90px; }
    .hero__shape--tri { top: 40px; }
}
@media (max-width: 480px) {
    .hero__title { font-size: 28px; }
    .main { padding: 24px 20px; }
    .form__foot { flex-direction: column-reverse; align-items: stretch; }
    .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .hero__blob, .hero__shape { animation: none; }
}