/* ── Reset & Variables ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
}
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Auth Pages ────────────────────────────────────────────────────── */
.auth-container {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
}
.auth-card {
    background: var(--surface); border-radius: var(--radius); padding: 2.5rem;
    width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo i { font-size: 2.5rem; color: var(--primary); }
.auth-logo h1 { font-size: 1.5rem; margin-top: .5rem; }
.auth-logo p { color: var(--text-secondary); font-size: .9rem; }

/* ── Forms ──────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .375rem; color: var(--text); }
.form-control {
    width: 100%; padding: .625rem .875rem; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: .9rem; transition: border-color .2s, box-shadow .2s;
    font-family: inherit; background: var(--surface); color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: .5rem; padding: .625rem 1.25rem;
    border: none; border-radius: var(--radius-sm); font-size: .875rem; font-weight: 500;
    cursor: pointer; transition: all .2s; font-family: inherit; line-height: 1.4;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: .375rem .75rem; font-size: .8rem; }
.btn-lg { padding: .875rem 1.75rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: .5rem; width: 36px; height: 36px; justify-content: center; }
.btn-group { display: flex; gap: .5rem; }

/* ── Layout ────────────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ───────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width); background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    transition: transform .3s;
}
.sidebar-header { padding: 1.25rem 1.5rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.logo { display: flex; align-items: center; gap: .75rem; font-weight: 700; font-size: 1.2rem; color: var(--primary); }
.logo i { font-size: 1.4rem; }
.sidebar-close { display: none; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-secondary); }
.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: .75rem; padding: .75rem 1.5rem;
    color: var(--text-secondary); font-size: .9rem; font-weight: 500; transition: all .15s;
    text-decoration: none;
}
.nav-item:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.nav-item.active { background: var(--primary-light); color: var(--primary); border-right: 3px solid var(--primary); }
.nav-item i { width: 20px; text-align: center; }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.user-info { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.user-avatar { width: 36px; height: 36px; background: var(--primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: .875rem; flex-shrink: 0; }
.user-details { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: .75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-logout { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 1rem; padding: .5rem; }
.btn-logout:hover { color: var(--danger); }

/* ── Main ──────────────────────────────────────────────────────────── */
.main-content { flex: 1; margin-left: var(--sidebar-width); }

/* ── Topbar ─────────────────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-height); background: var(--surface); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem;
    position: sticky; top: 0; z-index: 50;
}
.menu-toggle { display: none; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text); }
.page-title { font-size: 1.25rem; font-weight: 600; flex: 1; }
.topbar-actions { display: flex; gap: .75rem; }

/* ── Content Area ──────────────────────────────────────────────────── */
.content { padding: 1.5rem; max-width: 1400px; }

/* ── Stats Cards ───────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
    background: var(--surface); border-radius: var(--radius); padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow); display: flex; align-items: center; gap: 1rem;
}
.stat-icon { width: 48px; height: 48px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.stat-icon.blue { background: #eff6ff; color: #3b82f6; }
.stat-icon.green { background: #f0fdf4; color: #22c55e; }
.stat-icon.purple { background: #faf5ff; color: #a855f7; }
.stat-icon.orange { background: #fff7ed; color: #f97316; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: .8rem; color: var(--text-secondary); }

/* ── Cards ─────────────────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h2 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.5rem; }
.card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); }

/* ── Grid ──────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* ── Tables ────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .8rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
td { padding: .875rem 1rem; border-bottom: 1px solid var(--border); font-size: .875rem; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ── Link Item ─────────────────────────────────────────────────────── */
.link-item {
    display: flex; align-items: center; gap: 1rem; padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border); transition: background .15s;
}
.link-item:last-child { border-bottom: none; }
.link-item:hover { background: var(--bg); }
.link-icon { width: 40px; height: 40px; background: var(--primary-light); color: var(--primary); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.link-info { flex: 1; min-width: 0; }
.link-title { font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: .5rem; }
.link-title a { color: var(--text); }
.link-title a:hover { color: var(--primary); }
.link-short { color: var(--primary); font-size: .85rem; font-weight: 500; }
.link-original { color: var(--text-muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 400px; }
.link-meta { display: flex; gap: 1.5rem; align-items: center; flex-shrink: 0; }
.link-clicks { text-align: center; }
.link-clicks-value { font-size: 1.1rem; font-weight: 700; }
.link-clicks-label { font-size: .7rem; color: var(--text-muted); }
.link-date { font-size: .8rem; color: var(--text-muted); white-space: nowrap; }
.link-actions { display: flex; gap: .25rem; }

/* ── Tags ──────────────────────────────────────────────────────────── */
.tag { display: inline-flex; align-items: center; padding: .125rem .5rem; background: var(--bg); border-radius: 999px; font-size: .7rem; color: var(--text-secondary); border: 1px solid var(--border); }

/* ── Status Badges ─────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: .25rem .625rem; border-radius: 999px; font-size: .75rem; font-weight: 500; }
.badge-active { background: #f0fdf4; color: #16a34a; }
.badge-inactive { background: #fef2f2; color: #dc2626; }
.badge-expired { background: #fffbeb; color: #d97706; }
.badge-pending { background: #fffbeb; color: #d97706; }
.badge-verified { background: #f0fdf4; color: #16a34a; }

/* ── Modal ─────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
    z-index: 200; align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 560px;
    max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h2 { font-size: 1.1rem; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 1.25rem; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .75rem; }

/* ── Toast ─────────────────────────────────────────────────────────── */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 999; display: flex; flex-direction: column; gap: .5rem; }
.toast {
    background: var(--surface); border-radius: var(--radius-sm); padding: .875rem 1.25rem;
    box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: .75rem;
    animation: slideIn .3s ease; min-width: 300px; border-left: 4px solid var(--primary);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Charts ────────────────────────────────────────────────────────── */
.chart-container { position: relative; height: 280px; }
.chart-bar-group { display: flex; align-items: flex-end; gap: 2px; height: 200px; padding: 0 .5rem; }
.chart-bar {
    flex: 1; background: var(--primary); border-radius: 3px 3px 0 0;
    min-width: 8px; transition: height .3s; position: relative; cursor: pointer;
}
.chart-bar:hover { background: var(--primary-hover); }
.chart-bar .tooltip {
    display: none; position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
    background: var(--text); color: #fff; padding: .375rem .625rem; border-radius: 6px; font-size: .75rem; white-space: nowrap;
}
.chart-bar:hover .tooltip { display: block; }
.chart-labels { display: flex; justify-content: space-between; padding: .5rem .5rem 0; }
.chart-labels span { font-size: .7rem; color: var(--text-muted); }

/* ── Empty State ───────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1.5rem; }
.empty-state i { font-size: 3rem; color: var(--text-muted); margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: .5rem; }
.empty-state p { color: var(--text-secondary); margin-bottom: 1.5rem; }

/* ── Copy Button ───────────────────────────────────────────────────── */
.copy-text { cursor: pointer; display: inline-flex; align-items: center; gap: .375rem; }
.copy-text:hover { color: var(--primary-hover); }
.copy-text i { font-size: .75rem; }

/* ── API Docs ──────────────────────────────────────────────────────── */
.api-section { margin-bottom: 2rem; }
.api-endpoint { background: var(--bg); border-radius: var(--radius-sm); padding: 1rem 1.25rem; margin-bottom: .75rem; border: 1px solid var(--border); }
.api-method { display: inline-flex; padding: .25rem .5rem; border-radius: 4px; font-size: .75rem; font-weight: 700; margin-right: .5rem; }
.api-method.get { background: #dbeafe; color: #2563eb; }
.api-method.post { background: #dcfce7; color: #16a34a; }
.api-method.patch { background: #fef3c7; color: #d97706; }
.api-method.delete { background: #fee2e2; color: #dc2626; }
.api-path { font-family: 'Courier New', monospace; font-size: .9rem; font-weight: 600; }
.api-desc { margin-top: .5rem; font-size: .85rem; color: var(--text-secondary); }
pre.code-block {
    background: #1e293b; color: #e2e8f0; padding: 1rem 1.25rem;
    border-radius: var(--radius-sm); font-size: .8rem; overflow-x: auto;
    margin-top: .75rem; line-height: 1.5;
}
pre.code-block .key { color: #7dd3fc; }
pre.code-block .string { color: #86efac; }
pre.code-block .comment { color: #64748b; }

/* ── Domain verification ───────────────────────────────────────────── */
.dns-record { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; margin-top: .75rem; }
.dns-record code { background: #1e293b; color: #e2e8f0; padding: .125rem .375rem; border-radius: 4px; font-size: .8rem; }
.dns-record p { font-size: .85rem; color: var(--text-secondary); margin-bottom: .375rem; }

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .menu-toggle { display: block; }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .link-item { flex-wrap: wrap; }
    .link-meta { width: 100%; justify-content: space-between; margin-top: .5rem; }
    .topbar-actions span { display: none; }
    .link-original { max-width: 200px; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .content { padding: 1rem; }
}
