/* =============================================
   PINAKRA ADMAN — Global Stylesheet
   Ready for backend integration
   ============================================= */

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

/* ── Variables ── */
:root {
  --sidebar-bg: #0f172a;
  --sidebar-width: 248px;
  --sidebar-collapsed: 72px;

  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #eef2ff;

  --success: #10b981;
  --success-light: #d1fae5;
  --success-text: #065f46;

  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --warning-text: #92400e;

  --danger: #ef4444;
  --danger-light: #fee2e2;
  --danger-text: #991b1b;

  --info: #3b82f6;
  --info-light: #dbeafe;
  --info-text: #1e40af;

  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --border-focus: #6366f1;

  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --transition: 150ms ease;
  --transition-slow: 300ms ease;

  --header-height: 64px;
}

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

html { font-size: 14px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* =============================================
   LAYOUT
   ============================================= */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
}

.page-content {
  flex: 1;
  padding: 24px;
  padding-top: calc(var(--header-height) + 24px);
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--transition-slow), transform var(--transition-slow);
  overflow: hidden;
}

.sidebar-header {
  padding: 0 16px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.logo-text {
  font-size: 15px;
  color: #e2e8f0;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.logo-text strong {
  color: #ffffff;
  font-weight: 700;
}

.sidebar-section-label {
  padding: 20px 16px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin: 2px 8px;
  border-radius: var(--radius);
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
}

.nav-item.active {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}

.nav-icon svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 8px 16px;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
  transition: background var(--transition);
  cursor: pointer;
}

.user-card:hover { background: rgba(255,255,255,0.06); }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), #818cf8);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }

.user-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.user-role {
  display: block;
  font-size: 11px;
  color: #64748b;
}

.logout-btn {
  background: none; border: none;
  color: #64748b;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: color var(--transition), background var(--transition);
}

.logout-btn:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

.logout-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

/* =============================================
   TOP HEADER
   ============================================= */
.top-header {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  height: var(--header-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 90;
  transition: left var(--transition-slow);
}

.header-left { display: flex; align-items: center; gap: 12px; flex: 1; }

.page-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.breadcrumb span:last-child { color: var(--text-secondary); font-weight: 500; }

.breadcrumb-sep { color: var(--border); }

.header-right { display: flex; align-items: center; gap: 8px; }

.header-btn {
  width: 36px; height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  position: relative;
  transition: all var(--transition);
}

.header-btn:hover { background: var(--bg); color: var(--text-primary); }

.header-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.75; }

.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 1.5px solid var(--card-bg);
}

.hamburger-btn {
  display: none;
  width: 36px; height: 36px;
  background: none; border: none;
  align-items: center; justify-content: center;
  color: var(--text-secondary);
}

.hamburger-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }

/* =============================================
   CARDS
   ============================================= */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.card-body { padding: 20px; }

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #fafafa;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Summary Metric Cards ── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}

