/* ═══════════════════════════════════════════════════════════
 * FlowCraft - Tikfinity-Style Design System v3
 * Mor + Pembe gradient, koyu modern UI
 * ═══════════════════════════════════════════════════════════ */

:root {
  --sidebar-w: 240px;
  --topbar-h: 56px;

  /* ── Backgrounds ── */
  --bg:        #0a0a14;
  --bg2:       #13131f;
  --bg3:       #1c1c2e;
  --bg4:       #25253a;
  --bg-hover:  #2e2e47;

  /* ── Borders ── */
  --border:       #2a2a40;
  --border-light: #3a3a55;

  /* ── Brand Colors (Tikfinity-inspired) ── */
  --accent:      #a855f7;
  --accent2:     #ec4899;
  --accent-dim:  rgba(168,85,247,.12);
  --accent2-dim: rgba(236,72,153,.10);

  /* ── Status colors ── */
  --pink: #ec4899;       --pink-dim: rgba(236,72,153,.10);
  --cyan: #06b6d4;       --cyan-dim: rgba(6,182,212,.10);
  --orange: #f97316;     --orange-dim: rgba(249,115,22,.10);
  --gold: #eab308;       --gold-dim: rgba(234,179,8,.12);
  --green: #10b981;      --green-dim: rgba(16,185,129,.10);
  --red: #ef4444;        --red-dim: rgba(239,68,68,.10);
  --blue: #3b82f6;       --blue-dim: rgba(59,130,246,.10);

  /* ── Gradients ── */
  --gradient-main:    linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
  --gradient-pink:    linear-gradient(135deg, #ec4899, #f472b6);
  --gradient-cyan:    linear-gradient(135deg, #06b6d4, #3b82f6);
  --gradient-gold:    linear-gradient(135deg, #eab308, #f97316);
  --gradient-green:   linear-gradient(135deg, #10b981, #06b6d4);
  --gradient-red:     linear-gradient(135deg, #ef4444, #ec4899);
  --gradient-sidebar: linear-gradient(180deg, #0a0a14 0%, #13131f 50%, #1c1c2e 100%);
  --gradient-topbar:  linear-gradient(90deg, #13131f, #1c1c2e, #13131f);

  /* ── Text ── */
  --text:       #ffffff;
  --text-dim:   #b4b4cc;
  --text-muted: #6e6e8a;

  /* ── Radius ── */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --cartoon-border: 1px;

  /* ── Shadows ── */
  --shadow-card:  0 4px 24px rgba(0,0,0,.20);
  --shadow-hover: 0 8px 32px rgba(168,85,247,.18);
  --glow-accent:  0 4px 20px rgba(168,85,247,.40);
  --glow-pink:    0 4px 16px rgba(236,72,153,.30);
  --glow-cyan:    0 4px 16px rgba(6,182,212,.30);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  position: relative;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 10% 0%, rgba(168,85,247,.08) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 100%, rgba(236,72,153,.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ═══ Layout ═══ */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* ═══ Sidebar ═══ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--gradient-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: width .25s ease, left .25s ease;
  border-right: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,.2);
}
.brand-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--gradient-main);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--glow-accent);
}
.brand-icon img { width: 28px; height: 28px; border-radius: 6px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name {
  font-size: 1.1rem; font-weight: 800;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -.3px;
}
.brand-sub {
  font-size: .58rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: -1px;
  font-weight: 700;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 8px; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

.nav-section { margin-bottom: 4px; }
.nav-section-label {
  padding: 12px 12px 6px;
  font-size: .66rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 12px;
}

.nav-item {
  border-radius: 8px;
  transition: all .15s;
  position: relative;
  margin-bottom: 2px;
}
.nav-item a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  color: var(--text-dim);
  font-size: .85rem;
  font-weight: 500;
  transition: all .15s;
  border-radius: 8px;
}
.nav-item:hover { background: var(--bg-hover); }
.nav-item:hover a { color: var(--text); }
.nav-item.active { background: var(--accent-dim); }
.nav-item.active a { color: var(--accent); font-weight: 700; }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--gradient-main);
  border-radius: 0 3px 3px 0;
}
.nav-icon { font-size: 1.05rem; width: 22px; text-align: center; flex-shrink: 0; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }

.nav-pro-badge {
  background: var(--gradient-main);
  color: #fff;
  font-size: .56rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
  letter-spacing: .4px;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,.25);
}
.sidebar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .76rem;
  color: var(--text-dim);
}
.status-dot-side {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}
.status-dot-side.online { background: var(--green); box-shadow: 0 0 8px rgba(16,185,129,.6); }
.status-dot-side.offline { background: var(--text-muted); }

/* ═══ Main Content ═══ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ═══ Top Bar ═══ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: var(--topbar-h);
  background: var(--gradient-topbar);
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.sidebar-toggle {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.1rem;
  padding: 5px 10px;
  border-radius: 6px;
  display: none;
}
.topbar-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .76rem;
  color: var(--text-dim);
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}
.status-dot.online { background: var(--green); box-shadow: 0 0 8px rgba(16,185,129,.6); }
.status-dot.offline { background: var(--text-muted); }

.topbar-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: .95rem;
  color: var(--text-dim);
  transition: all .15s;
}
.topbar-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: .82rem;
  transition: all .15s;
}
.topbar-user:hover { border-color: var(--accent); }
.topbar-user img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.plan-badge {
  background: var(--gradient-main);
  color: #fff;
  font-size: .6rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 800;
  letter-spacing: .3px;
}
.plan-badge.free { background: var(--bg4); color: var(--text-muted); }

/* ═══ Content Area ═══ */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}
.content-area::-webkit-scrollbar { width: 6px; }
.content-area::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }

