/* ===== Reset & Base ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: #0d0f10;
    color: #e5e7eb;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
code {
    background: #1a1d1f;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 12.5px;
    color: #4ade80;
}

/* ===== Top bar ===== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    border-bottom: 2px solid #c0392b;
    background: #0d0f10;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.brand-icon { color: #f59e0b; }
.brand-name { color: #4ade80; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.muted { color: #9ca3af; }
.logout-link { color: #f87171; font-weight: 500; }
.logout-link:hover { text-decoration: underline; }

/* ===== Tabs ===== */
.tabs {
    display: flex;
    gap: 4px;
    padding: 0 24px;
    border-bottom: 1px solid #1f2937;
}
.tab {
    padding: 14px 16px;
    color: #9ca3af;
    font-weight: 500;
    border-bottom: 2px solid transparent;
}
.tab.active {
    color: #4ade80;
    border-bottom-color: #4ade80;
}

/* ===== Layout ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* ===== Stats ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.stat-card {
    background: #16181a;
    border: 1px solid #232629;
    border-radius: 10px;
    padding: 16px 18px;
}
.stat-label { color: #9ca3af; font-size: 12.5px; margin-bottom: 6px; }
.stat-value { color: #4ade80; font-size: 26px; font-weight: 700; }
.stat-value.stat-expired { color: #e5e7eb; }

/* ===== Panels ===== */
.panel {
    background: #16181a;
    border: 1px solid #232629;
    border-radius: 10px;
    padding: 20px 22px;
    margin-bottom: 20px;
}
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}
.panel-title { color: #4ade80; font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.panel-header .panel-title { margin-bottom: 0; }
.panel-actions { display: flex; gap: 8px; }

/* ===== Forms ===== */
.grid-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-full { grid-column: 1 / -1; }
.field label { color: #9ca3af; font-size: 12.5px; }

input[type="text"],
input[type="url"],
input[type="date"],
input[type="file"],
textarea {
    background: #0d0f10;
    border: 1px solid #2a2d31;
    border-radius: 8px;
    padding: 10px 12px;
    color: #e5e7eb;
    font-size: 13.5px;
    font-family: inherit;
    width: 100%;
}
input:focus, textarea:focus {
    outline: none;
    border-color: #4ade80;
}
textarea { resize: vertical; }

.hint { color: #6b7280; font-size: 12px; margin-bottom: 10px; }

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    background: #1f2937;
    color: #e5e7eb;
    border: 1px solid #2a2d31;
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.btn:hover { border-color: #4ade80; }
.btn-primary { background: #22c55e; color: #052e16; border-color: #22c55e; }
.btn-primary:hover { background: #4ade80; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-xs { padding: 5px 10px; font-size: 12px; }
.btn-blue { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-orange { background: #d97706; color: #fff; border-color: #d97706; }
.btn-dark { background: #1f2937; color: #e5e7eb; }
.btn-danger { background: #7f1d1d; color: #fecaca; border-color: #7f1d1d; }
.btn-danger:hover { background: #991b1b; }

/* ===== Search ===== */
.search-form { display: flex; gap: 8px; margin-bottom: 14px; max-width: 400px; }
.search-form input { flex: 1; }

/* ===== Table ===== */
.table-wrap { overflow-x: auto; }
.link-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.link-table th {
    text-align: left;
    color: #9ca3af;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 10px 12px;
    border-bottom: 1px solid #232629;
    white-space: nowrap;
}
.link-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #1a1d1f;
    vertical-align: top;
}
.url-cell {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #9ca3af;
}
.catatan-cell { max-width: 160px; color: #9ca3af; }
.short-link { color: #60a5fa; }
.short-link:hover { text-decoration: underline; }
.klik-detail { color: #6b7280; font-size: 11px; margin-top: 2px; }
.aksi-cell { display: flex; gap: 6px; white-space: nowrap; }
.empty-row { text-align: center; color: #6b7280; padding: 30px !important; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
}
.badge-active { background: #052e16; color: #4ade80; border: 1px solid #14532d; }
.badge-expired { background: #450a0a; color: #fca5a5; border: 1px solid #7f1d1d; }

.edit-row td { background: #101214; }
.edit-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 10px 4px; }

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 13.5px;
}
.alert-success { background: #052e16; color: #86efac; border: 1px solid #14532d; }
.alert-error { background: #450a0a; color: #fca5a5; border: 1px solid #7f1d1d; }

/* ===== Login page ===== */
.login-page {
    position: relative;
    overflow-x: hidden;
    background:
        radial-gradient(ellipse 700px 500px at 15% 20%, rgba(34,197,94,0.10), transparent 60%),
        radial-gradient(ellipse 600px 500px at 90% 80%, rgba(96,165,250,0.06), transparent 60%),
        #0a0b0c;
    background-attachment: fixed;
}
.login-page::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.045) 1px, transparent 1px);
    background-size: 26px 26px;
    pointer-events: none;
}

.login-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.login-route {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.login-route path {
    fill: none;
    stroke: rgba(74, 222, 128, 0.16);
    stroke-width: 1.5;
    stroke-dasharray: 3 7;
}
.login-node {
    position: absolute;
    font-size: 22px;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 0 10px rgba(74, 222, 128, 0.35));
    animation: login-node-pulse 3.6s ease-in-out infinite;
}
.login-node-b { animation-delay: 1.2s; }
@keyframes login-node-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.85; }
    50% { transform: translate(-50%, -50%) scale(1.12); opacity: 1; }
}

.login-wrap {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1;
}
.login-box {
    background: rgba(22, 24, 26, 0.9);
    backdrop-filter: blur(6px);
    border: 1px solid #232629;
    border-top: 2px solid #4ade80;
    border-radius: 16px;
    padding: 36px 32px 30px;
    width: 100%;
    max-width: 370px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.02);
}
.login-mark {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #052e16, #0a0b0c);
    border: 1px solid #14532d;
    border-radius: 12px;
    margin: 0 auto 16px;
}
.login-mark-icon { font-size: 20px; }
.login-box .brand { justify-content: center; margin-bottom: 4px; }
.login-box .brand-name { color: #4ade80; font-size: 19px; font-weight: 700; }
.login-tagline {
    text-align: center;
    color: #6b7280;
    font-size: 12.5px;
    margin-bottom: 22px;
}

.login-form label {
    display: block;
    color: #9ca3af;
    font-size: 12px;
    font-weight: 500;
    margin: 14px 0 6px;
}
.input-icon-wrap { position: relative; }
.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: #52585f;
    pointer-events: none;
    transition: color 0.15s;
}
.input-icon-wrap input {
    padding-left: 36px;
    background: #0d0f10;
}
.input-icon-wrap:focus-within .input-icon { color: #4ade80; }

.login-submit {
    margin-top: 22px;
    padding: 11px 16px;
    font-size: 13.5px;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.18);
}

@media (max-width: 420px) {
    .login-box { padding: 28px 22px 24px; }
}

/* ===== Responsive ===== */
@media (max-width: 720px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .grid-form, .edit-form { grid-template-columns: 1fr; }
    .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
}
