/**
 * ppc-budget-optimizer/index.html — Page-specific styles
 * Extracted from inline <style> blocks.
 * Generic components use shared/styles/components.css.
 */

/* ── Tab navigation ──────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 0;
  overflow-x: auto;
  margin-bottom: 28px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
}
.tab-btn {
  padding: 10px 20px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-dim);
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 8px;
  white-space: nowrap;
  transition: all 0.2s;
}
.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}
.tab-btn.active {
  color: #f59e0b;
  font-weight: 600;
  background: rgba(245, 158, 11, 0.1);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.15);
}
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* ── Client / Account selector bar ────────────────────── */
.selector-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
}
.selector-bar label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.selector-bar .form-select {
  flex: 1;
  max-width: 320px;
}
.selector-divider {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .selector-bar {
    flex-wrap: wrap;
  }
  .selector-divider {
    display: none;
  }
  .selector-bar .form-select {
    max-width: none;
  }
}

/* ── Cards (surface-raised) ────────────────────────────── */
.config-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}
.config-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.config-card-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 16px;
  background: linear-gradient(180deg, #f59e0b, #ef4444);
  border-radius: 2px;
  flex-shrink: 0;
}
.config-card-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-left: 13px;
}

/* ── Section dividers ──────────────────────────────────── */
.section-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin: 20px 0;
}
.section-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label::before {
  content: '';
  width: 2px;
  height: 12px;
  background: rgba(245, 158, 11, 0.5);
  border-radius: 1px;
}

/* ── Data table ──────────────────────────────────────── */
.data-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.015);
}
.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  vertical-align: middle;
}
.data-table tr:hover td {
  background: rgba(245, 158, 11, 0.03);
}
.data-table .btn-rm {
  background: none;
  border: none;
  color: var(--accent-danger);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}
.data-table .btn-rm:hover {
  background: rgba(239, 68, 68, 0.12);
}
.data-table input,
.data-table select {
  padding: 6px 10px;
  font-size: 0.82rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: var(--text-primary);
  transition: border-color 0.2s;
}
.data-table input:focus,
.data-table select:focus {
  outline: none;
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.1);
}

/* ── Inline add row ──────────────────────────────────── */
.inline-add {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.inline-add .form-input,
.inline-add .form-select {
  padding: 8px 10px;
  font-size: 0.82rem;
}

/* ── Two-column grid ─────────────────────────────────── */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 700px) {
  .config-grid {
    grid-template-columns: 1fr;
  }
}
.config-grid .full {
  grid-column: 1/-1;
}

/* ── Three-column grid ───────────────────────────────── */
.config-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
@media (max-width: 800px) {
  .config-grid-3 {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 500px) {
  .config-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ── Phase selector ──────────────────────────────────── */
.phase-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.phase-btn {
  padding: 14px 22px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.25s;
  text-align: center;
  min-width: 120px;
}
.phase-btn:hover {
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--text-primary);
  background: rgba(245, 158, 11, 0.04);
}
.phase-btn.active {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.08);
  color: #f59e0b;
  box-shadow:
    0 0 20px rgba(245, 158, 11, 0.15),
    inset 0 0 20px rgba(245, 158, 11, 0.03);
}
.phase-btn .phase-sub {
  font-size: 0.72rem;
  font-weight: 400;
  opacity: 0.7;
  display: block;
  margin-top: 2px;
}
.phase-btn.active .phase-sub {
  opacity: 1;
}
.phase-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.015);
  border-radius: 8px;
  border-left: 2px solid rgba(245, 158, 11, 0.3);
}

