/* ═══════════════════════════════════════════════════════
   LinkFlow — Global Design System
   Dark Theme · Glassmorphism · Inter Font
═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS Variables ──────────────────────────────────── */
:root {
  --bg-base:       #0a0a14;
  --bg-card:       rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.07);
  --bg-input:      rgba(255,255,255,0.06);
  --border:        rgba(255,255,255,0.08);
  --border-focus:  rgba(108,99,255,0.6);

  --accent:        #25D366;
  --accent-soft:   rgba(37,211,102,0.15);
  --accent-hover:  #128C7E;
  --accent-2:      #075E54;
  --accent-3:      #128C7E;

  --text-primary:  #f0f0f8;
  --text-secondary:#9a9ab0;
  --text-muted:    #5a5a72;

  --success:       #22c55e;
  --success-soft:  rgba(34,197,94,0.12);
  --danger:        #ef4444;
  --danger-soft:   rgba(239,68,68,0.12);
  --warning:       #f59e0b;
  --warning-soft:  rgba(245,158,11,0.12);

  --radius-sm:     8px;
  --radius:        12px;
  --radius-lg:     16px;
  --radius-xl:     24px;
  --radius-full:   999px;

  --shadow:        0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:     0 8px 40px rgba(0,0,0,0.5);
  --shadow-accent: 0 4px 20px rgba(108,99,255,0.3);

  --transition:    0.2s cubic-bezier(0.4,0,0.2,1);
  --sidebar-w:     240px;
}

/* ─── Reset & Base ───────────────────────────────────── */
*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }

html { scroll-behavior:smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img { max-width:100%; display:block; }
ul,ol { list-style:none; }

/* ─── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius:99px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ─── Typography ─────────────────────────────────────── */
h1 { font-size:2rem; font-weight:800; line-height:1.2; }
h2 { font-size:1.5rem; font-weight:700; }
h3 { font-size:1.2rem; font-weight:600; }
h4 { font-size:1rem; font-weight:600; }
p  { color: var(--text-secondary); }

.text-gradient {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Cards ──────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(12px);
  transition: background var(--transition), border-color var(--transition);
}
.card:hover { background: var(--bg-card-hover); }

.card-sm { padding: 16px; border-radius: var(--radius); }

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

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(108,99,255,0.45);
  color: #fff;
}

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

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-input); color: var(--text-primary); }

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  justify-content: center;
}

.btn-sm { padding: 6px 14px; font-size:13px; }
.btn-lg { padding: 14px 28px; font-size:15px; border-radius: var(--radius-lg); }

.btn[disabled], .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

/* ─── Forms ──────────────────────────────────────────── */
.form-group { display:flex; flex-direction:column; gap:6px; }

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

