/* Auth screen */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f5f5f5;
}

/* Layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: 200px;
  background: #1a1a2e;
  color: #e0e0e0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 16px 20px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid #2a2a4a;
}

.sidebar-menu {
  list-style: none;
  padding: 8px 0;
  margin: 0;
  flex: 1;
}

.sidebar-menu li a {
  display: block;
  padding: 10px 20px;
  color: #a0a0b8;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.sidebar-menu li a:hover {
  background: #2a2a4a;
  color: #fff;
}

.sidebar-menu li a.is-active {
  background: #2a2a4a;
  color: #fff;
  border-left: 3px solid #3273dc;
  padding-left: 17px;
}

/* Sidebar submenu — Bulma menu-list with dark overrides */
.sidebar-menu .menu-list {
  border-left: 1px solid #2a2a4a;
  margin-left: 20px;
}

.sidebar-menu .menu-list a {
  color: #8888a8;
  background: transparent;
  font-size: 13px;
  padding: 6px 12px;
}

.sidebar-menu .menu-list a:hover {
  background: transparent;
  color: #c0c0d8;
}

.sidebar-menu .menu-list a.is-active {
  background: transparent;
  color: #fff;
  border-left: 2px solid #3273dc;
  margin-left: -1px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid #2a2a4a;
}

.sidebar-footer a {
  cursor: pointer;
  font-size: 13px;
}

/* Main content */
.admin-main {
  flex: 1;
  padding: 24px 32px;
  background: #f8f9fa;
  overflow-y: auto;
}

/* Dashboard stat cards */
.stat-card {
  text-align: center;
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 13px;
  color: #7a7a7a;
  margin-top: 4px;
}

