/* ============================================================
   Glow UI - QR Code Generator
   Dark mode default, light mode via [data-theme="light"]
   ============================================================ */

:root {
  --bg: #121212;
  --bg-card: #181818;
  --bg-hover: #282828;
  --border: #404040;
  --text-muted: #535353;
  --text-secondary: #B3B3B3;
  --text-primary: #FFFFFF;
  --green: #1DB954;
  --green-hover: #1ed760;
  --red: #C0392B;
  --font: 'Inter', sans-serif;
}

[data-theme="light"] {
  --bg: #FFFFFF;
  --bg-card: #F5F5F5;
  --bg-hover: #E8E8E8;
  --border: #D0D0D0;
  --text-muted: #999999;
  --text-secondary: #666666;
  --text-primary: #121212;
  --green: #1DB954;
  --green-hover: #17a349;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  transition: background 0.2s, color 0.2s;
}

/* ---- Header ---- */
.header {
  background: rgba(18, 18, 18, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

[data-theme="light"] .header {
  background: rgba(255, 255, 255, 0.9);
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  color: var(--green);
  font-weight: 800;
  font-size: 20px;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.header-nav {
  display: flex;
  gap: 8px;
  flex: 1;
}

.header-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 4px;
  transition: color 0.15s;
}

.header-nav a:hover,
.header-nav a.active {
  color: var(--text-primary);
}

.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ---- 3-column layout ---- */
.layout-3col {
  display: grid;
  grid-template-columns: 180px 1fr 300px;
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 24px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 88px;
}

/* ---- Main content ---- */
.main-content {
  min-width: 0;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 36px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
}

/* ---- Preset row ---- */
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.preset-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-right: 4px;
}

.preset-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 14px;
  border-radius: 9999px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.preset-btn:hover {
  background: var(--bg-hover);
  border-color: var(--green);
  color: var(--green);
}

/* ---- Generator grid ---- */
.generator-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  margin-bottom: 24px;
}

.form-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.text-input {
  width: 100%;
  min-height: 110px;
  padding: 12px;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s;
}

.text-input:focus {
  border-color: var(--green);
}

.text-input::placeholder {
  color: var(--text-muted);
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.control {
  display: flex;
  flex-direction: column;
}

.select-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.select-input:focus {
  border-color: var(--green);
}

.color-input {
  width: 100%;
  height: 38px;
  padding: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.btn-primary {
  background: var(--green);
  color: #000;
  border: none;
  border-radius: 9999px;
  padding: 10px 24px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}

.btn-primary:hover {
  background: var(--green-hover);
  transform: scale(1.02);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 10px 24px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-secondary:hover {
  border-color: var(--green);
  color: var(--green);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}

.privacy-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- Preview area ---- */
.preview-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.preview-frame {
  width: 100%;
  min-height: 280px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
}

.preview-frame canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

.preview-empty {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

.download-row {
  display: flex;
  gap: 8px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.error-note {
  color: var(--red);
  font-size: 13px;
  text-align: center;
  width: 100%;
}

/* ---- Mobile ad ---- */
.ad-slot--mobile {
  display: none;
  margin-bottom: 24px;
}

/* ---- Info & FAQ sections ---- */
.info-section {
  margin-bottom: 40px;
}

.info-section h2,
.faq-section h2,
.cross-links h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.info-section h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 20px 0 8px;
}

.info-section p,
.faq-item p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 12px;
}

.tips-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tips-list li {
  font-size: 14px;
  color: var(--text-secondary);
  padding-left: 20px;
  position: relative;
  line-height: 1.6;
}

.tips-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
}

.faq-section {
  margin-bottom: 40px;
}

.faq-item {
  border-top: 1px solid var(--border);
  padding: 20px 0;
}

.faq-item h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

/* ---- Cross-links ---- */
.cross-links {
  padding: 32px 0;
  border-top: 1px solid var(--border);
  margin-bottom: 24px;
}

.cross-links-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.service-card:hover {
  background: var(--bg-hover);
  border-color: var(--green);
  transform: scale(1.02);
}

.service-icon {
  font-size: 24px;
}

.service-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.service-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ---- Ad slots ---- */
.ad-slot {
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
  margin: 16px 0;
}

.ad-slot--bottom {
  margin-bottom: 24px;
}

.ad-slot--sticky {
  position: sticky;
  top: 88px;
}

/* ---- Footer ---- */
.footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-bottom: 12px;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 14px;
  text-decoration: none;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--text-primary);
}

.footer-copyright {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---- Responsive ---- */

/* 1100px: collapse generator to single column and right sidebar */
@media (max-width: 1100px) {
  .layout-3col {
    grid-template-columns: 180px 1fr;
  }
  .sidebar-right {
    display: none;
  }
  .ad-slot--mobile {
    display: flex;
  }
  .generator-grid {
    grid-template-columns: 1fr;
  }
  .preview-area {
    max-width: 420px;
    margin: 0 auto;
    width: 100%;
  }
}

/* 768px: collapse left sidebar */
@media (max-width: 768px) {
  .layout-3col {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 16px;
  }
  .sidebar-left {
    display: none;
  }
  .page-header h1 {
    font-size: 28px;
  }
  .cross-links-grid {
    grid-template-columns: 1fr 1fr;
  }
  .header-nav {
    display: none;
  }
  .control-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .cross-links-grid {
    grid-template-columns: 1fr;
  }
  .control-grid {
    grid-template-columns: 1fr;
  }
  .form-actions {
    flex-direction: column;
  }
  .form-actions .btn-primary,
  .form-actions .btn-secondary {
    width: 100%;
  }
}
