/* ============================================================
   SAC-Shortlink — Admin Panel Stylesheet
   Premium corporate editorial / modern Gen-Z campaign style
   ============================================================ */

:root {
    --primary: #006885;
    --secondary: #00AAAD;
    --accent: #F15A22;
    --accent-2: #F99D1F;
    --bg: #eef6f8;
    --sidebar-w: 264px;
    --topbar-h: 72px;
    --text: #16262c;
    --text-muted: #6b8087;
    --white: #ffffff;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow-sm: 0 2px 14px rgba(0, 104, 133, .07);
    --shadow-md: 0 14px 34px rgba(0, 104, 133, .14);
    --transition: all .25s cubic-bezier(.4,0,.2,1);
    --grad-primary: linear-gradient(135deg, var(--primary), var(--secondary));
    --grad-accent: linear-gradient(135deg, var(--accent), var(--accent-2));
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background:
        radial-gradient(circle at 8% 0%, rgba(0,170,173,.10) 0%, transparent 42%),
        radial-gradient(circle at 100% 12%, rgba(249,157,31,.08) 0%, transparent 38%),
        linear-gradient(180deg, #f3f9fb 0%, #eaf4f6 55%, #eef7f5 100%);
    background-attachment: fixed;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
h1, h2, h3, h4 { font-family: 'Outfit', 'Inter', sans-serif; letter-spacing: -.01em; }

/* ---------- Topbar ---------- */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: rgba(255,255,255,.9);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 26px;
    z-index: 1000;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}
.burger span {
    width: 22px;
    height: 2.5px;
    border-radius: 2px;
    background: var(--primary);
    transition: var(--transition);
}
.burger.active span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.burger.active span:nth-child(2) { opacity: 0; }
.burger.active span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

.page-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--primary);
}

/* Center brand mark in navbar */
.topbar-center {
    display: flex;
    align-items: center;
    justify-content: center;
}
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--primary);
    letter-spacing: -.01em;
    white-space: nowrap;
}
.topbar-brand .brand-mark {
    width: 30px; height: 30px;
    border-radius: 9px;
    background: var(--grad-primary);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: .85rem;
    flex-shrink: 0;
}
.topbar-brand span.hi { color: var(--accent); }

.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }

.topbar-logo { display: none; } /* deprecated slot kept for backward compat */

.admin-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--bg);
    padding: 6px 14px 6px 6px;
    border-radius: 30px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--primary);
}
.admin-chip .avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--grad-primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .78rem; font-weight: 700;
}

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--white);
    box-shadow: var(--shadow-sm);
    overflow-y: auto;
    z-index: 900;
    transition: transform .3s ease;
}

.sidebar-nav { padding: 22px 14px; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: 12px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: .92rem;
    transition: var(--transition);
}

.sidebar-nav a .icon { font-size: 1rem; width: 20px; text-align: center; color: inherit; }

.sidebar-nav a:hover {
    background: rgba(0, 170, 173, .09);
    color: var(--primary);
    transform: translateX(3px);
}

.sidebar-nav a.active {
    background: var(--grad-primary);
    color: #fff;
    box-shadow: var(--shadow-md);
}
.sidebar-nav a.active .icon { color: #fff; }

.sidebar-nav .nav-section {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #a7bcc1;
    margin: 20px 16px 8px;
    font-weight: 700;
}
.sidebar-nav .nav-section:first-child { margin-top: 4px; }

/* ---------- Main content ---------- */
.main-content {
    margin-left: var(--sidebar-w);
    margin-top: var(--topbar-h);
    padding: 32px;
    min-height: calc(100vh - var(--topbar-h));
    transition: var(--transition);
}

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10,30,36,.45);
    z-index: 800;
}
.overlay.active { display: block; }