/* ═══ Page Header ═══ */
.page-header { margin-bottom: 24px; }
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.page-header .page-desc {
  font-size: .88rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ═══ Cards ═══ */
.card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all .25s;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(168,85,247,.04), rgba(236,72,153,.02));
  pointer-events: none;
  opacity: .6;
}
.card > * { position: relative; z-index: 1; }
.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.card-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.card-header h3 {
  font-size: .92rem;
  font-weight: 600;
  color: var(--text);
}
.card-light {
  background: var(--bg4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all .2s;
}
.card-light:hover { border-color: var(--accent); }

.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* ═══ Grids ═══ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ═══ Stat Card (Dashboard) ═══ */
.stat-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: all .25s;
}
.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.stat-card .icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 12px;
}
.stat-card .val { font-size: 1.8rem; font-weight: 800; color: var(--text); }
.stat-card .lab { font-size: .8rem; color: var(--text-dim); margin-top: 2px; }

/* ═══ Buttons ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: .85rem;
  font-weight: 700;
  transition: all .2s;
  white-space: nowrap;
  cursor: pointer;
  line-height: 1.3;
  text-decoration: none;
}
.btn-primary {
  background: var(--gradient-main);
  color: #fff;
  border-color: transparent;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--glow-accent); }
.btn-secondary {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger {
  background: var(--gradient-red);
  color: #fff;
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: var(--glow-pink); }
.btn-success {
  background: var(--gradient-green);
  color: #fff;
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(16,185,129,.3); }
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: transparent;
}
.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }
.btn-sm { padding: 6px 12px; font-size: .76rem; }
.btn-lg { padding: 12px 26px; font-size: .96rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ═══ Forms ═══ */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group label, .form-row label {
  font-size: .82rem;
  color: var(--text-dim);
  font-weight: 600;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=tel], input[type=search], textarea, select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  font-family: inherit;
  transition: all .15s;
  box-sizing: border-box;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg2);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-hint { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }

/* Range inputs */
input[type=range] {
  -webkit-appearance: none;
  width: 100%; height: 6px;
  background: var(--bg-hover);
  border-radius: 3px; padding: 0;
  border: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: var(--gradient-main);
  border-radius: 50%; cursor: pointer;
  box-shadow: 0 2px 8px rgba(168,85,247,.4);
}

/* Toggle switch */
.toggle, .switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input, .switch input { opacity: 0; width: 0; height: 0; }
.toggle .slider, .switch .slider {
  position: absolute; cursor: pointer;
  inset: 0; background: var(--bg-hover);
  border-radius: 24px;
  transition: .25s;
}
.toggle .slider::before, .switch .slider::before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .25s;
}
.toggle input:checked + .slider, .switch input:checked + .slider { background: var(--gradient-main); }
.toggle input:checked + .slider::before, .switch input:checked + .slider::before { transform: translateX(20px); }

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
}

/* ═══ Status Messages ═══ */
.status-msg {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: .85rem;
  margin: 10px 0;
}
.status-msg.ok {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(16,185,129,.3);
}
.status-msg.err {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(239,68,68,.3);
}

/* ═══ Badges ═══ */
.badge {
  display: inline-flex;
  align-items: center;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .72rem;
  color: var(--text-dim);
  font-weight: 600;
}
.badge-success { background: var(--green-dim); color: var(--green); border-color: rgba(16,185,129,.3); }
.badge-danger { background: var(--red-dim); color: var(--red); border-color: rgba(239,68,68,.3); }
.badge-warning { background: var(--gold-dim); color: var(--gold); border-color: rgba(234,179,8,.3); }
.badge-pro {
  background: var(--gradient-main);
  color: #fff;
  border: none;
  letter-spacing: .4px;
  font-weight: 800;
}

/* ═══ Toast ═══ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: .85rem;
  z-index: 10000;
  box-shadow: var(--shadow-hover);
  animation: toastIn .3s ease;
  max-width: 360px;
}
.toast.ok { border-color: var(--green); color: var(--green); }
.toast.err { border-color: var(--red); color: var(--red); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══ Modal ═══ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal.open { display: flex; }
.modal-box {
  background: var(--bg3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-hover);
}

/* ═══ Responsive ═══ */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -240px; top: 0; bottom: 0; z-index: 100; }
  .sidebar.open { left: 0; }
  .sidebar-toggle { display: inline-flex !important; }
  .content-area { padding: 16px; }
}

/* ═══ Helpers ═══ */
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-accent { color: var(--accent); }
.text-success { color: var(--green); }
.text-danger { color: var(--red); }

.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
