/* ========================================
   Docker Compose Generator - Styles
   ======================================== */

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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-hover: #222636;
  --border: #2e3345;
  --text: #e8eaed;
  --text-muted: #9aa0b0;
  --accent: #6c63ff;
  --accent-hover: #5a52e0;
  --accent-dim: rgba(108, 99, 255, 0.15);
  --success: #4caf50;
  --warning: #ff9800;
  --danger: #f44336;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --transition: 0.2s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ---- Layout ---- */

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}

header {
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
  text-align: center;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 4px;
}

header h1 .accent {
  color: var(--accent);
}

header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.app-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 24px 0;
}

@media (min-width: 900px) {
  .app-layout {
    grid-template-columns: 380px 1fr;
  }
}

@media (min-width: 1100px) {
  .app-layout {
    grid-template-columns: 420px 1fr;
  }
}

/* ---- Ad Slots ---- */

.ad-slot {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.ad-slot-top {
  max-width: 728px;
  margin: 16px auto;
}

.ad-slot-sidebar {
  min-height: 250px;
}

/* ---- Panels ---- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
  flex-shrink: 0;
}

/* ---- Preset Buttons ---- */

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.preset-btn {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.preset-btn:hover {
  background: var(--accent);
  color: #fff;
}

.preset-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---- Category Groups ---- */

.category {
  margin-bottom: 18px;
}

.category-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

/* ---- Checkbox Cards ---- */

.service-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  user-select: none;
  font-size: 0.88rem;
}

.service-card:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.service-card.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.service-card input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ---- Service Config ---- */

.config-section {
  margin-top: 20px;
}

.config-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--accent);
}

.config-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
}

.config-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  cursor: pointer;
}

.config-item-header h4 {
  font-size: 0.9rem;
  font-weight: 600;
}

.config-item-header .toggle-icon {
  color: var(--text-muted);
  font-size: 0.8rem;
  transition: transform var(--transition);
}

.config-item-header .toggle-icon.open {
  transform: rotate(180deg);
}

.config-fields {
  display: none;
}

.config-fields.open {
  display: block;
}

.config-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.config-row.full {
  grid-template-columns: 1fr;
}

.config-field label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.config-field input,
.config-field select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
}

.config-field input:focus,
.config-field select:focus {
  outline: none;
  border-color: var(--accent);
}

.config-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.config-toggle label {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.config-toggle input[type="checkbox"] {
  accent-color: var(--accent);
}

/* ---- Output Panel ---- */

.output-panel {
  position: sticky;
  top: 16px;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.output-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.output-actions {
  display: flex;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

.btn svg {
  width: 16px;
  height: 16px;
}

.copy-feedback {
  color: var(--success);
  font-size: 0.82rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity var(--transition);
}

.copy-feedback.show {
  opacity: 1;
}

/* ---- YAML Output ---- */

.yaml-output {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  min-height: 300px;
  max-height: 75vh;
  overflow-y: auto;
  white-space: pre;
  tab-size: 2;
}

/* Syntax highlighting */
.yaml-output .y-key { color: #79c0ff; }
.yaml-output .y-str { color: #a5d6a7; }
.yaml-output .y-num { color: #f9a825; }
.yaml-output .y-comment { color: #6a737d; font-style: italic; }
.yaml-output .y-bool { color: #ff9800; }
.yaml-output .y-null { color: #f44336; }

/* ---- Empty State ---- */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.95rem;
}

/* ---- SEO Content ---- */

.seo-content {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  margin-top: 24px;
}

.seo-content h2 {
  font-size: 1.4rem;
  margin-bottom: 16px;
}

.seo-content h3 {
  font-size: 1.1rem;
  margin: 20px 0 8px;
  color: var(--accent);
}

.seo-content p,
.seo-content li {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.7;
}

.seo-content ul {
  padding-left: 20px;
  margin: 8px 0 16px;
}

.seo-content li {
  margin-bottom: 4px;
}

.seo-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 700px) {
  .seo-columns {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---- Affiliate Links ---- */

.affiliate-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 24px;
}

.affiliate-section h3 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.affiliate-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.affiliate-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.85rem;
  transition: border-color var(--transition), background var(--transition);
}

.affiliate-link:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
  text-decoration: none;
}

.affiliate-link svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

/* ---- Footer ---- */

footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

footer a {
  color: var(--text-muted);
}

footer a:hover {
  color: var(--accent);
}

/* ---- Scrollbar ---- */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ---- Service count badge ---- */

.service-count {
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 8px;
  margin-left: 8px;
}
