/* ============================================================
   Balaji's Program Workspace — style.css
   Aesthetic: Industrial-utilitarian, dark, precise
   Fonts: Syne (display) + DM Mono (body/code)
   ============================================================ */

/* ── Reset & Variables ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0d0f12;
  --bg-card:    #13161b;
  --bg-card2:   #1a1e26;
  --border:     #272c38;
  --border-hi:  #3a4155;
  --accent:     #e8c547;
  --accent-dim: #b89a2e;
  --text-pri:   #e8eaf0;
  --text-sec:   #7a8099;
  --text-dim:   #4a5068;
  --danger:     #e05252;
  --success:    #52c47a;
  --radius:     8px;
  --font-head:  'Syne', sans-serif;
  --font-body:  'DM Mono', monospace;
  --transition: 180ms ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--text-pri);
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Background decoration ── */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.3;
}
.bg-glow {
  position: fixed; z-index: 0; pointer-events: none;
  width: 700px; height: 700px;
  top: -200px; right: -200px;
  background: radial-gradient(circle, rgba(232,197,71,0.07) 0%, transparent 70%);
}

/* ── Layout shell — centred, wider ── */
.shell {
  position: relative; z-index: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 2.5rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ── Accessibility ── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

/* ── Header ── */
.site-header {
  display: flex; align-items: center; gap: 1.25rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
  animation: fadeDown 0.5s ease both;
}

.logo-mark {
  flex-shrink: 0;
  width: 56px; height: 56px;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-head);
  font-size: 1.7rem; font-weight: 800;
  display: grid; place-items: center;
  border-radius: var(--radius);
  box-shadow: 0 0 28px rgba(232,197,71,0.25);
}

.header-text { flex: 1; }

.site-title {
  font-family: var(--font-head);
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text-pri);
}

.site-sub {
  font-size: 0.73rem;
  color: var(--text-sec);
  margin-top: 0.3rem;
  letter-spacing: 0.04em;
}

/* Status pill */
.status-pill {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--text-sec);
  white-space: nowrap;
  transition: border-color var(--transition), color var(--transition);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  transition: background var(--transition), box-shadow var(--transition);
}
.status-pill.loading .status-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 1s infinite;
}
.status-pill.error .status-dot {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex; flex-direction: column; gap: 1.25rem;
  animation: fadeUp 0.5s ease both;
  animation-delay: 0.1s;
  transition: border-color var(--transition);
}
.card:focus-within { border-color: var(--border-hi); }

.card-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  font-family: var(--font-head);
}

/* ── Textarea — tall and centred ── */
textarea {
  width: 100%;
  min-height: 340px;          /* taller */
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-pri);
  font-family: var(--font-body);
  font-size: 0.95rem;         /* slightly bigger text */
  line-height: 1.75;
  padding: 1.25rem 1.5rem;
  resize: vertical;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  display: block;
  margin: 0 auto;             /* centre within card */
}
textarea::placeholder { color: var(--text-dim); font-style: italic; }
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(232,197,71,0.09);
}

/* Input footer */
.input-footer {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.73rem; color: var(--text-sec);
}
.btn-clear {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-family: var(--font-body); font-size: 0.73rem;
  transition: color var(--transition);
}
.btn-clear:hover { color: var(--danger); }

/* ── Action bar — centred ── */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: center;    /* centre button */
  gap: 1.5rem;
  animation: fadeUp 0.5s ease both;
  animation-delay: 0.2s;
  flex-wrap: wrap;
}
.hint {
  font-size: 0.73rem;
  color: var(--text-dim);
  font-style: italic;
}

/* Submit button */
.btn-submit {
  position: relative;
  display: inline-flex; align-items: center; gap: 0.7rem;
  padding: 0.85rem 2.5rem;
  background: var(--accent);
  color: var(--bg);
  border: none; border-radius: var(--radius);
  font-family: var(--font-head);
  font-size: 1rem; font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  overflow: hidden;
  white-space: nowrap;
  min-width: 180px;
  justify-content: center;
}
.btn-submit:hover:not(:disabled) {
  background: #f0d050;
  box-shadow: 0 0 24px rgba(232,197,71,0.4);
  transform: translateY(-2px);
}
.btn-submit:active:not(:disabled) { transform: translateY(0); }
.btn-submit:disabled { cursor: not-allowed; opacity: 0.55; }

/* Spinner inside button */
.spinner {
  display: none;
  width: 17px; height: 17px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-submit.loading .btn-text { opacity: 0.4; }
.btn-submit.loading .btn-arrow { display: none; }
.btn-submit.loading .spinner { display: block; }

/* ── Result card ── */
.card--result { animation-delay: 0.3s; }

.result-body {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-pri);
  min-height: 100px;
}
.result-body strong { color: var(--accent); font-weight: 600; }
.result-body ul { padding-left: 1.5rem; margin: 0.5rem 0; }
.result-body li { margin-bottom: 0.3rem; }

.result-footer {
  display: flex; gap: 0.75rem; justify-content: flex-end;
}

.btn-copy, .btn-reset {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-sec);
  font-family: var(--font-body);
  font-size: 0.75rem;
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.btn-copy:hover  { border-color: var(--accent); color: var(--accent); }
.btn-reset:hover { border-color: var(--border-hi); color: var(--text-pri); }

/* ── Error banner ── */
.error-banner {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  background: rgba(224,82,82,0.08);
  border: 1px solid rgba(224,82,82,0.35);
  border-radius: var(--radius);
  animation: fadeUp 0.3s ease both;
  color: #f08080;
  font-size: 0.84rem;
}
.error-icon { font-size: 1rem; }
.error-msg  { flex: 1; }
.error-dismiss {
  background: none; border: none; cursor: pointer;
  color: #f08080; font-size: 0.9rem; opacity: 0.7;
  transition: opacity var(--transition);
}
.error-dismiss:hover { opacity: 1; }

/* ── Footer ── */
.site-footer {
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-dim);
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  letter-spacing: 0.04em;
}

/* ── Animations ── */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── Mobile responsive ── */
@media (max-width: 640px) {
  .shell { padding: 1.5rem 1rem 3rem; gap: 1.5rem; }
  .site-header { flex-wrap: wrap; }
  .status-pill { order: 3; }
  .logo-mark { width: 44px; height: 44px; font-size: 1.35rem; }
  .action-bar { flex-direction: column; align-items: stretch; gap: 1rem; }
  .btn-submit { justify-content: center; width: 100%; }
  textarea { min-height: 200px; }
  .card { padding: 1.25rem; }
}
