/* =========================================================
FILE: app.css
Modern App UI Styling
========================================================= */

:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-alt: #f9fafb;

  --text: #111827;
  --text-light: #6b7280;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;

  --border: #dbe2ea;

  --radius: 1rem;

  --shadow:
    0 10px 30px rgba(15, 23, 42, 0.08);

  --transition: 180ms ease;
}

/* =========================================================
RESET
========================================================= */

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

body {
  margin: 0;

  min-height: 100vh;

  font-family:
    "Inter",
    sans-serif;

  background: var(--primary);
  color: var(--text);
}

/* =========================================================
HEADER
========================================================= */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 1.5rem 2rem;

  background:
    linear-gradient(
      135deg,
      #111827,
      #1f2937
    );

  color: white;
}

.app-title {
  margin: 0;
  font-size: 2rem;
}

.app-subtitle {
  margin-top: 0.4rem;
  color: rgba(255, 255, 255, 0.7);
}

.back-link {
  color: white;
  text-decoration: none;
  font-weight: 600;
}

/* =========================================================
LAYOUT
========================================================= */

.app-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;

  padding: 1.5rem;
}

.sidebar,
.preview-card,
.code-card {
  background: var(--surface);

  border-radius: var(--radius);

  box-shadow: var(--shadow);
}

/* =========================================================
SIDEBAR
========================================================= */

.sidebar {
  padding: 1.5rem;
}

.tabs {
  display: flex;
  gap: 0.75rem;

  margin-bottom: 1.5rem;
}

.tab-btn {
  flex: 1;

  border: none;

  padding: 0.9rem 1rem;

  border-radius: 0.8rem;

  background: #e5e7eb;

  cursor: pointer;

  font-weight: 600;

  transition: all var(--transition);
}

.tab-btn.active {
  background: var(--primary);
  color: white;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.field {
  display: flex;
  flex-direction: column;

  gap: 0.5rem;

  margin-bottom: 1rem;
}

.field label {
  font-size: 0.95rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;

  border: 1px solid var(--border);

  border-radius: 0.8rem;

  padding: 0.85rem 1rem;

  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;

  border-color: var(--primary);

  box-shadow:
    0 0 0 4px rgba(37, 99, 235, 0.12);
}

.button-group {
  display: flex;
  gap: 1rem;

  margin-top: 1.5rem;
}

/* =========================================================
BUTTONS
========================================================= */

.btn {
  border: none;

  border-radius: 0.8rem;

  padding: 0.85rem 1rem;

  cursor: pointer;

  font-weight: 600;

  transition:
    transform var(--transition),
    background var(--transition);
}

.btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  background: var(--primary);
  color: white;
}

.primary-btn:hover {
  background: var(--primary-hover);
}

.secondary-btn {
  background: #e5e7eb;
}

/* =========================================================
WORKSPACE
========================================================= */

.workspace {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.preview-card,
.code-card {
  padding: 1.5rem;
}

.card-header,
.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;

  margin-bottom: 1rem;
}

/* =========================================================
PREVIEW TABLE
========================================================= */

#previewArea {
  overflow-x: auto;
}

.preview-table {
  width: 100%;

  border-radius: 0.8rem;

  overflow: hidden;
}

.preview-table td,
.preview-table th {
  transition:
    background var(--transition);
}

.preview-table td:focus,
.preview-table th:focus {
  outline: 2px solid var(--primary);
}

/* =========================================================
CODE AREAS
========================================================= */

textarea {
  min-height: 220px;

  resize: vertical;

  margin-bottom: 1.5rem;

  background: #0f172a;
  color: #e2e8f0;

  font-family:
    "Fira Code",
    monospace;

  line-height: 1.5;
}

/* =========================================================
RESPONSIVE
========================================================= */

@media (max-width: 960px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
}