/* =========================================================================
   Form Anwr — Stylesheet
   Light mode · Poppins · aksen indigo
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Warna */
    --bg: #FAFAF9;
    --surface: #FFFFFF;
    --surface-muted: #F5F5F4;
    --border: #E7E5E4;
    --text: #1C1917;
    --text-muted: #78716C;
    --text-faint: #A8A29E;

    --accent: #4338CA;
    --accent-hover: #3730A3;
    --accent-soft: #EEF2FF;
    --accent-soft-border: #C7D2FE;

    --success: #15803D;
    --success-soft: #F0FDF4;
    --success-border: #BBF7D0;

    --danger: #DC2626;
    --danger-soft: #FEF2F2;
    --danger-border: #FECACA;

    --warning: #B45309;
    --warning-soft: #FFFBEB;
    --warning-border: #FDE68A;

    /* Tipografi */
    --font-body: 'Poppins', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Layout */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.04);
    --shadow-md: 0 4px 16px rgba(28, 25, 23, 0.06);
    --shadow-lg: 0 12px 32px rgba(28, 25, 23, 0.10);
    --sidebar-w: 240px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-body);
    font-weight: 600;
    margin: 0 0 4px;
    letter-spacing: -0.01em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

p { color: var(--text-muted); margin: 0 0 12px; }

code, .mono { font-family: var(--font-mono); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- Layout: Auth pages (login/setup) ---------- */

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 20%, var(--accent-soft) 0%, transparent 45%),
        var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 18px;
}

.auth-card h1 { font-size: 20px; }
.auth-card .subtitle { color: var(--text-muted); font-size: 13.5px; margin-bottom: 24px; }

/* ---------- Form controls ---------- */

label {
    display: block;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.field-group { margin-bottom: 18px; }
.field-hint { font-size: 12.5px; color: var(--text-faint); margin-top: 5px; }

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="password"],
input[type="file"],
textarea,
select {
    width: 100%;
    font-family: var(--font-body);
    font-size: 14.5px;
    padding: 11px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}

textarea { resize: vertical; min-height: 90px; }

.choice-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 0;
    font-size: 14.5px;
    color: var(--text);
}
.choice-row input { width: auto; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all .15s ease;
    text-decoration: none;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-muted); }

.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-muted); color: var(--text); }

.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---------- Admin shell: sidebar + topbar ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 22px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand .mark {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
}

.sidebar-brand .name { font-weight: 600; font-size: 14.5px; }
.sidebar-brand .sub { font-size: 11px; color: var(--text-faint); }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}
.nav-item:hover { background: var(--surface-muted); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--text-faint);
}

.main {
    flex: 1;
    min-width: 0;
    padding: 32px 40px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 26px;
    gap: 16px;
    flex-wrap: wrap;
}

.topbar h1 { font-size: 22px; }
.topbar .desc { color: var(--text-muted); font-size: 13.5px; margin: 4px 0 0; }

/* ---------- Cards ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.card-pad { padding: 24px; }

.form-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    transition: box-shadow .15s ease, border-color .15s ease;
}
.form-card:hover { box-shadow: var(--shadow-md); border-color: var(--accent-soft-border); }

.form-card-title { font-size: 15.5px; font-weight: 600; margin-bottom: 3px; }
.form-card-meta { font-size: 12.5px; color: var(--text-faint); display: flex; gap: 14px; flex-wrap: wrap; }
.form-card-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- Status pill ---------- */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.pill-active { background: var(--success-soft); color: var(--success); border: 1px solid var(--success-border); }
.pill-inactive { background: var(--warning-soft); color: var(--warning); border: 1px solid var(--warning-border); }

/* ---------- Stats ---------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 26px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
}
.stat-card .num { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.stat-card .label { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Empty state ---------- */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-faint);
}
.empty-state .icon { font-size: 34px; margin-bottom: 10px; }
.empty-state h3 { color: var(--text); font-size: 16px; margin-bottom: 6px; }

/* ---------- Alerts / flash ---------- */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 18px;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.alert-error   { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.alert-info    { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft-border); }

/* ---------- Table ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 12px 16px; white-space: nowrap; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-muted); }
tr:last-child td { border-bottom: none; }
td.wrap { white-space: normal; max-width: 280px; }

/* ---------- Field builder (admin/create.php & edit.php) ---------- */

.field-row {
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 14px;
    position: relative;
}

.field-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.field-row-head .drag-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.field-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 14px;
}

.options-list textarea { font-family: var(--font-mono); font-size: 13px; }

.remove-field-btn {
    border: none;
    background: transparent;
    color: var(--text-faint);
    cursor: pointer;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 6px;
}
.remove-field-btn:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- Public form page ---------- */

.public-wrap {
    min-height: 100vh;
    background:
        radial-gradient(circle at 85% 0%, var(--accent-soft) 0%, transparent 40%),
        var(--bg);
    padding: 48px 20px;
}

.public-card {
    max-width: 620px;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.public-header {
    padding: 32px 36px 24px;
    border-top: 5px solid var(--accent);
}

.public-header h1 { font-size: 22px; }
.public-header p { margin-top: 8px; font-size: 14px; }

.public-body { padding: 8px 36px 36px; }

.public-footer {
    text-align: center;
    margin-top: 22px;
    font-size: 12.5px;
    color: var(--text-faint);
}

.public-success {
    max-width: 480px;
    margin: 80px auto;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 44px 32px;
    box-shadow: var(--shadow-lg);
}
.public-success .check {
    width: 52px; height: 52px;
    background: var(--success-soft);
    color: var(--success);
    border: 1.5px solid var(--success-border);
    border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    margin: 0 auto 18px;
}

/* ---------- Misc ---------- */

.required-mark { color: var(--danger); margin-left: 2px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.text-faint { color: var(--text-faint); font-size: 12.5px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ---------- Responsive ---------- */

@media (max-width: 820px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; padding: 12px 16px; }
    .sidebar-brand { border-bottom: none; padding: 0 14px 0 0; margin: 0 10px 0 0; border-right: 1px solid var(--border); }
    .sidebar-footer { display: none; }
    .nav-item { white-space: nowrap; }
    .main { padding: 22px 18px; }
    .field-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
