/* ============================================================
   Vibe Coding Cleanup Specialist — Stylesheet
   ============================================================ */

:root {
  --transition-duration: 0.3s;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;

  --bg-glass: rgba(255, 255, 255, 0.78);
  --bg-glass-light: rgba(255, 255, 255, 0.6);
  --border-glass: rgba(255, 255, 255, 0.4);
  --border-subtle: rgba(0, 0, 0, 0.08);
  --text-primary: rgba(30, 30, 60, 0.9);
  --text-secondary: rgba(60, 60, 100, 0.7);
  --radius-card: 14px;
  --radius-btn: 10px;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.07), 0 1px 4px rgba(0, 0, 0, 0.04);
}

/* ── Reset & Base ─────────────────────────────────────────── */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  background: hsl(210, 20%, 92%);
  color: var(--text-primary);
  overflow-x: hidden;
}

/* ── Main Layout ──────────────────────────────────────────── */

.main-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

/* ── Header ───────────────────────────────────────────────── */

header {
  margin-bottom: 2rem;
  text-align: left;
}

.app-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  line-height: 1.2;
}

.app-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Input Section ────────────────────────────────────────── */

.input-section {
  margin-bottom: 0.75rem;
}

textarea#work-text-input {
  width: 100%;
  min-height: 160px;
  border-radius: var(--radius-card);
  padding: 1rem 1.1rem;
  font-size: 0.95rem;
  font-family: var(--font-body);
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid var(--border-glass);
  box-shadow: var(--shadow-card);
  resize: vertical;
  color: var(--text-primary);
  transition: border-color var(--transition-duration), box-shadow var(--transition-duration);
  outline: none;
}

textarea#work-text-input:focus {
  border-color: rgba(100, 140, 200, 0.5);
  box-shadow: 0 0 0 3px rgba(100, 140, 200, 0.15), var(--shadow-card);
}

textarea#work-text-input::placeholder {
  color: rgba(80, 80, 120, 0.45);
}

/* ── Action Buttons ───────────────────────────────────────── */

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.action-buttons button {
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-btn);
  font-size: 0.88rem;
  font-family: var(--font-body);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.15s, opacity 0.2s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  white-space: nowrap;
}

.action-buttons button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.action-buttons button:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.92);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.action-buttons button:not(:disabled):active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* ── Vibe Code: Compiler Log ──────────────────────────────── */

#compiler-log-panel {
  margin-top: 0.75rem;
  background: rgba(10, 12, 20, 0.92);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  line-height: 1.6;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#compiler-log-panel[hidden] {
  display: none;
}

#compiler-log-output {
  color: #7fff7f;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

#compiler-log-output .log-warn {
  color: #ffb347;
}

/* ── Vibe Code: Code Output Panel ────────────────────────── */

#code-output-panel {
  margin-top: 0.75rem;
  background: rgba(20, 20, 32, 0.88);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#code-output-panel[hidden] {
  display: none;
}

#code-output-panel pre {
  margin: 0;
  overflow-x: auto;
}

#code-output-panel code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  color: #c9d1d9;
  white-space: pre;
  display: block;
}

/* ── Vibe Code: Program Preview Panel ────────────────────── */

#program-preview-panel {
  margin-top: 0.75rem;
  background: rgba(15, 15, 25, 0.9);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#program-preview-panel[hidden] {
  display: none;
}

#program-preview-container iframe {
  display: block;
  width: 100%;
  height: 400px;
  border: none;
  border-radius: 8px;
  background: #111;
}

/* ── Vibe Code: Panel Header ─────────────────────────────── */

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.panel-title {
  font-size: 0.85rem;
  color: #aaa;
  font-family: monospace;
}

#vibe-match-label {
  font-size: 0.8rem;
  color: #aaa;
  font-style: italic;
}

.panel-actions {
  display: flex;
  gap: 0.5rem;
}

#btn-copy-code,
#btn-run-it {
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: var(--font-body);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #c9d1d9;
  cursor: pointer;
  transition: background 0.2s;
}

#btn-copy-code:hover,
#btn-run-it:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 600px) {
  .main-container {
    padding: 1.5rem 1rem 3rem;
  }

  .app-title {
    font-size: 1.3rem;
  }

  textarea#work-text-input {
    min-height: 120px;
    font-size: 0.9rem;
  }

  .action-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .action-buttons button {
    text-align: center;
  }
}

@media (max-width: 320px) {
  .main-container {
    padding: 1rem 0.75rem 2rem;
  }

  .app-title {
    font-size: 1.1rem;
  }

  .action-buttons button {
    font-size: 0.82rem;
    padding: 0.5rem 0.75rem;
  }
}