/* ── Allocation output ───────────────────────────────── */
.alloc-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.alloc-stat {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 16px 18px;
  border-left: 3px solid rgba(255, 255, 255, 0.1);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.alloc-stat:hover {
  border-left-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.alloc-stat.stat-orange {
  border-left-color: #f59e0b;
}
.alloc-stat.stat-blue {
  border-left-color: #3b82f6;
}
.alloc-stat.stat-green {
  border-left-color: #22c55e;
}
.alloc-stat.stat-default {
  border-left-color: rgba(255, 255, 255, 0.15);
}
.alloc-stat.stat-red {
  border-left-color: #ef4444;
}
.alloc-stat-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
}
.alloc-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.alloc-stat-value.green {
  color: var(--accent-success);
}
.alloc-stat-value.red {
  color: var(--accent-danger);
}
.alloc-stat-value.blue {
  color: var(--accent-info);
}
.alloc-stat-value.orange {
  color: #f59e0b;
}
.alloc-stat-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ── Scorecard tier colors ───────────────────────────── */
.tier-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
}
.tier-badge.rank-1 {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-success);
}
.tier-badge.rank-2 {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-info);
}
.tier-badge.rank-3 {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-warning);
}
.tier-badge.rank-4 {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
}
.tier-badge.rank-5,
.tier-badge.rank-default {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.rec-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.68rem;
  font-weight: 600;
}
.rec-badge.increase {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-success);
}
.rec-badge.hold {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-info);
}
.rec-badge.decrease {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-warning);
}
.rec-badge.pause {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
}

/* ── Service weights editor ───────────────────────────── */
.weight-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 0;
  transition: background 0.15s;
}
.weight-row:last-child {
  border-bottom: none;
}
.weight-row:hover {
  background: rgba(255, 255, 255, 0.02);
}
.weight-label {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.weight-input {
  width: 70px;
  text-align: right;
}
.weight-pct {
  font-size: 0.78rem;
  color: var(--text-dim);
  width: 30px;
}

/* ── Status badges ───────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.status-badge.active {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-success);
}
.status-badge.paused {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-warning);
}

/* ── Run section ─────────────────────────────────────── */
.run-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 24px 28px;
}
.btn-run {
  padding: 12px 28px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  color: #fff;
  transition: all 0.25s;
  position: relative;
}
.btn-run:hover {
  transform: translateY(-1px);
}
.btn-run:active {
  transform: translateY(0);
}
.btn-run:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.btn-run.primary {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
}
.btn-run.primary:hover:not(:disabled) {
  box-shadow: 0 6px 28px rgba(245, 158, 11, 0.45);
}
.btn-run.secondary {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.25);
}
.btn-run.secondary:hover:not(:disabled) {
  box-shadow: 0 6px 28px rgba(99, 102, 241, 0.4);
}

/* ── Activity log ────────────────────────────────────── */
.activity-log {
  max-height: 220px;
  overflow-y: auto;
  font-size: 0.78rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 4px;
}
.log-entry {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
}
.log-entry:last-child {
  border-bottom: none;
}
.log-entry:hover {
  background: rgba(255, 255, 255, 0.02);
}
.log-time {
  font-size: 0.68rem;
  color: var(--text-dim);
  flex-shrink: 0;
  width: 62px;
  font-family: monospace;
}
.log-lvl {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 9999px;
  flex-shrink: 0;
  font-weight: 600;
}
.log-lvl.info {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}
.log-lvl.success {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}
.log-lvl.error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}
.log-msg {
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Empty states ────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-dim);
  font-size: 0.82rem;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.01);
}
.empty-state .empty-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.4;
}

/* ── Settings toggle ─────────────────────────────────── */
.settings-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 14px 0;
  user-select: none;
}
.settings-toggle .chevron {
  transition: transform 0.2s;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.settings-toggle .chevron.open {
  transform: rotate(90deg);
}
.settings-body {
  display: none;
}
.settings-body.open {
  display: block;
}

/* ── Header icon badge ────────────────────────────────── */
.header-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
  flex-shrink: 0;
}
.header-icon-badge svg {
  width: 20px;
  height: 20px;
  color: #fff;
}
.header-tag {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 9999px;
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* ── Save actions bar ─────────────────────────────────── */
.save-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-top: 8px;
}