/* ---------- Cards / Stats ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    position: relative;
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    overflow: hidden;
}
.stat-card::after {
    content: "";
    position: absolute;
    right: -18px; top: -18px;
    width: 70px; height: 70px;
    border-radius: 50%;
    background: rgba(0,170,173,.06);
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 54px; height: 54px;
    border-radius: 15px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    color: #fff;
    background: var(--grad-primary);
    flex-shrink: 0;
    z-index: 1;
}
.stat-card:nth-child(3) .stat-icon,
.stat-card:nth-child(4) .stat-icon { background: var(--grad-accent); }

.stat-value { font-family: 'Outfit', sans-serif; font-size: 1.6rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.stat-label { font-size: .82rem; color: var(--text-muted); font-weight: 500; }

.panel {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 26px;
    margin-bottom: 24px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.panel-header h2 {
    font-size: 1.08rem;
    margin: 0;
    color: var(--primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 11px 20px;
    border-radius: 11px;
    border: none;
    font-size: .87rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    background: var(--grad-primary);
    color: #fff;
}
.btn i, .btn svg { font-size: .95em; }
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-accent { background: var(--grad-accent); }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid #d7e6ea;
}
.btn-outline:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-sm { padding: 8px 14px; font-size: .78rem; }
.btn-danger { background: linear-gradient(135deg, #d64545, #F15A22); }
.btn-icon {
    width: 36px; height: 36px;
    padding: 0;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .92rem;
}

/* Action icon buttons — consistent flat familiar style (Kelola Link) */
.action-icons { display: flex; gap: 7px; flex-wrap: wrap; }
.action-icons .btn-icon {
    background: var(--bg);
    color: var(--primary);
    border: 1px solid transparent;
    font-family: inherit;
    cursor: pointer;
}
.action-icons .btn-icon:hover { background: var(--primary); color: #fff; transform: translateY(-2px); }
.action-icons .btn-icon.icon-danger { color: #c0392b; }
.action-icons .btn-icon.icon-danger:hover { background: #d64545; color: #fff; }
.action-icons .btn-icon.icon-warn { color: var(--accent-2); }
.action-icons .btn-icon.icon-warn:hover { background: var(--accent-2); color: #fff; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}
.data-table th {
    text-align: left;
    padding: 13px 14px;
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 700;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}
.data-table th:first-child { border-radius: 10px 0 0 10px; }
.data-table th:last-child { border-radius: 0 10px 10px 0; }
.data-table td {
    padding: 14px;
    border-bottom: 1px solid #eef2f3;
    vertical-align: middle;
}
.data-table tr { transition: var(--transition); }
.data-table tbody tr:hover { background: rgba(0, 170, 173, .05); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
}
.badge-success { background: #e9f9f3; color: #1c7a52; }
.badge-danger { background: #fdecea; color: #c0392b; }
.badge-warning { background: #fff6e5; color: #b5790a; }
.badge-info { background: #e6f6f7; color: var(--primary); }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }

.form-group label {
    display: block;
    font-weight: 700;
    font-size: .85rem;
    margin-bottom: 7px;
    color: var(--text);
}
.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: 5px; }
.form-hint.error-text { color: #c0392b; font-weight: 600; }
.form-hint.ok-text { color: #1c7a52; font-weight: 600; }

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #dfe7e9;
    border-radius: 11px;
    font-size: .9rem;
    font-family: inherit;
    background: #fbfdfd;
    transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(0,170,173,.15); }

.input-group { display: flex; }
.input-group .form-control { border-radius: 11px 0 0 11px; }
.input-group .btn { border-radius: 0 11px 11px 0; }

/* Domain + alias split field (like bit.ly custom back-half) */
.alias-field {
    display: flex;
    align-items: stretch;
    border: 1.5px solid #dfe7e9;
    border-radius: 11px;
    overflow: hidden;
    background: #fbfdfd;
    transition: var(--transition);
}
.alias-field:focus-within { border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(0,170,173,.15); }
.alias-field .domain-prefix {
    display: flex;
    align-items: center;
    padding: 0 14px;
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: .88rem;
    white-space: nowrap;
    border-right: 1.5px solid #dfe7e9;
}
.alias-field input {
    border: none;
    background: transparent;
    flex: 1;
    padding: 12px 14px;
    font-size: .9rem;
    font-family: inherit;
    min-width: 0;
}
.alias-field input:focus { outline: none; }
.alias-status { font-size: .95rem; padding: 0 12px; display: flex; align-items: center; }
.alias-status.checking i { color: var(--text-muted); }
.alias-status.available i { color: #1c9963; }
.alias-status.taken i { color: #d64545; }

/* ---------- Login page ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 15% 20%, rgba(255,255,255,.12) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(249,157,31,.20) 0%, transparent 40%),
        var(--grad-primary);
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.login-card {
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(0,0,0,.25);
    padding: 46px 40px;
    width: 100%;
    max-width: 400px;
    animation: fadeUp .5s ease;
    position: relative;
    z-index: 1;
}
@keyframes fadeUp { from{opacity:0; transform:translateY(18px);} to{opacity:1; transform:translateY(0);} }
.login-card .brand {
    text-align: center;
    margin-bottom: 30px;
}
.login-card .brand h1 { font-size: 1.4rem; color: var(--primary); margin: 14px 0 4px; font-weight: 800; }
.login-card .brand p { color: var(--text-muted); font-size: .85rem; margin: 0; }
.login-logo {
    width: 64px; height: 64px; border-radius: 18px;
    background: var(--grad-primary);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; font-weight: 800; margin: 0 auto;
}
.login-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 18px; }

/* ---------- Utility ---------- */
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-0 { margin-top: 0; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 2.3rem; margin-bottom: 12px; color: #c3d6da; }

/* ---------- Modal (QR Code / Confirm) ---------- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 28, 34, .55);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal-box {
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0,0,0,.3);
    animation: fadeUp .3s ease;
}
.modal-box h3 {
    margin: 0 0 6px;
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
}
.modal-box canvas, .modal-box img { max-width: 240px; width: 100%; border-radius: 14px; margin: 10px auto 14px; border: 1px solid #eef2f3; display: block; }
.modal-box a.modal-link { font-size: .8rem; color: var(--primary); word-break: break-all; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; justify-content: center; }
.modal-close { width: 100%; }

/* Confirm dialog */
.confirm-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fdecea, #ffe6dc);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    margin: 0 auto 16px;
}
.modal-box p.confirm-text { color: var(--text-muted); font-size: .9rem; margin: 0; line-height: 1.5; }

/* ---------- Flash message ---------- */
.flash-message {
    padding: 15px 18px;
    border-radius: 13px;
    margin-bottom: 22px;
    font-size: .88rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}
.flash-message.success { background: #e9f9f3; color: #1c7a52; border: 1px solid #b9ecd7; }
.flash-message.error { background: #fdecea; color: #c0392b; border: 1px solid #f5c2be; }
.flash-message i { font-size: 1.05rem; }

/* ---------- Doodle decorations (subtle, editorial) ---------- */
.doodle-star {
    position: absolute;
    color: var(--accent-2);
    opacity: .35;
    font-size: 1.1rem;
    pointer-events: none;
}
.panel { position: relative; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .burger { display: flex; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.active { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 20px; }
    .admin-chip span.username-text { display: none; }
    .form-row { grid-template-columns: 1fr; }
    .topbar { grid-template-columns: auto 1fr auto; }
    .topbar-brand span.text { display: none; }
}
@media (max-width: 600px) {
    .topbar-center { display: none; }
    .topbar { grid-template-columns: 1fr auto; }
}
