/**
 * OpenSEO Frontend Prototype - Complete Stylesheet
 * 純原生 CSS，無任何外部字型、CDN 或相依。
 */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-sub: #334155;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --success-border: #bbf7d0;
  --info: #0284c7;
  --info-light: #f0f9ff;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Header & App Shell
   ========================================================================== */
.app-header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-top {
  max-width: 1360px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

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

.brand-logo-badge {
  background: linear-gradient(135deg, #1e40af, #2563eb);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

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

.status-badge {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-offline {
  background-color: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.badge-mock {
  background-color: var(--warning-light);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

/* ==========================================================================
   Navigation Tabs
   ========================================================================== */
.header-nav {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  border-top: 1px solid var(--border-color);
}

.nav-tab-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 12px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-tab-btn:hover {
  color: var(--primary);
  background-color: #f1f5f9;
}

.nav-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background-color: var(--primary-light);
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.app-container {
  max-width: 1360px;
  margin: 24px auto;
  padding: 0 24px 60px 24px;
}

.tab-content-panel {
  display: none;
}

.tab-content-panel.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Disclaimer Banners
   ========================================================================== */
.disclaimer-banner {
  background-color: var(--warning-light);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.disclaimer-banner svg {
  flex-shrink: 0;
  color: var(--warning);
  margin-top: 2px;
}

.disclaimer-title {
  font-weight: 700;
  font-size: 14px;
  color: #92400e;
  margin-bottom: 2px;
}

.disclaimer-desc {
  font-size: 13px;
  color: #b45309;
  line-height: 1.45;
}

/* ==========================================================================
   Dashboard Widgets & KPI
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 8px;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.dashboard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .dashboard-row {
    grid-template-columns: 1fr;
  }
}

.panel-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.panel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.panel-card-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Distribution Bars */
.dist-row {
  margin-bottom: 12px;
}

.dist-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}

.dist-bar-track {
  width: 100%;
  height: 8px;
  background-color: #f1f5f9;
  border-radius: 9999px;
  overflow: hidden;
}

.dist-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.cluster-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

/* Search Intent Cards */
.intent-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.intent-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  background-color: #fafbfc;
}

.intent-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Recent Audits List */
.recent-audit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
  gap: 12px;
}

.recent-audit-item:last-child {
  border-bottom: none;
}

.audit-score-badge {
  font-weight: 800;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  min-width: 54px;
  text-align: center;
}

.score-high {
  background-color: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.score-med {
  background-color: var(--warning-light);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.score-low {
  background-color: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.audit-info {
  flex: 1;
}

.audit-title {
  font-size: 14px;
  font-weight: 600;
  display: block;
}

.audit-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.audit-counts {
  display: flex;
  gap: 6px;
  font-size: 12px;
}

/* ==========================================================================
   Keywords Table & Toolbar
   ========================================================================== */
.toolbar-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.toolbar-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.toolbar-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.search-input-box {
  position: relative;
  min-width: 260px;
  flex: 1;
}

.search-input-box input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.search-input-box input:focus {
  border-color: var(--border-focus);
}

.search-input-box svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.filter-select {
  padding: 7px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  background-color: #fff;
  color: var(--text-main);
  outline: none;
}

.filter-select:focus {
  border-color: var(--border-focus);
}

/* Batch Action Bar */
.batch-actions-bar {
  background-color: #1e293b;
  color: #fff;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  animation: slideDown 0.2s ease-in-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.batch-buttons {
  display: flex;
  gap: 8px;
}

/* Data Table */
.table-wrapper {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background-color: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  user-select: none;
}

.th-sortable {
  cursor: pointer;
}

.th-sortable:hover {
  background-color: #f1f5f9;
  color: var(--primary);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.data-table tr:hover {
  background-color: #f8fafc;
}

.data-table tr.row-selected {
  background-color: #eff6ff;
}

.col-checkbox {
  width: 36px;
  text-align: center;
}

.cluster-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
}

.intent-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}

.intent-資訊型 { background-color: #dbeafe; color: #1d4ed8; }
.intent-商業調查型 { background-color: #f3e8ff; color: #7e22ce; }
.intent-交易型 { background-color: #dcfce7; color: #15803d; }
.intent-導航型 { background-color: #ffedd5; color: #c2410c; }

.priority-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
}

.priority-高 { background-color: #fee2e2; color: #b91c1c; }
.priority-中 { background-color: #fef3c7; color: #b45309; }
.priority-低 { background-color: #f1f5f9; color: #475569; }

.diff-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.diff-bar-bg {
  flex: 1;
  height: 6px;
  background-color: #e2e8f0;
  border-radius: 9999px;
  min-width: 60px;
  overflow: hidden;
}

.diff-bar-fill {
  height: 100%;
}

.diff-easy { background-color: #22c55e; }
.diff-med { background-color: #f59e0b; }
.diff-hard { background-color: #ef4444; }

.diff-val {
  font-size: 12px;
  font-weight: 700;
  width: 24px;
  text-align: right;
}

.simulated-tag {
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 3px;
  background-color: #f1f5f9;
  color: var(--text-muted);
  border: 1px solid #e2e8f0;
  margin-left: 4px;
  vertical-align: middle;
}

/* Pagination */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
  font-size: 13px;
}

/* Empty State */
.empty-table-cell {
  padding: 48px 16px !important;
  text-align: center;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.empty-state span {
  font-size: 13px;
}

/* ==========================================================================
   Buttons & Form Controls
   ========================================================================== */
.btn-primary {
  background-color: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.15s ease;
}

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

.btn-secondary {
  background-color: #fff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

.btn-danger {
  background-color: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-danger:hover {
  background-color: #b91c1c;
}

.btn-subtle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-main);
}

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

.btn-subtle-sm {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-main);
}

.btn-subtle-sm:hover {
  background-color: #f1f5f9;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background-color: #f1f5f9;
  color: var(--text-main);
}

/* ==========================================================================
   SEO Checker View
   ========================================================================== */
.seo-input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 860px) {
  .seo-input-grid {
    grid-template-columns: 1fr;
  }
}

.dropzone-box {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  background-color: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.dropzone-box:hover, .dropzone-box.dropzone-active {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.dropzone-icon {
  color: var(--primary);
}

.dropzone-title {
  font-size: 15px;
  font-weight: 700;
}

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

.textarea-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.code-textarea {
  width: 100%;
  height: 190px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  resize: vertical;
  background-color: #fff;
  line-height: 1.4;
}

.code-textarea:focus {
  border-color: var(--border-focus);
}

.seo-options-bar {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.seo-kw-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 260px;
}

.seo-kw-input-wrap input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
}

.demo-buttons-group {
  display: flex;
  gap: 8px;
}

/* Results Score Card */
.score-summary-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.score-main-display {
  display: flex;
  align-items: center;
  gap: 20px;
}

.score-circle {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.score-number {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.score-unit {
  font-size: 11px;
  opacity: 0.85;
}

.grade-badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.grade-A { background-color: var(--success-light); color: var(--success); border: 1px solid var(--success-border); }
.grade-B { background-color: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.grade-C { background-color: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-border); }
.grade-D { background-color: var(--danger-light); color: var(--danger); border: 1px solid var(--danger-border); }

.issue-counts-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.issue-count-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

/* Issues Breakdown List */
.issues-category-section {
  margin-bottom: 24px;
}

.category-title-header {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.issue-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 10px;
}

.issue-critical {
  border-left: 4px solid var(--danger);
  background-color: #fffafa;
}

.issue-warning {
  border-left: 4px solid var(--warning);
  background-color: #fffdf5;
}

.issue-passed {
  border-left: 4px solid var(--success);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}

.issue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.issue-tag-cat {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: #f1f5f9;
  color: var(--text-muted);
}

.issue-title {
  font-size: 14px;
  flex: 1;
}

.issue-penalty-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--danger);
}

.issue-hint {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 4px;
}

.passed-notice {
  padding: 16px;
  background-color: var(--success-light);
  border: 1px solid var(--success-border);
  color: var(--success);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
}

/* Extracted Metadata Grid */
.meta-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  font-size: 13px;
}

@media (max-width: 800px) {
  .meta-preview-grid {
    grid-template-columns: 1fr;
  }
}

.meta-item {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.meta-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
  display: block;
}

.meta-val {
  color: var(--text-main);
  word-break: break-all;
}

/* ==========================================================================
   Data Management & Backup Tab
   ========================================================================== */
.data-mgmt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
}

.danger-zone {
  border-color: var(--danger-border);
  background-color: #fffafa;
}

.danger-zone .panel-card-header {
  border-bottom-color: var(--danger-border);
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background-color: #f8fafc;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-sub);
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
}

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

/* Clusters List in Modal */
.clusters-list-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 16px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.cluster-item-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  background-color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.cluster-color-pill {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.cluster-name-title {
  font-size: 14px;
  flex: 1;
}

.cluster-count-badge {
  font-size: 11px;
  background-color: #e2e8f0;
  padding: 2px 6px;
  border-radius: 9999px;
  color: var(--text-muted);
}

.cluster-card-actions {
  display: flex;
  justify-content: flex-end;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  background-color: #1e293b;
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  animation: toastIn 0.25s ease-out;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-fadeout {
  opacity: 0;
  transform: translateY(8px);
}

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

.toast-success { border-left: 4px solid var(--success); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-danger { border-left: 4px solid var(--danger); }
.toast-info { border-left: 4px solid var(--primary); }

.toast-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.toast-message {
  flex: 1;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
}

.toast-close:hover {
  color: #fff;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-medium { font-weight: 600; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.block { display: block; }
.truncate {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
