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

:root {
  --bg-main: #060608;
  --bg-panel: #111116;
  --bg-sidebar: #09090C;
  
  --text-main: #F3F4F6;
  --text-muted: #8F95A3;
  
  --border-light: rgba(255, 255, 255, 0.06);
  --border-glow: rgba(255, 107, 0, 0.2);
  
  --primary: #FF6B00;
  --primary-dark: #E85D00;
  --primary-glow: 0 0 20px rgba(255, 107, 0, 0.35);
  
  --danger: #EF4444;
  --success: #10B981;
  --warning: #F59E0B;
  --info: #3B82F6;
  
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--bg-main);
  color: var(--text-main);
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: -30%;
  left: -10%;
  width: 70%;
  height: 70%;
  background: radial-gradient(circle, rgba(255,107,0,0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; position: relative; z-index: 1; }

/* Sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 28px 20px;
  background: rgba(9, 9, 12, 0.7); backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-light);
  display: flex; flex-direction: column; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 14px; color: #fff; text-decoration: none; padding: 0 4px 40px; }
.brand-mark {
  width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #FF9500); color: #fff; font-weight: 900; font-size: 22px;
  box-shadow: var(--primary-glow);
}
.brand span:last-child { display: flex; flex-direction: column; }
.brand strong { font-size: 20px; letter-spacing: 0.5px; line-height: 1.1; }
.brand small { font-size: 12px; color: var(--primary); margin-top: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; }

.sidebar nav { display: grid; gap: 8px; }
.sidebar nav a {
  padding: 12px 16px; border-radius: var(--radius-md); color: var(--text-muted); text-decoration: none; font-weight: 500;
  transition: all 0.25s ease; border: 1px solid transparent; display: flex; align-items: center; gap: 12px;
  font-size: 15px;
}
.sidebar nav a svg { width: 20px; height: 20px; opacity: 0.7; transition: 0.2s; }
.sidebar nav a:hover { color: var(--text-main); background: rgba(255,255,255,0.03); }
.sidebar nav a:hover svg { opacity: 1; color: var(--primary); }
.sidebar nav a.active {
  background: linear-gradient(90deg, rgba(255,107,0,0.12), transparent);
  color: var(--primary); border-left: 2px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-weight: 600;
}
.sidebar nav a.active svg { opacity: 1; }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border-light); padding: 24px 8px 0; display: flex; flex-direction: column; gap: 4px; }
.sidebar-foot span { font-weight: 600; font-size: 14px; color: #fff; }
.sidebar-foot small { color: var(--text-muted); font-size: 12px; }
.sidebar-foot a { margin-top: 12px; color: var(--danger); font-size: 13px; text-decoration: none; font-weight: 600; transition: 0.2s; display: inline-flex; align-items: center; gap: 8px; }
.sidebar-foot a:hover { text-shadow: 0 0 12px rgba(239,68,68,0.5); }

/* Main Area */
.main { min-width: 0; }
.topbar {
  height: 88px; padding: 0 40px;
  background: rgba(6, 6, 8, 0.6); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  position: sticky; top: 0; z-index: 10;
}
.topbar-content { display: flex; flex-direction: column; gap: 2px; }
.topbar h1 { font-size: 24px; margin: 0; font-weight: 700; letter-spacing: -0.5px; display: flex; align-items: center; gap: 10px; }
.topbar p { margin: 0; color: var(--text-muted); font-size: 14px; }
.menu-button { display: none; border: 0; background: var(--bg-panel); color: #fff; border-radius: 12px; padding: 10px 14px; font-size: 20px; cursor: pointer; border: 1px solid var(--border-light); }

.content { padding: 40px; max-width: 1500px; margin: 0 auto; }

/* Alerts */
.alert { padding: 18px 24px; margin-bottom: 32px; border-radius: var(--radius-md); font-weight: 500; display: flex; align-items: center; gap: 14px; font-size: 15px; }
.alert.success { background: rgba(16,185,129,0.1); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.alert.error { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin-bottom: 40px; }
.stat-card {
  background: var(--bg-panel); border: 1px solid transparent; border-radius: var(--radius-lg); padding: 24px 20px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s;
}
.stat-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px;
  background: radial-gradient(120% 120% at top left, var(--glow-color, rgba(255,255,255,0.1)) 0%, rgba(255,255,255,0.02) 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.stat-card:nth-child(1) { --glow-color: #a855f7; }
.stat-card:nth-child(2) { --glow-color: #10B981; }
.stat-card:nth-child(3) { --glow-color: #3b82f6; }
.stat-card:nth-child(4) { --glow-color: #f59e0b; }
.stat-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg), 0 8px 32px rgba(0,0,0,0.5); }
.stat-card:hover::before { background: radial-gradient(150% 150% at top left, var(--glow-color) 0%, rgba(255,255,255,0.1) 80%); }
.stat-card span { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.stat-card strong { display: block; font-size: 34px; font-weight: 700; margin: 12px 0 4px; background: linear-gradient(to bottom right, #fff, #9ca3af); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.stat-card small { display: block; color: var(--text-muted); font-size: 13px; }

/* Panels / Tables */
.panel {
  background: var(--bg-panel); border: 1px solid var(--border-light); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md); overflow: hidden; position: relative;
}
.panel::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 1px 1px rgba(255,255,255,0.05); pointer-events: none; }
.panel-head { padding: 24px 32px; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; gap: 20px; background: rgba(255,255,255,0.01); }
.panel-head h2 { font-size: 20px; margin: 0 0 6px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.panel-head p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* Buttons */
.page-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 32px; }
.page-actions p { margin: 0; color: var(--text-muted); font-size: 14px; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border: 1px solid transparent; border-radius: var(--radius-sm); text-decoration: none; font-weight: 600; font: inherit; font-size: 14px;
  cursor: pointer; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.button.small { min-height: 32px; padding: 0 14px; font-size: 13px; border-radius: 8px; gap: 6px; }
.button.small svg { width: 16px; height: 16px; }
.button svg { width: 20px; height: 20px; }
.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(0); }
.button.primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: var(--primary-glow); border: none; }
.button.primary:hover { box-shadow: 0 0 24px rgba(255, 107, 0, 0.5); filter: brightness(1.1); }
.button.secondary { background: rgba(255,255,255,0.04); color: var(--text-main); border-color: var(--border-light); }
.button.secondary:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); }
.button.ghost { background: transparent; color: var(--text-main); border-color: transparent; }
.button.ghost:hover { background: rgba(255,255,255,0.05); }
.button.danger { background: rgba(239,68,68,0.1); color: var(--danger); border-color: rgba(239,68,68,0.2); }
.button.danger:hover { background: rgba(239,68,68,0.15); box-shadow: 0 0 16px rgba(239,68,68,0.3); }

/* Table */
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 20px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); background: rgba(0,0,0,0.2); font-weight: 600; }
td { font-size: 14px; color: var(--text-main); }
td strong { font-weight: 600; color: #fff; display: block; margin-bottom: 4px; font-size: 15px; }
td small { color: var(--text-muted); font-size: 13px; background: rgba(255,255,255,0.05); padding: 4px 8px; border-radius: 6px; }
tbody tr { transition: background 0.2s; }
tbody tr:hover { background: rgba(255,255,255,0.02); }

.text-link { color: var(--primary); text-decoration: none; font-weight: 600; transition: 0.2s; display: inline-flex; align-items: center; gap: 6px; }
.text-link:hover { color: #fff; text-shadow: var(--primary-glow); }

.status {
  display: inline-flex; padding: 8px 16px; border-radius: 30px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; align-items: center; gap: 8px;
}
.status::before { content: ""; display: block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.active { background: rgba(16,185,129,0.1); color: var(--success); border: 1px solid rgba(16,185,129,0.2); box-shadow: inset 0 0 12px rgba(16,185,129,0.1); }
.status.paused { background: rgba(245,158,11,0.1); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.status.archived { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid var(--border-light); }

.empty-state { padding: 80px 40px; text-align: center; }
.empty-state svg { width: 64px; height: 64px; margin: 0 auto 24px; color: var(--border-light); }
.empty-state h3 { margin: 0 0 12px; font-size: 24px; font-weight: 600; color: #fff; }
.empty-state p { margin: 0; color: var(--text-muted); font-size: 16px; }

/* Forms */
label { display: grid; gap: 8px; font-size: 14px; font-weight: 500; color: var(--text-main); }
label small { color: var(--text-muted); font-size: 13px; font-weight: 400; }
input, textarea, select {
  width: 100%; border: 1px solid var(--border-light); background: rgba(0,0,0,0.3); border-radius: var(--radius-sm);
  padding: 12px 16px; font: inherit; color: #fff; outline: none; transition: 0.2s; box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary); background: rgba(0,0,0,0.5);
  box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.15);
}
textarea { resize: vertical; }

.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 40px; align-items: start; }
.editor-form { display: grid; gap: 28px; }
.form-section { padding: 28px; background: var(--bg-panel); border: 1px solid var(--border-light); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.form-section > label { margin-top: 24px; }
.form-section > .panel-head + label { margin-top: 0; }
.form-grid { display: grid; gap: 24px; margin-top: 24px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.slug-field {
  display: flex; align-items: center; border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.3); overflow: hidden; transition: 0.2s;
}
.slug-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.15); }
.slug-field span { padding: 14px 0 14px 18px; color: var(--text-muted); font-size: 15px; font-weight: 500; }
.slug-field input { border: 0; background: transparent; box-shadow: none !important; padding-left: 6px; }

.switch-row {
  display: flex; align-items: flex-start; gap: 18px; padding: 24px; border: 1px solid var(--border-light);
  border-radius: var(--radius-md); background: rgba(255,255,255,0.02);
}
.switch-row input { width: 24px; height: 24px; margin-top: 2px; accent-color: var(--primary); cursor: pointer; }
.switch-row span { display: flex; flex-direction: column; gap: 6px; }
.switch-row small { font-size: 14px; color: var(--text-muted); line-height: 1.5; }

.color-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.color-grid input[type=color] { height: 56px; padding: 6px; background: rgba(0,0,0,0.3); cursor: pointer; border-radius: 10px; }

.current-logo { display: flex; align-items: center; gap: 28px; margin-top: 24px; padding: 24px; border: 1px solid var(--border-light); border-radius: var(--radius-md); background: rgba(255,255,255,0.02); }
.current-logo img { width: 140px; height: 70px; object-fit: contain; background: #fff; border-radius: 10px; padding: 12px; }
.current-logo label { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; }
.current-logo input { width: auto; cursor: pointer; }

.sticky-actions {
  position: sticky; bottom: 32px; display: flex; justify-content: flex-end; gap: 16px; padding: 20px 32px;
  background: rgba(17, 17, 22, 0.85); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,0.5); z-index: 5; margin-top: 40px;
}

.preview-column { position: sticky; top: 128px; }
.preview-toolbar { display: flex; justify-content: space-between; align-items: center; margin: 0 4px 16px; }
.preview-toolbar span { font-size: 14px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; }

.phone-frame {
  padding: 14px; background: #000; border-radius: 40px; box-shadow: var(--shadow-lg), inset 0 4px 12px rgba(255,255,255,0.1); border: 3px solid #222;
}
.preview-page {
  --primary: #25d366; --background: #0B0A10; --card: #14131A; --text: #fff;
  min-height: 740px; padding: 28px; display: grid; place-items: center; border-radius: 30px;
  background: var(--background); color: var(--text); overflow: hidden; position: relative;
}
.preview-page::before {
  content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 250px;
  background: linear-gradient(180deg, rgba(37,211,102,0.15), transparent); pointer-events: none;
}
.preview-card {
  width: 100%; padding: 48px 28px; text-align: center; background: var(--card); border-radius: 28px;
  box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,0.08); position: relative; z-index: 1;
}
.preview-icon {
  width: 80px; height: 80px; margin: 0 auto 28px; display: grid; place-items: center; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 36px; font-weight: 900; box-shadow: 0 12px 32px rgba(37,211,102,0.4);
}
.preview-card h2 { font-size: 30px; line-height: 1.2; margin: 0 0 18px; letter-spacing: -0.5px; font-weight: 700; }
.preview-card p { font-size: 16px; line-height: 1.6; margin: 0 0 28px; opacity: 0.8; }
.preview-countdown { display: block; font-size: 15px; margin-bottom: 24px; opacity: 0.6; font-weight: 500; }
.preview-button {
  display: block; padding: 18px; border-radius: 16px; background: var(--primary); color: #fff; font-size: 17px; font-weight: 700;
  text-decoration: none; box-shadow: 0 8px 24px rgba(37,211,102,0.3); transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.preview-button:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(37,211,102,0.5); filter: brightness(1.1); }
.preview-card small { display: block; margin-top: 20px; opacity: 0.5; font-size: 14px; }

.danger-zone {
  display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 28px 32px; margin-top: 40px;
  border: 1px solid rgba(239,68,68,0.3); border-radius: var(--radius-xl); background: rgba(239,68,68,0.06);
}
.danger-zone h3 { margin: 0 0 10px; color: var(--danger); font-size: 20px; font-weight: 700; }
.danger-zone p { margin: 0; color: var(--text-muted); font-size: 15px; }

/* Auth Pages */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg-main); position: relative; overflow: hidden; }
.auth-body::before {
  content: ""; position: absolute; top: -20%; right: -10%; width: 60%; height: 60%;
  background: radial-gradient(circle, rgba(255,107,0,0.1) 0%, transparent 60%); pointer-events: none;
}
.auth-wrap { width: min(100%, 420px); position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 36px; text-decoration: none; color: #fff; }
.auth-brand .brand-mark { width: 56px; height: 56px; font-size: 26px; border-radius: 16px; box-shadow: var(--primary-glow); }
.auth-brand span { font-size: 24px; font-weight: 800; letter-spacing: 0.5px; }

.auth-card { padding: 40px 36px; background: var(--bg-panel); border: 1px solid var(--border-light); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,0.5); display: grid; gap: 24px; }
.auth-heading { text-align: center; margin-bottom: 4px; }
.auth-heading h1 { margin: 0 0 10px; font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.auth-heading p { margin: 0; color: var(--text-muted); font-size: 14px; line-height: 1.5; }

@media(max-width: 1200px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } .editor-grid { grid-template-columns: 1fr; } .preview-column { position: static; max-width: 440px; margin: 40px auto 0; width: 100%; } .preview-page { min-height: 700px; } }
@media(max-width: 820px) { .app-shell { grid-template-columns: 1fr; } .sidebar { position: fixed; left: -300px; width: 280px; transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: var(--shadow-lg); } .sidebar.open { left: 0; } .menu-button { display: block; } .topbar { padding: 0 24px; height: 88px; } .content { padding: 32px 24px; } .form-grid.two, .color-grid { grid-template-columns: 1fr 1fr; } }
@media(max-width: 560px) { .stats-grid { grid-template-columns: 1fr; } .form-grid.two, .color-grid { grid-template-columns: 1fr; } .sticky-actions { flex-wrap: wrap; } .sticky-actions .button { flex: 1; justify-content: center; } .danger-zone { align-items: flex-start; flex-direction: column; gap: 16px; } .topbar h1 { font-size: 24px; } .content { padding: 24px 16px; } .form-section { padding: 24px; } .auth-card { padding: 36px 24px; } .panel-head { padding: 24px; flex-direction: column; align-items: flex-start; gap: 16px; } }
