/* =============================================
   Database Migration Diff — Styles
   Theme: Dark mode, Neon Violet
   ============================================= */

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

:root {
  --primary: #A855F7;
  --primary-dim: rgba(168, 85, 247, 0.12);
  --primary-glow: rgba(168, 85, 247, 0.3);
  --secondary: #C084FC;
  --accent: #22D3EE;
  --accent-dim: rgba(34, 211, 238, 0.12);
  --bg: #0F0720;
  --bg-card: #160E2E;
  --bg-input: #0D0618;
  --bg-hover: #1D1240;
  --border: rgba(168, 85, 247, 0.15);
  --border-focus: rgba(168, 85, 247, 0.5);
  --text: #E8E0F8;
  --text-dim: #9B8BB8;
  --text-muted: #5A4878;
  --green: #34D399;
  --green-dim: rgba(52, 211, 153, 0.12);
  --red: #F87171;
  --red-dim: rgba(248, 113, 113, 0.12);
  --yellow: #FBBF24;
  --yellow-dim: rgba(251, 191, 36, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --transition: 0.2s ease;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.6; }
body::before { content: ''; position: fixed; inset: 0; background: radial-gradient(ellipse at top left, rgba(168,85,247,0.06), transparent 50%), radial-gradient(ellipse at bottom right, rgba(34,211,238,0.04), transparent 50%); pointer-events: none; }

/* Header */
.header { border-bottom: 1px solid var(--border); background: rgba(22,14,46,0.9); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10; }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; }
.header-left { display: flex; align-items: center; gap: 12px; }
.logo-icon { font-size: 1.3rem; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; background: var(--primary-dim); border-radius: var(--radius); }
.header h1 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; }
.subtitle { font-size: 0.75rem; color: var(--text-dim); }
.header-actions { display: flex; gap: 6px; align-items: center; }

.dialect-select { padding: 6px 28px 6px 10px; font-family: var(--font); font-size: 0.8rem; font-weight: 500; color: var(--accent); background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; outline: none; -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%239B8BB8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.dialect-select:focus { border-color: var(--border-focus); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; font-family: var(--font); font-size: 0.82rem; font-weight: 500; border: none; border-radius: 6px; cursor: pointer; transition: all var(--transition); white-space: nowrap; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary { background: linear-gradient(135deg, var(--primary), #7C3AED); color: white; font-weight: 600; }
.btn-primary:hover { box-shadow: 0 4px 16px var(--primary-glow); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--primary); background: var(--primary-dim); }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-lg { padding: 12px 28px; font-size: 0.92rem; }
.btn-icon { font-size: 1.1em; }

.main { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* Schema Inputs */
.schema-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.schema-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color var(--transition); }
.schema-panel:focus-within { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-dim); }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.panel-label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.source-label { color: var(--red); }
.target-label { color: var(--green); }
.line-count { font-size: 0.72rem; color: var(--text-muted); font-family: var(--mono); }
.schema-editor { width: 100%; min-height: 200px; max-height: 400px; padding: 14px; font-family: var(--mono); font-size: 0.82rem; line-height: 1.7; color: var(--text); background: var(--bg-input); border: none; outline: none; resize: vertical; tab-size: 2; }
.schema-editor::placeholder { color: var(--text-muted); }

.compare-bar { display: flex; justify-content: center; margin-bottom: 20px; }

/* Summary Bar */
.summary-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.summary-stat { display: flex; flex-direction: column; align-items: center; padding: 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.stat-num { font-size: 1.6rem; font-weight: 700; }
.stat-label { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.summary-stat.added .stat-num { color: var(--green); }
.summary-stat.modified .stat-num { color: var(--yellow); }
.summary-stat.removed .stat-num { color: var(--red); }
.summary-stat.unchanged .stat-num { color: var(--text-muted); }

/* Result Tabs */
.result-tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; }
.rtab { flex: 1; padding: 10px 14px; font-family: var(--font); font-size: 0.82rem; font-weight: 500; color: var(--text-dim); background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition); text-align: center; }
.rtab:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.rtab.active { color: var(--primary); background: var(--primary-dim); border-color: rgba(168,85,247,0.2); }

/* Result Panels */
.result-panel { animation: fadeSlide 0.3s ease; }
.result-panel[hidden] { display: none; }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Diff List */
.diff-list { display: flex; flex-direction: column; gap: 10px; }
.diff-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color var(--transition); }
.diff-item:hover { border-color: rgba(168,85,247,0.3); }
.diff-item-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; user-select: none; }
.diff-item-header:hover { background: var(--bg-hover); }
.diff-badge { padding: 3px 8px; font-size: 0.68rem; font-weight: 700; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0; }
.diff-badge.added { background: var(--green-dim); color: var(--green); }
.diff-badge.modified { background: var(--yellow-dim); color: var(--yellow); }
.diff-badge.removed { background: var(--red-dim); color: var(--red); }
.diff-type-tag { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.04em; }
.diff-name { font-family: var(--mono); font-size: 0.88rem; font-weight: 600; color: var(--text); flex: 1; }
.diff-toggle { font-size: 0.8rem; color: var(--text-muted); transition: transform var(--transition); }
.diff-item.open .diff-toggle { transform: rotate(90deg); }
.diff-details { padding: 0 16px 14px; display: none; }
.diff-item.open .diff-details { display: block; }
.change-row { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; font-size: 0.8rem; border-bottom: 1px solid rgba(168,85,247,0.06); }
.change-row:last-child { border-bottom: none; }
.change-indicator { width: 18px; height: 18px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; flex-shrink: 0; margin-top: 1px; }
.change-indicator.add { background: var(--green-dim); color: var(--green); }
.change-indicator.remove { background: var(--red-dim); color: var(--red); }
.change-indicator.modify { background: var(--yellow-dim); color: var(--yellow); }
.change-text { font-family: var(--mono); font-size: 0.78rem; color: var(--text-dim); line-height: 1.5; }
.change-text code { color: var(--accent); background: var(--accent-dim); padding: 1px 5px; border-radius: 3px; font-size: 0.76rem; }

/* SQL Output */
.sql-output-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 0.85rem; font-weight: 600; color: var(--text-dim); }
.sql-output { padding: 18px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); font-family: var(--mono); font-size: 0.82rem; line-height: 1.8; color: var(--text); overflow-x: auto; white-space: pre-wrap; word-wrap: break-word; tab-size: 2; }
.changelog-output { line-height: 2; }

/* Empty State */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state h2 { font-size: 1.1rem; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.empty-state p { font-size: 0.85rem; }

/* Toast */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column-reverse; gap: 8px; }
.toast { padding: 10px 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 0.82rem; display: flex; align-items: center; gap: 8px; animation: toastIn 0.3s ease; }
.toast.success { border-color: rgba(52,211,153,0.4); }
.toast.error { border-color: rgba(248,113,113,0.4); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (max-width: 768px) {
  .main { padding: 12px; }
  .header-inner { padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  .header-actions { flex-wrap: wrap; }
  .schema-inputs { grid-template-columns: 1fr; }
  .summary-bar { grid-template-columns: repeat(2, 1fr); }
  .result-tabs { overflow-x: auto; }
  .rtab { padding: 8px 10px; font-size: 0.78rem; }
  .header h1 { font-size: 1rem; }
  .schema-editor { min-height: 150px; }
}
