/* ==========================================================================
   Shortener Panel — stylesheet tunggal, tanpa build step.
   ========================================================================== */

:root {
    --brand: #dc2626;
    --brand-dark: #991b1b;
    --brand-light: #fee2e2;
    --sidebar: #450a0a;
    --sidebar-muted: #b98a8a;
    --bg: #fff6f6;
    --card: rgba(255, 255, 255, .93);
    --line: #f2dede;
    --text: #1c1010;
    --muted: #8a6b6b;
    --green: #16a34a;
    --green-bg: #dcfce7;
    --red: #dc2626;
    --red-bg: #fee2e2;
    --amber: #b45309;
    --amber-bg: #fef3c7;
    --amber-line: #fde68a;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }

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

body {
    /* Pattern titik merah + rona hangat di pojok atas. */
    background-color: var(--bg);
    background-image:
        radial-gradient(900px 420px at 82% -12%, rgba(220, 38, 38, .16), transparent 70%),
        radial-gradient(700px 380px at 5% 108%, rgba(220, 38, 38, .10), transparent 70%),
        radial-gradient(rgba(220, 38, 38, .16) 1.4px, transparent 1.4px),
        radial-gradient(rgba(220, 38, 38, .09) 1.4px, transparent 1.4px);
    background-size: 100% 100%, 100% 100%, 26px 26px, 26px 26px;
    background-position: 0 0, 0 0, 0 0, 13px 13px;
    background-attachment: fixed;
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* ---------- Layout ---------- */

/* z-index 1 supaya konten duduk di atas layer bubble. */
.layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
    width: 190px;
    flex: 0 0 190px;
    background: linear-gradient(180deg, #5c0d0d, #2b0606);
    color: #e2e8f0;
    padding: 16px 12px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 6px 20px;
}

.sidebar-logo {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, #f87171, #b91c1c);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.sidebar-brand strong { color: #fff; font-size: 15px; }

.sidebar-label {
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--sidebar-muted);
    padding: 8px 8px 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border-radius: 8px;
    color: #cbd5e1;
    font-weight: 500;
    margin-bottom: 3px;
}

.sidebar-link:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }

.sidebar-link.is-active {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #fff;
    box-shadow: 0 4px 12px rgba(185, 28, 28, .5);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
    padding: 14px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar h1 { margin: 0; font-size: 17px; font-weight: 700; }
.topbar p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.topbar-spacer { flex: 1; }

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f87171, #dc2626);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.content { padding: 20px 22px 40px; }

/* ---------- Card ---------- */

.card {
    background: var(--card);
    backdrop-filter: blur(4px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}

.card-head {
    padding: 13px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.card-head h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 7px;
}

.card-head .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.card-body { padding: 18px; }
.card-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

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

.field { margin-bottom: 15px; }

.field label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 6px;
}

.field label .opt { color: var(--muted); font-weight: 400; }
.field .help { font-size: 11.5px; color: var(--brand); margin-top: 5px; }
.field .help-muted { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

input[type=text], input[type=url], input[type=email], input[type=password],
input[type=number], input[type=time], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color .12s, box-shadow .12s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .12);
}

textarea { min-height: 130px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 190px; }

/* ---------- Button ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    font: inherit;
    font-weight: 600;
    font-size: 12.5px;
    cursor: pointer;
    transition: filter .12s, background .12s;
}

.btn:hover { filter: brightness(.97); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 12px rgba(185, 28, 28, .38);
}

.btn-soft { background: var(--brand-light); border-color: #fecaca; color: var(--brand-dark); }
.btn-warn { background: #fffbeb; border-color: var(--amber-line); color: var(--amber); }
.btn-danger { background: #7f1d1d; border-color: transparent; color: #fff; }
.btn-sm { padding: 5px 9px; font-size: 11.5px; }
.btn-block { width: 100%; }

/* ---------- Alert ---------- */

.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 16px;
    border: 1px solid;
}

