/* Postgres URL Builder — DB Admin Dark */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-user: #60A5FA;
  --c-pass: #F87171;
  --c-host: #34D399;
  --c-port: #FBBF24;
  --c-db: #A78BFA;
  --bg: #0C0F1A;
  --bg-card: #151A2E;
  --border: rgba(96,165,250,0.08);
  --text: #E2E8F0;
  --text-dim: #94A3B8;
  --text-muted: #475569;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', system-ui, 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 { border-bottom: 1px solid var(--border); background: rgba(21,26,46,0.95); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10; }
.header-inner { max-width: 700px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; }
.header-left { display: flex; align-items: center; gap: 10px; }
.header-actions { display: flex; gap: 6px; align-items: center; }
.logo-icon { font-size: 1.2rem; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; background: rgba(96,165,250,0.12); border-radius: var(--radius-sm); }
.header h1 { font-size: 1.05rem; font-weight: 700; }
.subtitle { font-size: 0.72rem; color: var(--text-dim); }

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

.btn { padding: 8px 16px; font-family: var(--font); font-size: 0.78rem; font-weight: 600; border: none; border-radius: 6px; cursor: pointer; transition: all var(--transition); }
.btn-sm { padding: 5px 10px; font-size: 0.72rem; background: rgba(96,165,250,0.12); color: var(--c-user); border: 1px solid rgba(96,165,250,0.2); }

.form-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 80px 1fr 80px; gap: 8px; margin-bottom: 10px; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.field-sm { max-width: 80px; flex: 0 0 80px; }
.label { font-size: 0.62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.label-user { color: var(--c-user); }
.label-pass { color: var(--c-pass); }
.label-host { color: var(--c-host); }
.label-port { color: var(--c-port); }
.label-db { color: var(--c-db); }

.input { padding: 7px 10px; font-family: var(--mono); font-size: 0.72rem; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; outline: none; min-width: 0; }
.select { padding: 7px 10px; font-family: var(--font); font-size: 0.72rem; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; outline: none; cursor: pointer; }

.toggle-label { font-size: 0.72rem; color: var(--text-dim); display: flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; }
.toggle-label.small { font-size: 0.68rem; }

.url-card, .decode-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.panel-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

.url-preview { padding: 14px; font-family: var(--mono); font-size: 0.72rem; word-break: break-all; line-height: 1.8; }
.seg-proto { color: var(--text-dim); }
.seg-user { color: var(--c-user); }
.seg-pass { color: var(--c-pass); }
.seg-host { color: var(--c-host); }
.seg-port { color: var(--c-port); }
.seg-db { color: var(--c-db); }
.seg-params { color: var(--text-muted); }

.decode-body { padding: 10px 14px; display: flex; gap: 6px; }
.decode-body .input { flex: 1; }

.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 200; }
.toast { padding: 10px 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 4px 24px rgba(0,0,0,0.5); font-size: 0.82rem; animation: toastIn 0.3s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .field-sm { max-width: 100%; flex: 1; }
}
