/* ═══════════════════════════════════════════════════════
   Addons Page — css/addons.css
   Depends on css/base.css (tokens + nav)
   ═══════════════════════════════════════════════════════ */

/* ── Freeflowing Sections ────────────────────────────── */
.addons-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

.addons-section:first-of-type {
  padding-top: 2rem;
  padding-bottom: 1.5rem;
}

.page-header {
  text-align: center;
  margin-bottom: 0;
}

.page-header h1 {
  margin: 0 0 0.75rem 0;
  font-size: clamp(2rem, 3vw, 2.75rem);
  font-weight: 800;
  background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.1em;
  line-height: 1.1;
  text-transform: uppercase;
}

.page-header .last-updated {
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 0;
  line-height: 1.8;
}

.meta-label {
  color: var(--text-muted);
  font-weight: 400;
}

.meta-value {
  color: var(--text-accent);
  font-weight: 700;
}

.meta-sep {
  color: var(--text-muted);
  margin: 0 0.25rem;
  opacity: 0.5;
}

/* ── Section Headers (centered, matching home) ───────── */
.section-header {
  text-align: center;
  margin-bottom: 2rem;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
}

.section-count {
  background: var(--accent-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 700;
}

/* ── Section Divider ─────────────────────────────────── */
.section-divider {
  max-width: 200px;
  margin: 0 auto;
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
  opacity: .3;
}

/* ── UI Settings ─────────────────────────────────────── */
.ui-settings {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ui-settings:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.ui-setting {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.ui-setting-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.ui-setting-value {
  color: var(--accent-color);
  font-size: 1.25rem;
  font-weight: 700;
}

/* ── Grid layout for items ───────────────────────────── */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.item-card {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.item-card.has-instructions {
  display: flex;
  flex-direction: column;
}

.item-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.item-card:hover {
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.3);
}

.item-card:hover::before {
  opacity: 0.8;
}

.item-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.3;
  min-height: fit-content;
  text-align: center;
}

.item-preview {
  width: 100%;
  height: 180px;
  border-radius: 8px;
  margin-bottom: 1rem;
  object-fit: cover;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.item-preview:hover {
  border-color: var(--accent-color);
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.item-preview-placeholder {
  width: 100%;
  height: 180px;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, rgba(167, 139, 250, 0.1) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.item-preview-placeholder svg {
  width: 48px;
  height: 48px;
  opacity: 0.3;
}

.item-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: auto;
  justify-content: center;
}

.item-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: var(--accent-color);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  flex: 1;
  justify-content: center;
  min-width: fit-content;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.item-link:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.5);
}

.item-link.secondary {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.item-link.secondary:hover {
  background: var(--hover-bg);
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.item-link svg {
  width: 16px;
  height: 16px;
}

/* ── Wago.io import button ───────────────────────────── */
.wago-import-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .65rem 1.25rem;
  background: linear-gradient(135deg, rgba(194,65,54,.85), rgba(168,50,42,.9));
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 10px;
  border: 1px solid rgba(194,65,54,.5);
  transition: all .3s cubic-bezier(.4,0,.2,1);
  letter-spacing: .03em;
}
.wago-import-btn:hover {
  background: linear-gradient(135deg, rgba(214,75,64,.95), rgba(194,65,54,1));
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(194,65,54,.35);
}
.wago-icon {
  width: 18px;
  height: 18px;
}

/* ── Instructions Card with Tabs ─────────────────────── */
.instructions-card {
  display: flex;
  flex-direction: column;
}

.tab-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab-btn {
  flex: 1;
  padding: 0.625rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

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

.tab-content {
  display: none;
}

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

.tab-content ol {
  margin: 0;
  padding-left: 1.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.6;
  text-align: left;
}

.tab-content li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.tab-content li:last-child {
  margin-bottom: 0;
}

.tab-content code {
  background: var(--secondary-bg);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  color: var(--accent-color);
  border: 1px solid var(--border-color);
}

.tab-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ── Interactive UI Map ──────────────────────────────── */
.ui-map-wrapper {
  position: relative;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 2rem;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  background-image: url('../img/ui.jpg');
  background-size: cover;
  background-repeat: no-repeat;
  aspect-ratio: 1920 / 1080;
}

.hotspot {
  position: absolute;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.1);
  z-index: 10;
}

.hotspot:hover {
  border-color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.25);
  z-index: 100;
}

.tooltip {
  position: fixed;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 255, 255, 0.3);
  min-width: 200px;
  text-align: center;
}

.tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-bottom-color: rgba(255, 255, 255, 0.8);
}

.tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.tooltip-text {
  display: block;
  margin-bottom: 4px;
}

.tooltip-hint {
  display: block;
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  font-weight: 500;
  opacity: 0.8;
}

.instructions {
  text-align: center;
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
}

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

/* Tablet landscape */
@media (max-width: 1024px) {
  .ui-map-wrapper {
    max-width: 100%;
    padding: 0 1.5rem;
  }
}

/* Tablet portrait */
@media (max-width: 900px) {
  .addons-section {
    padding: 3rem 1.25rem;
  }

  .addons-section:first-of-type {
    padding-bottom: 1rem;
  }

  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
  }

  .ui-map-wrapper {
    padding: 0 1.25rem;
  }
}

/* Small tablet / large phone */
@media (max-width: 768px) {
  .addons-section {
    padding: 2.5rem 1rem;
  }

  .addons-section:first-of-type {
    padding-top: 2rem;
    padding-bottom: 0.75rem;
  }

  .page-header h1 {
    font-size: 1.75rem;
    letter-spacing: 0.05em;
  }

  .section-header h2 {
    font-size: 1.25rem;
  }

  .ui-settings {
    gap: 1.5rem;
  }

  .ui-map-wrapper {
    padding: 0 1rem;
    border-radius: 8px;
  }

  .tooltip {
    font-size: 12px;
    padding: 8px 12px;
    min-width: 150px;
  }

  .items-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .item-card {
    padding: 1rem;
  }

  .item-preview,
  .item-preview-placeholder {
    height: 150px;
  }

  .tab-buttons {
    gap: 0.375rem;
  }

  .tab-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }
}

/* Phone */
@media (max-width: 480px) {
  .addons-section {
    padding: 2rem 0.75rem;
  }

  .addons-section:first-of-type {
    padding-top: 1.5rem;
    padding-bottom: 0.5rem;
  }

  .page-header h1 {
    font-size: 1.5rem;
  }

  .page-header .last-updated {
    font-size: 0.75rem;
  }

  .section-header {
    margin-bottom: 1.25rem;
  }

  .section-header h2 {
    font-size: 1.1rem;
  }

  .ui-map-wrapper {
    padding: 0 0.75rem;
    border-radius: 6px;
  }

  .item-name {
    font-size: 0.95rem;
  }

  .item-preview,
  .item-preview-placeholder {
    height: 130px;
  }

  .item-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
  }

  .wago-import-btn {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
  }

  .tab-content ol {
    padding-left: 1.25rem;
    font-size: 0.8125rem;
  }

  .section-divider {
    max-width: 150px;
  }
}

/* Very small phone */
@media (max-width: 360px) {
  .addons-section {
    padding: 1.5rem 0.5rem;
  }

  .page-header h1 {
    font-size: 1.25rem;
  }

  .item-card {
    padding: 0.875rem;
    border-radius: 8px;
  }

  .item-links {
    flex-direction: column;
  }

  .item-link {
    flex: none;
    width: 100%;
  }

  .ui-map-wrapper {
    padding: 0 0.5rem;
  }
}
