/* ========== Global ========== */
* {
  box-sizing: border-box;
}

:root {
  --bg-main: #050816;
  --bg-panel: rgba(15, 17, 23, 0.9);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.18);
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --danger: #ef4444;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
    sans-serif;
  color: var(--text-main);
  background: var(--bg-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Animated gradient background */

.gradient-bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 0% 0%, #1e3a8a 0, transparent 55%),
    radial-gradient(circle at 100% 0%, #6366f1 0, transparent 55%),
    radial-gradient(circle at 0% 100%, #22c55e 0, transparent 55%),
    radial-gradient(circle at 100% 100%, #ec4899 0, transparent 55%);
  opacity: 0.22;
  filter: blur(5px);
  z-index: -2;
  animation: gradientShift 22s ease-in-out infinite alternate;
}

@keyframes gradientShift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-10px, 10px, 0) scale(1.03);
  }
  100% {
    transform: translate3d(15px, -10px, 0) scale(1.06);
  }
}

/* Subtle overlay for glass effect */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.7), transparent),
    radial-gradient(circle at bottom, rgba(15, 23, 42, 0.9), transparent);
  z-index: -1;
}

/* ========== Layout Shell ========== */

.page {
  min-height: 100vh;
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem 1.75rem;
}

/* ========== Header ========== */

.header {
  padding: 1.25rem 1.5rem 1rem;
  margin-bottom: 1rem;
  border-radius: 18px;
  border: 1px solid var(--border-subtle);
  background: radial-gradient(circle at top left, rgba(30, 64, 175, 0.4), transparent 55%),
    var(--bg-panel);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
}

.header-top {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.logo-mark {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, #3b82f6, #1d4ed8);
  color: white;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 1rem;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.8);
}

.header-text h1 {
  margin: 0;
  font-size: 1.7rem;
  background: linear-gradient(120deg, #f9fafb, #93c5fd, #a855f7);
  -webkit-background-clip: text;
  color: transparent;
}

.tagline {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.header-subtext {
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 640px;
}

/* ========== Main Layout ========== */

.main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.95fr);
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .main {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ========== Panels ========== */

.input-panel,
.settings-panel {
  background: radial-gradient(circle at top, rgba(31, 41, 55, 0.7), transparent 60%),
    var(--bg-panel);
  border-radius: 18px;
  padding: 1.35rem 1.4rem;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(22px);
}

.settings-panel {
  display: flex;
  flex-direction: column;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.panel-header .status {
  margin-top: 0.25rem;
}

/* ========== Form Elements ========== */

label {
  display: block;
  margin-bottom: 0.45rem;
  font-weight: 600;
  font-size: 0.9rem;
}

textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  padding: 0.75rem 0.8rem;
  background: rgba(15, 17, 23, 0.9);
  color: inherit;
  resize: vertical;
  min-height: 5rem;
  font-size: 0.9rem;
}

textarea:focus,
.text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.4);
}

.text-input {
  width: 100%;
  margin-top: 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  padding: 0.5rem 0.9rem;
  background: rgba(15, 17, 23, 0.9);
  color: inherit;
  font-size: 0.85rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

button {
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  background: var(--accent);
  color: white;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.08s ease;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.55);
}

button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.8);
}

button.secondary {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.6);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.8);
  color: #e5e7eb;
}

button.ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed rgba(148, 163, 184, 0.6);
  box-shadow: none;
}

.print-button {
  margin-top: 0.9rem;
  align-self: flex-start;
}

/* ========== Quick Settings Chips ========== */

.quick-section {
  margin-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 1rem;
}

.quick-section h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 0.92rem;
  color: #e5e7eb;
}

.quick-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.quick-label {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.85;
  min-width: 64px;
  color: #e5e7eb;
}

.chip {
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.9);
  font-size: 0.78rem;
  cursor: pointer;
  color: #e5e7eb;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.85);
}

.chip:hover {
  border-color: var(--accent);
  background: rgba(30, 64, 175, 0.7);
}

.chip.active {
  border-color: var(--accent);
  background: linear-gradient(130deg, #2563eb, #4f46e5);
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.9);
}

/* ========== Saved Settings ========== */

.saved-section {
  margin-top: 1.4rem;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-heading h3 {
  margin: 0;
  font-size: 0.95rem;
}

.badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.95);
  color: var(--text-muted);
}

.settings-list {
  list-style: none;
  padding-left: 0;
  margin: 0.75rem 0 0;
}

.settings-list li {
  margin-bottom: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.86rem;
}

.saved-settings-actions button {
  margin-left: 0.2rem;
  padding: 0.28rem 0.65rem;
  font-size: 0.75rem;
  box-shadow: none;
}

.status {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0;
}

.status.small {
  font-size: 0.78rem;
}

/* ========== Settings Panel Content ========== */

.settings-panel ul {
  list-style: none;
  padding-left: 0;
  margin: 0.8rem 0 1rem;
}

.settings-panel li {
  margin-bottom: 0.35rem;
  font-size: 0.88rem;
}

.settings-panel li strong {
  font-weight: 600;
  color: #e5e7eb;
}

pre {
  margin: 0;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(31, 41, 55, 0.9);
  font-size: 0.8rem;
  overflow-x: auto;
}

/* ========== Footer ========== */

.footer {
  margin-top: 1.3rem;
  padding: 0.6rem 0.5rem 0.2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* ========== Modal (Print Demo) ========== */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: radial-gradient(circle at top, rgba(30, 64, 175, 0.6), transparent 65%),
    rgba(15, 23, 42, 0.98);
  border-radius: 18px;
  padding: 1.5rem 1.4rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.modal-content h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.modal-content p {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.modal-content pre {
  margin-top: 0.9rem;
  margin-bottom: 1rem;
}

.modal-buttons {
  justify-content: flex-end;
}