.metric-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.metric-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.metric-card.spend::after { background: linear-gradient(90deg, var(--info), #60a5fa); }
.metric-card.sales::after { background: linear-gradient(90deg, var(--success), #34d399); }
.metric-card.acos::after  { background: linear-gradient(90deg, var(--warning), #fcd34d); }
.metric-card.active::after { background: linear-gradient(90deg, var(--accent), #818cf8); }

.metric-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}

.metric-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.75; }
.metric-icon.spend  { background: var(--info-light); color: var(--info); }
.metric-icon.sales  { background: var(--success-light); color: var(--success); }
.metric-icon.acos   { background: var(--warning-light); color: var(--warning); }
.metric-icon.active { background: var(--accent-light); color: var(--accent); }

.metric-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.metric-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.metric-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  margin-top: 8px;
}

.metric-change.up { background: var(--success-light); color: var(--success-text); }
.metric-change.down { background: var(--danger-light); color: var(--danger-text); }
.metric-change svg { width: 12px; height: 12px; }

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}

.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0 0 3px rgba(99,102,241,0.2); }

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

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #059669; }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; }

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

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-sm svg { width: 13px; height: 13px; }

.btn-lg {
  padding: 11px 20px;
  font-size: 14px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

/* =============================================
   TABLES
   ============================================= */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

thead th:first-child { border-radius: var(--radius-lg) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius-lg) 0 0; }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fafafa; }

tbody td {
  padding: 12px 14px;
  color: var(--text-primary);
  vertical-align: middle;
}

.td-muted { color: var(--text-secondary); font-size: 12px; }

.col-actions { width: 1px; white-space: nowrap; }

.action-group { display: flex; gap: 4px; align-items: center; }

/* ── Heatmap Cell Colors ── */
.cell-good    { background: #dcfce7; color: #166534; font-weight: 600; border-radius: var(--radius-sm); padding: 2px 8px; display: inline-block; }
.cell-okay    { background: #fef9c3; color: #713f12; font-weight: 600; border-radius: var(--radius-sm); padding: 2px 8px; display: inline-block; }
.cell-bad     { background: #fee2e2; color: #991b1b; font-weight: 600; border-radius: var(--radius-sm); padding: 2px 8px; display: inline-block; }
.cell-neutral { background: var(--bg); color: var(--text-secondary); font-weight: 500; border-radius: var(--radius-sm); padding: 2px 8px; display: inline-block; }

/* =============================================
   BADGES & STATUS
   ============================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-success { background: var(--success-light); color: var(--success-text); }
.badge-success .badge-dot { background: var(--success); }

.badge-warning { background: var(--warning-light); color: var(--warning-text); }
.badge-warning .badge-dot { background: var(--warning); }

.badge-danger  { background: var(--danger-light);  color: var(--danger-text); }
.badge-danger .badge-dot  { background: var(--danger); }

.badge-info    { background: var(--info-light);    color: var(--info-text); }
.badge-info .badge-dot    { background: var(--info); }

.badge-neutral { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-accent  { background: var(--accent-light); color: var(--accent); }

/* =============================================
   FORMS
   ============================================= */
.form-group { margin-bottom: 16px; }

.form-row {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}

.form-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 32px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 11px;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}

.form-error.show { display: block; }

.input-group {
  display: flex;
  align-items: center;
}

.input-group .input-prefix,
.input-group .input-suffix {
  padding: 9px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.input-group .input-prefix { border-right: none; border-radius: var(--radius) 0 0 var(--radius); }
.input-group .input-suffix { border-left: none; border-radius: 0 var(--radius) var(--radius) 0; }
.input-group input { border-radius: 0; flex: 1; }
.input-group input:focus { z-index: 1; }

/* Radio / Checkbox styled cards */
.option-cards {
  display: grid;
  gap: 10px;
}

.option-cards.cols-2 { grid-template-columns: 1fr 1fr; }
.option-cards.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.option-cards.cols-4 { grid-template-columns: repeat(4, 1fr); }

.option-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.option-card:hover { border-color: #818cf8; background: var(--accent-light); }

.option-card input[type="radio"] { display: none; }

.option-card.selected,
.option-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-light);
}

.option-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.option-card-desc {
  font-size: 11px;
  color: var(--text-secondary);
}

/* =============================================
   FILTERS BAR
   ============================================= */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-item { min-width: 140px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  flex: 1;
  max-width: 300px;
}

.search-box svg { width: 16px; height: 16px; stroke: var(--text-muted); fill: none; stroke-width: 2; flex-shrink: 0; }

.search-box input {
  border: none;
  background: none;
  padding: 0;
  font-size: 13px;
  outline: none;
  width: 100%;
}

.search-box input::placeholder { color: var(--text-muted); }

/* =============================================
   PAGE HEADER
   ============================================= */
.page-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.page-header-left { flex: 1; }

.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.page-header-actions { display: flex; gap: 8px; align-items: center; }

/* =============================================
   WIZARD
   ============================================= */
.wizard-wrapper {
  max-width: 720px;
  margin: 0 auto;
}

.wizard-steps {
  display: flex;
  align-items: center;
  margin-bottom: 32px;
  position: relative;
}

.wizard-steps::before {
  content: '';
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.wizard-progress {
  position: absolute;
  top: 18px;
  left: 18px;
  height: 2px;
  background: var(--accent);
  z-index: 1;
  transition: width var(--transition-slow);
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  position: relative;
  z-index: 2;
}

.step-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--card-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-slow);
}

.step-item.active .step-circle {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.step-item.done .step-circle {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.step-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

.step-item.active .step-label { color: var(--accent); font-weight: 600; }
.step-item.done .step-label { color: var(--success); }

.wizard-body { position: relative; }

.wizard-panel {
  display: none;
}

.wizard-panel.active { display: block; }

.wizard-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-md);
}

.wizard-card h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.wizard-card .step-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* =============================================
   KEYWORDS
   ============================================= */
.keywords-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.keyword-column {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.keyword-column-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.keyword-col-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.keyword-count {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.keyword-color-bar {
  height: 3px;
}

.category .keyword-color-bar { background: var(--accent); }
.self .keyword-color-bar { background: var(--success); }
.competitor .keyword-color-bar { background: var(--danger); }

.keyword-list {
  padding: 12px;
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
}

.keyword-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-primary);
  transition: all var(--transition);
}

.keyword-tag:hover { border-color: #cbd5e1; }

.keyword-tag-delete {
  background: none;
  border: none;
  padding: 0;
  width: 14px; height: 14px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  transition: all var(--transition);
}

.keyword-tag-delete:hover { background: var(--danger-light); color: var(--danger); }

.category .keyword-tag { background: var(--accent-light); border-color: #c7d2fe; color: #4338ca; }
.self .keyword-tag { background: var(--success-light); border-color: #a7f3d0; color: #065f46; }
.competitor .keyword-tag { background: var(--danger-light); border-color: #fecaca; color: #991b1b; }

.keyword-add-row {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 6px;
}

.keyword-add-row input {
  flex: 1;
  padding: 7px 10px;
  font-size: 12px;
}

/* =============================================
   MODAL
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  transform: translateY(12px) scale(0.98);
  transition: transform var(--transition-slow);
}

.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-lg { width: 640px; }

.modal-header {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.modal-close {
  width: 28px; height: 28px;
  background: var(--bg);
  border: none;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  transition: all var(--transition);
}

.modal-close:hover { background: var(--danger-light); color: var(--danger); }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 280px;
  max-width: 360px;
  animation: toastIn 0.3s ease;
}

.toast.removing { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

.toast-icon {
  width: 28px; height: 28px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.success .toast-icon { background: var(--success-light); color: var(--success); }

.toast.error { border-left: 3px solid var(--danger); }
.toast.error .toast-icon { background: var(--danger-light); color: var(--danger); }

.toast.warning { border-left: 3px solid var(--warning); }
.toast.warning .toast-icon { background: var(--warning-light); color: var(--warning); }

.toast.info { border-left: 3px solid var(--info); }
.toast.info .toast-icon { background: var(--info-light); color: var(--info); }

.toast-msg { flex: 1; }
.toast-close { color: var(--text-muted); background: none; border: none; font-size: 16px; cursor: pointer; padding: 0 2px; }
.toast-close:hover { color: var(--text-primary); }

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

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

.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(99,102,241,0.1) 0%, transparent 70%);
  bottom: -50px; right: -50px;
  pointer-events: none;
}

.login-card {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 420px;
  max-width: 100%;
  box-shadow: 0 25px 50px rgba(0,0,0,0.4);
  position: relative;
  z-index: 1;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  justify-content: center;
}

.login-logo .logo-icon {
  width: 44px; height: 44px;
  font-size: 22px;
}

.login-logo .logo-text {
  font-size: 18px;
  color: var(--text-primary);
}

.login-logo .logo-text strong { color: var(--accent); }

.login-tagline {
  text-align: center;
  margin-bottom: 28px;
}

.login-tagline h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-tagline p {
  font-size: 13px;
  color: var(--text-secondary);
}

.login-card .form-group label {
  color: var(--text-secondary);
}

.login-btn {
  width: 100%;
  justify-content: center;
  padding: 11px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 8px;
}

.login-demo-note {
  margin-top: 20px;
  padding: 12px;
  background: var(--accent-light);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius);
  font-size: 12px;
  color: #4338ca;
  text-align: center;
  line-height: 1.6;
}

/* =============================================
   CAMPAIGN DETAIL
   ============================================= */
.campaign-hero {
  background: linear-gradient(135deg, var(--sidebar-bg), #1e293b);
  border-radius: var(--radius-xl);
  padding: 24px;
  color: #fff;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.campaign-hero-icon {
  width: 52px; height: 52px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.campaign-hero-info { flex: 1; }

.campaign-hero-info h1 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.campaign-hero-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  flex-wrap: wrap;
}

.campaign-hero-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.campaign-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.campaign-stat {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}

.campaign-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.campaign-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

/* =============================================
   LOGS PAGE
   ============================================= */
.log-type-icon {
  width: 28px; height: 28px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.log-success { background: var(--success-light); }
.log-warning { background: var(--warning-light); }
.log-info    { background: var(--info-light); }
.log-error   { background: var(--danger-light); }

/* =============================================
   EMPTY STATES
   ============================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 280px;
  margin-bottom: 20px;
}

/* =============================================
   PERFORMANCE BARS
   ============================================= */
.perf-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.perf-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.perf-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.perf-bar-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); min-width: 32px; text-align: right; }

/* =============================================
   OVERLAY / BACKDROP
   ============================================= */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* =============================================
   ASIN SUGGESTION CARDS
   ============================================= */
.asin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.asin-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.asin-card:hover { border-color: var(--accent); background: var(--accent-light); }
.asin-card.selected { border-color: var(--accent); background: var(--accent-light); }

.asin-code {
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.asin-name { font-size: 12px; font-weight: 500; color: var(--text-primary); }
.asin-category { font-size: 11px; color: var(--text-muted); }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
  .keywords-grid { grid-template-columns: 1fr 1fr; }
  .option-cards.cols-4 { grid-template-columns: 1fr 1fr; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  .sidebar {
    width: 248px;
    transform: translateX(-100%);
  }

  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-overlay { display: block; opacity: 0; pointer-events: none; transition: opacity var(--transition-slow); }
  .sidebar-overlay.active { opacity: 1; pointer-events: all; }

  .main-content { margin-left: 0; }
  .top-header { left: 0; }
  .hamburger-btn { display: flex; }

  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .keywords-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
  .option-cards.cols-2 { grid-template-columns: 1fr; }
  .option-cards.cols-3 { grid-template-columns: 1fr; }
  .option-cards.cols-4 { grid-template-columns: 1fr 1fr; }
  .campaign-stats-row { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; }
  .login-card { padding: 28px 20px; }
  .wizard-steps { overflow-x: auto; }
}

@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .page-content { padding: 16px; padding-top: calc(var(--header-height) + 16px); }
  .campaign-hero { flex-direction: column; text-align: center; }
}

/* =============================================
   UTILITIES
   ============================================= */
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info    { color: var(--info); }
.text-muted   { color: var(--text-muted); }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-1 { flex: 1; }

.hidden { display: none !important; }
