/* ============================================================
   Shortn PHP — Premium Design System
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #f5f5f3;
    --surface:   #ffffff;
    --border:    #e4e4e0;
    --text:      #1a1a1a;
    --text-muted:#6b6b6b;
    --primary:   #1a1a2e;
    --primary-h: #16213e;
    --accent:    #4f46e5;
    --danger:    #dc2626;
    --success:   #16a34a;
    --warning:   #d97706;
    --radius:    12px;
    --radius-sm: 8px;
    --shadow:    0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-serif:'Playfair Display', Georgia, serif;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--text); min-height: 100vh; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ── Navbar ── */
.navbar { position: sticky; top: 0; z-index: 100; background: rgba(245,245,243,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.nav-inner { max-width: 1100px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; justify-content: space-between; }
.nav-logo { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.05rem; letter-spacing: -.01em; }
.nav-logo svg { flex-shrink: 0; }
.nav-link { font-size: .875rem; font-weight: 500; color: var(--text-muted); transition: color .2s; }
.nav-link:hover { color: var(--text); }

/* ── Hero ── */
.hero { max-width: 720px; margin: 0 auto; padding: 80px 24px 60px; text-align: center; }
.hero-badge { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 16px; font-size: .8rem; font-weight: 500; color: var(--text-muted); margin-bottom: 32px; }
.hero-title { font-family: var(--font-serif); font-size: clamp(2.4rem, 6vw, 3.8rem); font-weight: 600; line-height: 1.15; letter-spacing: -.02em; margin-bottom: 20px; }
.hero-title em { font-style: italic; color: var(--text-muted); font-weight: 400; }
.hero-desc { font-size: 1.05rem; color: var(--text-muted); line-height: 1.7; max-width: 520px; margin: 0 auto 48px; }

/* ── Shorten Box ── */
.shorten-box { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 28px; box-shadow: var(--shadow-lg); margin-bottom: 48px; }
.shorten-form { margin-top: 0; }
.input-group { display: flex; gap: 8px; }
.url-input { flex: 1; padding: 14px 18px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: .95rem; font-family: var(--font-sans); background: var(--bg); color: var(--text); outline: none; transition: border-color .2s, box-shadow .2s; }
.url-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,26,46,.08); }
.url-input::placeholder { color: #aaa; }
.btn-shorten { display: flex; align-items: center; gap: 8px; padding: 14px 24px; background: var(--primary); color: #fff; border: none; border-radius: var(--radius); font-size: .9rem; font-weight: 600; cursor: pointer; transition: background .2s, transform .1s; white-space: nowrap; }
.btn-shorten:hover { background: var(--primary-h); }
.btn-shorten:active { transform: scale(.98); }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: .875rem; margin-bottom: 16px; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: var(--danger); }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: var(--success); }