.alert-warn { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }
.alert-ok { background: var(--green-bg); border-color: #bbf7d0; color: #166534; }
.alert-err { background: var(--red-bg); border-color: #fecaca; color: #991b1b; }
.alert ul { margin: 6px 0 0; padding-left: 18px; font-weight: 500; }

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

.table-wrap { overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; }

table.data th {
    text-align: left;
    font-size: 10.5px;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

table.data td {
    padding: 11px 14px;
    border-bottom: 1px solid #f1f2f5;
    vertical-align: middle;
    font-size: 12.5px;
}

table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fff5f5; }

.empty { text-align: center; color: var(--brand); padding: 34px 14px; font-size: 12.5px; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    background: #f3f4f6;
    color: var(--muted);
}

.badge-brand { background: var(--brand-light); color: var(--brand-dark); }
.badge-ok { background: var(--green-bg); color: #166534; }
.badge-off { background: #f1f5f9; color: #64748b; }

.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.truncate { display: block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }

/* ---------- Toggle ---------- */

.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { display: none; }

.toggle .track {
    width: 38px;
    height: 21px;
    border-radius: 999px;
    background: #d1d5db;
    position: relative;
    transition: background .15s;
    flex: 0 0 38px;
}

.toggle .track::after {
    content: '';
    position: absolute;
    top: 2.5px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform .15s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}

.toggle input:checked + .track { background: var(--brand); }
.toggle input:checked + .track::after { transform: translateX(16px); }
.toggle .toggle-text { font-weight: 700; font-size: 12.5px; }
.toggle .toggle-hint { font-weight: 400; font-size: 11.5px; color: var(--muted); }

/* ---------- Schedule rows ---------- */

.sched-row { display: flex; gap: 9px; align-items: center; margin-bottom: 8px; }
.sched-row input[type=time] { flex: 0 0 120px; }
.sched-row input[type=url] { flex: 1; }

/* ---------- Modal ---------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    z-index: 50;
    overflow-y: auto;
}

.modal-backdrop.is-open { display: flex; }

.modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 620px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .3);
}

.modal-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
}

.modal-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.modal-head .close { margin-left: auto; background: none; border: 0; font-size: 19px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 18px; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Auth ---------- */

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 16px;
    position: relative;
    z-index: 1;
}

.auth-card { width: 100%; max-width: 390px; }
.auth-card .card { margin-bottom: 12px; }
.auth-logo { text-align: center; margin-bottom: 18px; }

.auth-logo .sidebar-logo { margin: 0 auto 8px; width: 40px; height: 40px; font-size: 19px; }
.auth-logo strong { font-size: 17px; }
.auth-logo p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }

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

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }

.stat {
    background: var(--card);
    backdrop-filter: blur(4px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
}

.stat .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.stat .value { font-size: 22px; font-weight: 700; margin-top: 4px; }

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #111827;
    color: #fff;
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
    z-index: 90;
}

.toast.is-visible { opacity: 1; }

/* ---------- Bubble merah berjatuhan ----------
   Layer dekoratif di belakang konten (.layout & .auth-wrap punya z-index 1).
   Murni CSS, nggak ada JS yang jalan tiap frame.                            */

.bubbles {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.bubbles i {
    position: absolute;
    top: -140px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .75), rgba(239, 68, 68, .42) 55%, rgba(153, 27, 27, .3));
    border: 1px solid rgba(220, 38, 38, .3);
    box-shadow: 0 4px 12px rgba(220, 38, 38, .18), inset 0 0 8px rgba(255, 255, 255, .35);
    animation: bubble-fall linear infinite;
}

@keyframes bubble-fall {
    0% { transform: translate3d(0, -140px, 0) scale(.55) rotate(0); opacity: 0; }
    12% { opacity: .9; }
    88% { opacity: .75; }
    100% { transform: translate3d(46px, 108vh, 0) scale(1.05) rotate(180deg); opacity: 0; }
}

.bubbles i:nth-child(1)  { left: 4%;  width: 16px; height: 16px; animation-duration: 15s; animation-delay: 0s; }
.bubbles i:nth-child(2)  { left: 11%; width: 30px; height: 30px; animation-duration: 21s; animation-delay: -4s; }
.bubbles i:nth-child(3)  { left: 18%; width: 11px; height: 11px; animation-duration: 12s; animation-delay: -8s; }
.bubbles i:nth-child(4)  { left: 25%; width: 38px; height: 38px; animation-duration: 26s; animation-delay: -2s; }
.bubbles i:nth-child(5)  { left: 32%; width: 20px; height: 20px; animation-duration: 17s; animation-delay: -11s; }
.bubbles i:nth-child(6)  { left: 39%; width: 13px; height: 13px; animation-duration: 13s; animation-delay: -6s; }
.bubbles i:nth-child(7)  { left: 46%; width: 27px; height: 27px; animation-duration: 23s; animation-delay: -14s; }
.bubbles i:nth-child(8)  { left: 53%; width: 17px; height: 17px; animation-duration: 16s; animation-delay: -3s; }
.bubbles i:nth-child(9)  { left: 60%; width: 34px; height: 34px; animation-duration: 28s; animation-delay: -9s; }
.bubbles i:nth-child(10) { left: 67%; width: 12px; height: 12px; animation-duration: 14s; animation-delay: -17s; }
.bubbles i:nth-child(11) { left: 74%; width: 23px; height: 23px; animation-duration: 19s; animation-delay: -5s; }
.bubbles i:nth-child(12) { left: 81%; width: 15px; height: 15px; animation-duration: 15s; animation-delay: -12s; }
.bubbles i:nth-child(13) { left: 88%; width: 32px; height: 32px; animation-duration: 25s; animation-delay: -7s; }
.bubbles i:nth-child(14) { left: 94%; width: 18px; height: 18px; animation-duration: 18s; animation-delay: -15s; }
.bubbles i:nth-child(15) { left: 8%;  width: 25px; height: 25px; animation-duration: 22s; animation-delay: -19s; }
.bubbles i:nth-child(16) { left: 57%; width: 10px; height: 10px; animation-duration: 11s; animation-delay: -10s; }

@media (prefers-reduced-motion: reduce) {
    .bubbles { display: none; }
}

@media (max-width: 760px) {
    .sidebar { position: fixed; left: -190px; z-index: 40; transition: left .2s; }
    .sidebar.is-open { left: 0; }
    .truncate { max-width: 170px; }
}
