/* =============================================
   Env File Editor — Styles
   ============================================= */

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

:root {
  --bg: #0D1117;
  --bg-card: #161B22;
  --bg-input: #0D1117;
  --bg-hover: #1C2128;
  --border: rgba(48, 54, 61, 0.8);
  --border-focus: rgba(88, 166, 255, 0.4);
  --primary: #58A6FF;
  --primary-dim: rgba(88, 166, 255, 0.12);
  --green: #3FB950;
  --green-dim: rgba(63, 185, 80, 0.15);
  --red: #F85149;
  --red-dim: rgba(248, 81, 73, 0.15);
  --yellow: #D29922;
  --yellow-dim: rgba(210, 153, 34, 0.15);
  --purple: #BC8CFF;
  --text: #E6EDF3;
  --text-dim: #8B949E;
  --text-muted: #484F58;
  --radius: 8px;
  --font: 'Inter', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --transition: 0.2s ease;
}

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; }

/* Header */
.header { border-bottom: 1px solid var(--border); background: rgba(22,27,34,0.9); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10; }
.header-inner { max-width: 960px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 1.2rem; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; background: var(--primary-dim); border-radius: var(--radius); }
.logo h1 { font-size: 1.05rem; font-weight: 700; }
.tagline { font-size: 0.72rem; color: var(--text-dim); }
.header-actions { display: flex; gap: 4px; flex-wrap: wrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; font-family: var(--font); font-size: 0.78rem; 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: var(--primary); color: #0D1117; font-weight: 600; }
.btn-primary:hover { box-shadow: 0 4px 12px rgba(88,166,255,0.25); }
.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.75rem; }

/* Main */
.main { max-width: 960px; margin: 0 auto; padding: 16px 20px 40px; }

/* Tabs */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; }
.tab { flex: 1; padding: 8px; font-family: var(--font); font-size: 0.8rem; font-weight: 500; color: var(--text-dim); background: transparent; border: 1px solid transparent; border-radius: 6px; cursor: pointer; transition: all var(--transition); text-align: center; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); background: var(--primary-dim); border-color: rgba(88,166,255,0.2); }

.section-title { font-size: 0.82rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.var-count { font-size: 0.68rem; background: var(--primary-dim); color: var(--primary); padding: 1px 7px; border-radius: 10px; }

/* Panels */
.panel[hidden] { display: none; }
.panel-info { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 14px; }

/* Editor */
.editor-container { position: relative; display: flex; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }

.line-numbers { padding: 12px 10px; background: rgba(0,0,0,0.15); color: var(--text-muted); font-family: var(--mono); font-size: 0.8rem; line-height: 1.7; text-align: right; user-select: none; min-width: 40px; }

.editor { flex: 1; padding: 12px; font-family: var(--mono); font-size: 0.82rem; line-height: 1.7; color: var(--text); background: transparent; border: none; outline: none; resize: vertical; min-height: 200px; tab-size: 2; }
.editor::placeholder { color: var(--text-muted); }

.diff-editor { min-height: 150px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }

/* Parsed List */
.parsed-section { margin-bottom: 16px; }
.parsed-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.parsed-list { display: flex; flex-direction: column; gap: 4px; }

.parsed-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; font-family: var(--mono); font-size: 0.78rem; transition: all var(--transition); }
.parsed-item:hover { border-color: rgba(88,166,255,0.2); }

.parsed-key { color: var(--primary); font-weight: 500; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.parsed-eq { color: var(--text-muted); flex-shrink: 0; }
.parsed-value { color: var(--green); flex: 2; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.parsed-value.masked { color: var(--yellow); }
.parsed-comment { color: var(--text-muted); font-style: italic; }
.parsed-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.9rem; padding: 2px 6px; border-radius: 4px; }
.parsed-remove:hover { color: var(--red); background: var(--red-dim); }

/* Diff */
.diff-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.diff-results { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.diff-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; font-family: var(--mono); font-size: 0.78rem; }
.diff-row.added { background: var(--green-dim); border-left: 3px solid var(--green); }
.diff-row.removed { background: var(--red-dim); border-left: 3px solid var(--red); }
.diff-row.changed { background: var(--yellow-dim); border-left: 3px solid var(--yellow); }
.diff-row.same { background: var(--bg-card); border-left: 3px solid var(--text-muted); opacity: 0.5; }
.diff-label { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; padding: 1px 6px; border-radius: 3px; flex-shrink: 0; }
.diff-label.added { background: var(--green-dim); color: var(--green); }
.diff-label.removed { background: var(--red-dim); color: var(--red); }
.diff-label.changed { background: var(--yellow-dim); color: var(--yellow); }

/* Templates */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.template-card { padding: 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: all var(--transition); }
.template-card:hover { border-color: var(--primary); background: var(--primary-dim); }
.template-card .template-name { font-weight: 600; font-size: 0.88rem; margin-bottom: 2px; }
.template-card .template-desc { font-size: 0.75rem; color: var(--text-dim); }

/* Validation */
.validation-results { margin-top: 12px; padding: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.validation-results[hidden] { display: none; }
.val-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 0.8rem; }
.val-icon { flex-shrink: 0; }
.val-error { color: var(--red); }
.val-warning { color: var(--yellow); }
.val-ok { color: var(--green); }

/* Toast */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column-reverse; gap: 6px; }
.toast { padding: 8px 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; font-size: 0.8rem; animation: toastIn 0.3s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }

/* Responsive */
@media (max-width: 640px) {
  .header-inner { flex-direction: column; gap: 8px; }
  .diff-layout { grid-template-columns: 1fr; }
  .template-grid { grid-template-columns: 1fr; }
}