/* ── Result Box ── */
.result-box { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: var(--radius-sm); padding: 16px; margin-bottom: 20px; text-align: left; }
.result-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--success); margin-bottom: 8px; }
.result-url-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.result-url { font-size: 1rem; font-weight: 600; color: var(--accent); word-break: break-all; }
.result-url:hover { text-decoration: underline; }
.btn-copy { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid #bbf7d0; background: #fff; border-radius: 6px; cursor: pointer; color: var(--success); flex-shrink: 0; transition: background .2s; }
.btn-copy:hover { background: #dcfce7; }
.result-original { font-size: .8rem; color: var(--text-muted); word-break: break-all; }

/* ── Features ── */
.features { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; }
.feature-item { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; flex: 1; min-width: 200px; max-width: 280px; }
.feature-icon { font-size: 1.5rem; flex-shrink: 0; }
.feature-text { display: flex; flex-direction: column; gap: 2px; }
.feature-text strong { font-size: .875rem; font-weight: 600; }
.feature-text span { font-size: .8rem; color: var(--text-muted); }

/* ── Footer ── */
.footer { text-align: center; padding: 32px 24px; color: var(--text-muted); font-size: .8rem; border-top: 1px solid var(--border); margin-top: 40px; }

/* ── Copy Toast ── */
.copy-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--primary); color: #fff; padding: 10px 20px; border-radius: 999px; font-size: .875rem; font-weight: 500; opacity: 0; transition: all .3s; pointer-events: none; z-index: 999; }
.copy-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Admin Layout ── */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--primary); color: #fff; padding: 24px 0; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 0 20px 24px; font-size: 1.1rem; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 16px; }
.sidebar-logo svg { flex-shrink: 0; }
.sidebar-nav { list-style: none; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 20px; font-size: .875rem; color: rgba(255,255,255,.7); transition: all .2s; border-radius: 0; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-nav a svg { flex-shrink: 0; opacity: .7; }
.sidebar-nav a:hover svg, .sidebar-nav a.active svg { opacity: 1; }
.sidebar-footer { padding: 20px; margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-footer a { font-size: .8rem; color: rgba(255,255,255,.5); }
.sidebar-footer a:hover { color: #fff; }

.admin-content { flex: 1; padding: 32px; overflow-x: auto; }
.admin-header { margin-bottom: 28px; }
.admin-header h1 { font-family: var(--font-serif); font-size: 1.8rem; font-weight: 600; letter-spacing: -.01em; }
.admin-header p { color: var(--text-muted); font-size: .9rem; margin-top: 4px; }

/* ── Stats Cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; }
.stat-value.danger { color: var(--danger); }
.stat-value.success { color: var(--success); }
.stat-value.accent { color: var(--accent); }

/* ── Table ── */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.table-title { font-weight: 600; font-size: .95rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th { padding: 12px 16px; text-align: left; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); background: #fafaf9; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fafaf9; }
tbody td { padding: 12px 16px; vertical-align: middle; }
.code-cell { font-family: 'Courier New', monospace; font-size: .85rem; font-weight: 600; color: var(--accent); }
.url-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); font-size: .8rem; }
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #fef2f2; color: #dc2626; }
.badge-bot { background: #fef9c3; color: #92400e; }
.badge-human { background: #eff6ff; color: #1d4ed8; }
.count-cell { font-weight: 600; }
.count-bot { color: var(--danger); }
.count-human { color: var(--success); }

/* ── Action Buttons ── */
.actions { display: flex; gap: 6px; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text-muted); transition: all .2s; }
.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon.danger:hover { background: #fef2f2; border-color: #fecaca; color: var(--danger); }
.btn-icon.success:hover { background: #f0fdf4; border-color: #bbf7d0; color: var(--success); }
.btn-icon.accent:hover { background: #eff6ff; border-color: #bfdbfe; color: var(--accent); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius-sm); font-size: .875rem; font-weight: 500; cursor: pointer; border: 1px solid transparent; transition: all .2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--surface); border-radius: 16px; padding: 28px; width: 100%; max-width: 480px; box-shadow: var(--shadow-lg); transform: translateY(16px); transition: transform .2s; }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-title { font-family: var(--font-serif); font-size: 1.3rem; font-weight: 600; margin-bottom: 20px; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.form-input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: .9rem; font-family: var(--font-sans); outline: none; transition: border-color .2s; }
.form-input:focus { border-color: var(--primary); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ── Activity Detail ── */
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: .875rem; color: var(--text-muted); margin-bottom: 20px; transition: color .2s; }
.back-link:hover { color: var(--text); }
.activity-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.meta-chip { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: .8rem; }
.meta-chip strong { font-weight: 600; }
.ua-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; color: var(--text-muted); font-family: monospace; }
.filter-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.filter-tab { padding: 6px 16px; border-radius: 999px; font-size: .8rem; font-weight: 500; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); transition: all .2s; }
.filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Login ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 40px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo svg { margin-bottom: 12px; }
.login-logo h1 { font-family: var(--font-serif); font-size: 1.6rem; font-weight: 600; }
.login-logo p { color: var(--text-muted); font-size: .875rem; margin-top: 4px; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; gap: 6px; padding: 16px 20px; border-top: 1px solid var(--border); }
.page-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); font-size: .8rem; cursor: pointer; color: var(--text-muted); transition: all .2s; }
.page-btn:hover { background: var(--bg); color: var(--text); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-info { font-size: .8rem; color: var(--text-muted); margin-left: 8px; }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 60px 24px; color: var(--text-muted); }
.empty-state svg { margin-bottom: 16px; opacity: .3; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: .875rem; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .admin-layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .sidebar-nav { display: flex; overflow-x: auto; padding-bottom: 8px; }
    .sidebar-nav a { white-space: nowrap; }
    .admin-content { padding: 20px 16px; }
    .input-group { flex-direction: column; }
    .btn-shorten { justify-content: center; }
    .features { flex-direction: column; align-items: center; }
    .feature-item { max-width: 100%; width: 100%; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .actions { flex-wrap: wrap; }
}
@media (max-width: 480px) {
    .hero { padding: 48px 16px 40px; }
    .shorten-box { padding: 20px 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