/* Status tags */
.tag-draft { background: #f5f5f5; color: #4a4a4a; }
.tag-scheduled { background: #eff8ff; color: #3273dc; }
.tag-active { background: #effaf5; color: #48c78e; }
.tag-paused { background: #fffaeb; color: #946c00; }
.tag-completed { background: #f5f5f5; color: #7a7a7a; }
.tag-failed { background: #feecf0; color: #f14668; }
.tag-running { background: #eff8ff; color: #3273dc; }
.tag-cancelled { background: #f5f5f5; color: #7a7a7a; }

/* Sortable table headers */
.th-sortable { cursor: pointer; user-select: none; }
.th-sortable:hover { color: #3273dc; }
.sort-arrow { font-size: 10px; margin-left: 2px; }

/* Tables */
.table th {
  white-space: nowrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #7a7a7a;
}

.table td {
  vertical-align: middle;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: #f0f4ff;
}

/* Loading */
.loading-block {
  text-align: center;
  padding: 48px;
  color: #b5b5b5;
}

/* Detail sections */
.detail-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 16px;
  font-size: 14px;
}

.detail-grid dt {
  color: #7a7a7a;
  font-weight: 500;
}

.detail-grid dd {
  margin: 0;
  word-break: break-word;
}

/* Images */
.preview-image {
  max-width: 100%;
  border-radius: 4px;
}

.detail-image {
  max-width: 300px;
  border-radius: 4px;
}

/* Auth */
.auth-box {
  width: 360px;
}

/* AI section — prompt text */
.ai-prompt-text {
  background: #1a1a2e;
  color: #e0e0e0;
  padding: 16px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 500px;
  overflow-y: auto;
}

.ai-prompt-textarea {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
}

/* AI model tag */
.ai-model-tag {
  display: inline-block;
  font-size: 11px;
  font-family: monospace;
  background: #f0f0f0;
  border-radius: 3px;
  padding: 1px 6px;
  color: #555;
}

/* AI chat messages */
.ai-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-chat-msg {
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
}

.ai-chat-system {
  background: #f5f5f5;
  border-left: 3px solid #b5b5b5;
}

.ai-chat-user {
  background: #eff8ff;
  border-left: 3px solid #3273dc;
}

.ai-chat-assistant {
  background: #effaf5;
  border-left: 3px solid #48c78e;
}

.ai-chat-role {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  color: #7a7a7a;
  margin-bottom: 4px;
}

.ai-chat-content {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  margin: 0;
  background: transparent;
  padding: 0;
}

/* AI log detail (expanded row) */
.ai-log-detail {
  background: #fafafa;
  padding: 16px !important;
}

/* AI daily chart */
.ai-daily-chart {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ai-daily-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.ai-daily-date {
  width: 80px;
  text-align: right;
  color: #7a7a7a;
  flex-shrink: 0;
}

.ai-daily-bar-wrap {
  flex: 1;
  background: #f0f0f0;
  border-radius: 2px;
  height: 16px;
}

.ai-daily-bar {
  height: 100%;
  background: #3273dc;
  border-radius: 2px;
  min-width: 2px;
}

.ai-daily-value {
  width: 120px;
  font-size: 11px;
  color: #7a7a7a;
  flex-shrink: 0;
}

/* AI collapsible */
.ai-collapsible {
  cursor: pointer;
  font-weight: 600;
  color: #3273dc;
  user-select: none;
}

.ai-collapsible:hover {
  text-decoration: underline;
}

/* Campaign daily chart */
.campaign-daily-chart {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.campaign-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.campaign-bar-date {
  width: 50px;
  text-align: right;
  color: #7a7a7a;
  flex-shrink: 0;
}

.campaign-bar-wrap {
  flex: 1;
  background: #f0f0f0;
  border-radius: 2px;
  height: 16px;
}

.campaign-bar {
  height: 100%;
  background: #3273dc;
  border-radius: 2px;
  min-width: 2px;
}

.campaign-bar-value {
  width: 40px;
  font-size: 11px;
  color: #7a7a7a;
  flex-shrink: 0;
}

/* Funnel chart */
.funnel-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.funnel-step-label {
  display: flex;
  align-items: baseline;
  margin-bottom: 4px;
  font-size: 13px;
}

.funnel-step-left {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.funnel-step-name {
  font-weight: 600;
  white-space: nowrap;
}

.funnel-step-right {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 12px;
}

.funnel-step-count {
  font-weight: 700;
  min-width: 40px;
  text-align: right;
}

.funnel-step-pct {
  color: #7a7a7a;
  min-width: 48px;
  text-align: right;
}

.funnel-step-drop {
  font-size: 11px;
  min-width: 42px;
  text-align: right;
}

.funnel-bar-wrap {
  background: #f0f0f0;
  border-radius: 3px;
  height: 22px;
}

.funnel-bar {
  height: 100%;
  background: #3273dc;
  border-radius: 3px;
  min-width: 3px;
  transition: width 0.3s ease;
}

.funnel-bar.is-negative {
  background: #f14668;
}

/* Cost tab — day separator rows */
.cost-day-separator {
  background: #f0f4ff !important;
  border-top: 2px solid #dde4f0;
}

.cost-day-separator td {
  padding: 6px 12px !important;
  font-size: 13px;
}

/* Cost tab — row color coding */
.cost-row-high {
  background: #fff0f0 !important;
}

.cost-row-medium {
  background: #fffbeb !important;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-layout {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .sidebar-brand {
    border-bottom: none;
    padding: 10px 16px;
    white-space: nowrap;
  }

  .sidebar-menu {
    display: flex;
    padding: 0;
  }

  .sidebar-menu li a {
    padding: 10px 14px;
    white-space: nowrap;
  }

  .sidebar-menu li a.is-active {
    border-left: none;
    border-bottom: 3px solid #3273dc;
    padding-left: 14px;
  }

  .sidebar-menu .menu-list {
    display: none;
  }

  .sidebar-footer {
    border-top: none;
    padding: 10px 16px;
    border-left: 1px solid #2a2a4a;
  }

  .admin-main {
    padding: 16px;
  }
}