input, select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  background: rgba(108,99,255,0.06);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.12);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
select option { background: #1a1a2e; color: var(--text-primary); }
textarea { resize:vertical; min-height:80px; }

.form-row { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
@media(max-width:600px) { .form-row { grid-template-columns:1fr; } }

.input-group {
  position: relative;
}
.input-group .input-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}
.input-group input { padding-left: 80px; }

.form-error {
  font-size: 12px;
  color: var(--danger);
  display:flex;
  align-items:center;
  gap:4px;
}
.form-hint { font-size: 12px; color: var(--text-muted); }

/* ─── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger);  }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-accent  { background: var(--accent-soft);  color: var(--accent);  }
.badge-muted   { background: rgba(255,255,255,0.06); color: var(--text-muted); }

/* ─── Table ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width:100%; border-collapse:collapse; }
thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13.5px;
  vertical-align: middle;
}
tbody tr:hover { background: var(--bg-card); }
tbody tr:last-child td { border-bottom: none; }

/* ─── Modal ──────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-backdrop.open { opacity:1; pointer-events:all; }

.modal {
  background: #15152a;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 540px;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-backdrop.open .modal { transform: translateY(0) scale(1); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close {
  background: var(--bg-input);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  width:32px; height:32px;
  display:flex; align-items:center; justify-content:center;
  transition: all var(--transition);
  font-size:18px;
}
.modal-close:hover { background: var(--danger-soft); color: var(--danger); }
.modal-footer { margin-top:24px; display:flex; justify-content:flex-end; gap:10px; }

/* ─── Alerts & Toasts ────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-danger  { background: var(--danger-soft);  color: var(--danger);  border:1px solid rgba(239,68,68,0.18); }
.alert-success { background: var(--success-soft); color: var(--success); border:1px solid rgba(34,197,94,0.18); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border:1px solid rgba(245,158,11,0.18); }

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: #1e1e38;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 13.5px;
  font-weight:500;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: all;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s cubic-bezier(0.34,1.56,0.64,1) forwards;
  min-width: 220px;
  max-width: 340px;
}
.toast.toast-success { border-color: rgba(34,197,94,0.3); }
.toast.toast-error   { border-color: rgba(239,68,68,0.3); }
.toast.toast-out { animation: toast-out 0.25s ease forwards; }

@keyframes toast-in  { from{opacity:0;transform:translateX(30px)} to{opacity:1;transform:translateX(0)} }
@keyframes toast-out { from{opacity:1;transform:translateX(0)} to{opacity:0;transform:translateX(30px)} }

/* ─── Utility ────────────────────────────────────────── */
.flex         { display:flex; }
.flex-col     { flex-direction:column; }
.items-center { align-items:center; }
.justify-between { justify-content:space-between; }
.gap-2 { gap:8px; }
.gap-3 { gap:12px; }
.gap-4 { gap:16px; }
.mt-1 { margin-top:4px; }
.mt-2 { margin-top:8px; }
.mt-3 { margin-top:12px; }
.mt-4 { margin-top:16px; }
.text-sm { font-size:13px; }
.text-xs { font-size:12px; }
.text-muted   { color:var(--text-muted); }
.text-secondary { color:var(--text-secondary); }
.text-success { color:var(--success); }
.text-danger  { color:var(--danger); }
.text-accent  { color:var(--accent); }
.font-semibold { font-weight:600; }
.font-bold { font-weight:700; }
.truncate { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.w-full { width:100%; }

/* ─── Loading Spinner ────────────────────────────────── */
.spinner {
  width:18px; height:18px;
  border:2px solid rgba(255,255,255,0.15);
  border-top-color: #fff;
  border-radius:50%;
  animation: spin 0.7s linear infinite;
  display:inline-block;
}
@keyframes spin { to { transform:rotate(360deg); } }

/* ─── Page Animations ────────────────────────────────── */
@keyframes fadeUp {
  from { opacity:0; transform:translateY(16px); }
  to   { opacity:1; transform:translateY(0); }
}
.fade-up { animation: fadeUp 0.4s ease forwards; }
.fade-up-delay-1 { animation-delay:0.05s; opacity:0; }
.fade-up-delay-2 { animation-delay:0.10s; opacity:0; }
.fade-up-delay-3 { animation-delay:0.15s; opacity:0; }
.fade-up-delay-4 { animation-delay:0.20s; opacity:0; }

/* ─── Auth Layout ────────────────────────────────────── */
.auth-page {
  min-height:100vh;
  display:grid;
  grid-template-columns:1fr 1fr;
}
.auth-hero {
  background: linear-gradient(135deg,#0f0f22 0%,#1a1040 50%,#0f1a2e 100%);
  padding:60px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  position:relative;
  overflow:hidden;
}
.auth-hero::before {
  content:'';
  position:absolute;
  width:500px; height:500px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(108,99,255,0.12) 0%, transparent 70%);
  top:-100px; left:-100px;
}
.auth-hero::after {
  content:'';
  position:absolute;
  width:300px; height:300px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(255,107,157,0.08) 0%, transparent 70%);
  bottom:-50px; right:-50px;
}
.auth-form-wrap {
  display:flex;
  align-items:center;
  justify-content:center;
  padding:40px;
  background: var(--bg-base);
}
.auth-form-box {
  width:100%;
  max-width:420px;
}
.auth-form-box h2 { font-size:1.7rem; margin-bottom:6px; }
.auth-form-box .sub { color:var(--text-secondary); margin-bottom:28px; font-size:14px; }
.auth-form-box form { display:flex; flex-direction:column; gap:16px; }

.logo {
  display:flex;
  align-items:center;
  gap:10px;
  font-size:1.3rem;
  font-weight:800;
  color: var(--text-primary);
  margin-bottom:48px;
  text-decoration:none;
}
.logo-icon {
  width:36px; height:36px;
  background:linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius:10px;
  display:flex; align-items:center; justify-content:center;
  font-size:18px;
}

.auth-features { margin-top:48px; display:flex; flex-direction:column; gap:20px; }
.auth-feature {
  display:flex; align-items:flex-start; gap:14px;
}
.auth-feature-icon {
  width:40px; height:40px;
  border-radius:10px;
  background: var(--accent-soft);
  color: var(--accent);
  display:flex; align-items:center; justify-content:center;
  font-size:18px;
  flex-shrink:0;
}

.auth-divider {
  text-align:center;
  position:relative;
  font-size:12px;
  color:var(--text-muted);
}
.auth-divider::before, .auth-divider::after {
  content:'';
  position:absolute;
  top:50%; width:38%;
  height:1px;
  background:var(--border);
}
.auth-divider::before { left:0; }
.auth-divider::after  { right:0; }

@media(max-width:768px) {
  .auth-page { grid-template-columns:1fr; }
  .auth-hero { display:none; }
  .auth-form-wrap { padding:24px; }
}

/* ─── Sidebar Layout ─────────────────────────────────── */
.app-layout {
  display:flex;
  min-height:100vh;
}
.sidebar {
  width: var(--sidebar-w);
  background: rgba(255,255,255,0.03);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display:flex;
  flex-direction:column;
  position:fixed;
  top:0; left:0;
  height:100vh;
  z-index:100;
  transition: transform var(--transition);
}
.sidebar .logo { margin-bottom:32px; }
.sidebar-nav { display:flex; flex-direction:column; gap:4px; flex:1; }
.nav-label {
  font-size:10px;
  font-weight:700;
  letter-spacing:0.1em;
  text-transform:uppercase;
  color:var(--text-muted);
  padding:8px 12px 4px;
  margin-top:8px;
}
.nav-item {
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:var(--radius);
  color:var(--text-secondary);
  font-size:14px;
  font-weight:500;
  text-decoration:none;
  transition:all var(--transition);
}
.nav-item:hover { background:var(--bg-input); color:var(--text-primary); }
.nav-item.active {
  background:var(--accent-soft);
  color:var(--accent);
  font-weight:600;
}
.nav-item i { font-size:18px; width:22px; }
.sidebar-footer { padding-top:16px; border-top:1px solid var(--border); }
.user-card {
  display:flex; align-items:center; gap:10px;
  padding:10px 12px;
  border-radius:var(--radius);
}
.user-avatar {
  width:34px; height:34px;
  border-radius:50%;
  background:linear-gradient(135deg, var(--accent), var(--accent-2));
  display:flex; align-items:center; justify-content:center;
  font-weight:700;
  font-size:13px;
  flex-shrink:0;
}
.user-info-name { font-size:13px; font-weight:600; line-height:1.3; }
.user-info-email { font-size:11px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:140px; }

/* ─── Main Content ───────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex:1;
  min-width:0;
}
.topbar {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:20px 32px;
  border-bottom:1px solid var(--border);
  position:sticky; top:0;
  background:rgba(10,10,20,0.9);
  backdrop-filter:blur(12px);
  z-index:50;
}
.topbar-title h1 { font-size:1.3rem; font-weight:700; }
.topbar-title p  { font-size:13px; color:var(--text-muted); }
.page-content { padding:32px; }

/* ─── Stats Grid ─────────────────────────────────────── */
.stats-grid {
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:16px;
  margin-bottom:24px;
}
.stat-card {
  padding:20px;
  border-radius:var(--radius-lg);
  border:1px solid var(--border);
  background:var(--bg-card);
  display:flex;
  align-items:flex-start;
  gap:16px;
  transition:all var(--transition);
}
.stat-card:hover { transform:translateY(-2px); box-shadow:var(--shadow); border-color:rgba(255,255,255,0.12); }
.stat-icon {
  width:44px; height:44px;
  border-radius:12px;
  display:flex; align-items:center; justify-content:center;
  font-size:20px;
  flex-shrink:0;
}
.stat-value { font-size:1.8rem; font-weight:800; line-height:1; margin-bottom:4px; }
.stat-label { font-size:12px; color:var(--text-muted); font-weight:500; text-transform:uppercase; letter-spacing:0.05em; }

/* ─── Chart Cards ────────────────────────────────────── */
.chart-grid { display:grid; grid-template-columns:2fr 1fr; gap:16px; }
.chart-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:24px; }
.chart-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; }
.chart-header h3 { font-size:14px; font-weight:600; color:var(--text-secondary); }

/* ─── Mobile Overlay ─────────────────────────────────── */
.sidebar-overlay {
  display:none;
  position:fixed; inset:0;
  background:rgba(0,0,0,0.6);
  z-index:99;
}
.menu-toggle {
  display:none;
  background:var(--bg-input);
  border:1px solid var(--border);
  color:var(--text-primary);
  border-radius:var(--radius-sm);
  padding:8px;
  cursor:pointer;
  font-size:20px;
}

@media(max-width:1024px) {
  .stats-grid { grid-template-columns:repeat(2,1fr); }
  .chart-grid { grid-template-columns:1fr; }
}
@media(max-width:768px) {
  .sidebar { transform:translateX(-100%); }
  .sidebar.open { transform:translateX(0); }
  .sidebar-overlay { display:block; }
  .main-content { margin-left:0; }
  .menu-toggle { display:flex; align-items:center; }
  .page-content { padding:20px; }
  .topbar { padding:16px 20px; }
  .stats-grid { grid-template-columns:1fr 1fr; }
}
@media(max-width:480px) {
  .stats-grid { grid-template-columns:1fr; }
}
