/* ===================================================
   QRShort - Premium Dark UI System
   =================================================== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.25);
    --bg-dark: #0a0e1a;
    --bg-card: #111827;
    --bg-card-hover: #1a2332;
    --bg-input: #0d1320;
    --text-primary: #f1f5f9;
    --text-secondary: #64748b;
    --text-muted: #475569;
    --accent: #10b981;
    --accent-glow: rgba(16, 185, 129, 0.2);
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.2);
    --border: #1e2a3a;
    --border-light: #243044;
    --sidebar-width: 260px;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 30px rgba(0,0,0,0.4);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 40px var(--primary-glow);
    --transition: all 0.2s ease;
}

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

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── TYPOGRAPHY ─────────────────────────────── */
h1 { font-size: 1.9rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.4rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
p  { color: var(--text-secondary); }

/* ── SCROLLBAR ──────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── LOGO ───────────────────────────────────── */
.logo {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text-primary);
    text-decoration: none;
    display: block;
    user-select: none;
}
.logo span { color: var(--primary); }

/* ── BUTTONS ────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px var(--primary-glow);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: var(--border);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}
.btn-secondary:hover {
    background: var(--border-light);
}

.btn-danger {
    background: var(--danger-glow);
    color: var(--danger);
    border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover {
    background: rgba(239,68,68,0.25);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 14px;
}
.btn-ghost:hover {
    background: var(--border);
    color: var(--text-primary);
}

.btn-icon {
    padding: 9px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-block { width: 100%; justify-content: center; }

/* ── FORMS ──────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 11px 14px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-control::placeholder { color: var(--text-muted); }

.form-select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 11px 14px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-group {
    display: flex;
    gap: 8px;
}
.input-group .form-control { flex: 1; }

/* ── ALERTS ─────────────────────────────────── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success {
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid rgba(16,185,129,0.3);
}
.alert-error {
    background: var(--danger-glow);
    color: var(--danger);
    border: 1px solid rgba(239,68,68,0.3);
}

/* ── BADGE ──────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-primary {
    background: rgba(99,102,241,0.15);
    color: var(--primary);
}
.badge-success {
    background: var(--accent-glow);
    color: var(--accent);
}
.badge-admin {
    background: rgba(245,158,11,0.15);
    color: var(--warning);
}

/* ── CARD ───────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.card-body { padding: 28px; }
.card-header {
    padding: 20px 28px;
    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-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--border);
}

/* ── TABLE ──────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 1px solid var(--border); }
th {
    padding: 14px 20px;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--bg-card-hover); }

/* ── DIVIDER ────────────────────────────────── */
.divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

/* ── STAT CARDS ─────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 18px;
    transition: var(--transition);
}
.stat-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.stat-icon.indigo { background: rgba(99,102,241,0.15); color: var(--primary); }
.stat-icon.green  { background: var(--accent-glow); color: var(--accent); }
.stat-icon.amber  { background: rgba(245,158,11,0.15); color: var(--warning); }
.stat-info h3 { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.stat-info .stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text-primary); line-height: 1; }

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

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-logo {
    padding: 8px 12px 28px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 14px;
    margin-bottom: 8px;
    margin-top: 16px;
}

.nav-links { list-style: none; }

.nav-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    position: relative;
}

.nav-links a i {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.nav-links a:hover {
    background: var(--border);
    color: var(--text-primary);
}

.nav-links a.active {
    background: rgba(99,102,241,0.12);
    color: var(--primary);
    font-weight: 600;
}

.nav-links a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-links .logout-link:hover {
    background: var(--danger-glow);
    color: var(--danger);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    flex-shrink: 0;
    text-transform: uppercase;
}

.sidebar-user-info small {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.sidebar-user-info span {
    font-size: 0.875rem;
    font-weight: 600;
}

/* ── MAIN CONTENT ────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    padding: 20px 36px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-dark);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title h1 { font-size: 1.25rem; font-weight: 700; }
.topbar-title p { font-size: 0.82rem; color: var(--text-secondary); margin: 0; }

.page-body { padding: 32px 36px; flex: 1; }

/* ── PAGE HEADER ─────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}
.page-header h1 { font-size: 1.5rem; }
.page-header p  { margin: 4px 0 0; font-size: 0.875rem; }

/* ── LOGIN PAGE ──────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
    pointer-events: none;
}

.auth-wrap {
    position: relative;
    width: 100%;
    max-width: 420px;
    z-index: 1;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.auth-logo { margin-bottom: 32px; }

.auth-heading { margin-bottom: 6px; font-size: 1.6rem; font-weight: 800; }
.auth-subheading { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 32px; }

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ── LINK DETAIL VIEW ────────────────────────── */
.link-detail-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
}

.detail-row {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
    font-weight: 600;
}
.detail-value {
    font-size: 0.9rem;
    word-break: break-all;
    color: var(--text-primary);
}

.qr-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.qr-frame {
    background: white;
    padding: 16px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.qr-frame img { display: block; width: 200px; height: 200px; }

.qr-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

/* ── TOAST ──────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 14px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    animation: slideIn 0.25s ease forwards;
}

.toast.toast-success i { color: var(--accent); }
.toast.toast-error   i { color: var(--danger); }
.toast.toast-info    i { color: var(--primary); }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(20px); }
}
.toast.removing { animation: slideOut 0.2s ease forwards; }

/* ── EMPTY STATE ─────────────────────────────── */
.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}
.empty-state i { font-size: 2.5rem; margin-bottom: 16px; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; }

/* ── LANDING PAGE ────────────────────────────── */
.landing-page .landing-nav {
    padding: 24px 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.landing-hero {
    padding: 100px 48px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.landing-hero::before {
    content: '';
    position: absolute;
    top: -100px; left: 50%;
    transform: translateX(-50%);
    width: 700px; height: 700px;
    background: radial-gradient(circle, rgba(99,102,241,0.1) 0%, transparent 70%);
    pointer-events: none;
}
.landing-hero h1 { font-size: 3.5rem; font-weight: 900; line-height: 1.05; margin-bottom: 20px; }
.landing-hero h1 span {
    background: linear-gradient(to right, #6366f1, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.landing-hero p { font-size: 1.1rem; max-width: 560px; margin: 0 auto 36px; }

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 1024px) {
    .link-detail-grid { grid-template-columns: 1fr; }
    .qr-panel { flex-direction: row; text-align: left; align-items: flex-start; }
    .qr-actions { flex-direction: row; }
}

@media (max-width: 768px) {
    :root { --sidebar-width: 0px; }
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .topbar { padding: 16px 20px; }
    .page-body { padding: 20px; }
    .landing-hero h1 { font-size: 2.2rem; }
    .landing-nav { padding: 16px 20px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}
