/* ============================================================
   dashboard.css — Widget Customization Showcase
   Reuses :root variables from styles.css (linked before this file).
   ============================================================ */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: #f7fafc;
}

/* ========== Hero ========== */
.dash-hero {
  background: var(--accent);
  color: #fff;
  padding: 40px 24px;
}

.dash-hero-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.dash-eyebrow {
  font-size: 13px;
  opacity: 0.7;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash-hero h1 {
  margin: 0 0 10px;
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
}

.dash-hero p {
  margin: 0;
  max-width: 640px;
  opacity: 0.85;
  line-height: 1.5;
  font-size: 14.5px;
}

.dash-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 10px 18px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.dash-download-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.45);
}

.dash-download-btn svg {
  flex: 0 0 auto;
}

/* ========== Layout ========== */
.dash-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 60px;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  align-items: start;
}

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

/* ========== Case picker ========== */
.dash-picker {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (max-width: 860px) {
  .dash-picker {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }
}

.dash-category {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 240px;
}

.dash-category-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 0 4px;
}

.dash-card {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  font: inherit;
  color: inherit;
}

.dash-card:hover {
  background: var(--accent-soft);
}

.dash-card-title {
  font-weight: 600;
  font-size: 14.5px;
  margin-bottom: 3px;
}

.dash-card-tagline {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
}

.dash-card.is-active {
  border-color: var(--accent);
  border-left-width: 4px;
  background: var(--accent-soft);
}

.dash-card.is-active .dash-card-title {
  color: var(--accent);
}

.dash-card.is-empty {
  cursor: default;
  border-style: dashed;
  color: var(--muted);
}

.dash-card.is-empty:hover {
  background: #fff;
}

/* ========== Detail + preview ========== */
.dash-detail {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.dash-description {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.dash-description h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.dash-description ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.6;
  font-size: 14px;
  color: var(--text);
}

.dash-description li {
  margin-bottom: 6px;
}

.dash-description li:last-child {
  margin-bottom: 0;
}

/* ========== Code snippets ========== */
.dash-snippet {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.dash-snippet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.dash-snippet-copy {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  padding: 3px 10px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.dash-snippet-copy:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.dash-snippet pre {
  margin: 0;
  padding: 14px;
  background: #0d2436;
  color: #dfe8f1;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  overflow-x: auto;
}

.dash-preview {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(1, 65, 108, 0.08);
  overflow: hidden;
  /* Widget Qiscus mem-posisikan popup-nya (welcome/login-form,
     tinggi hingga 720px) dengan "bottom: 68px" relatif ke viewport
     iframe sendiri — jadi iframe butuh tinggi >= 720+68px supaya
     bagian atas popup tidak ke-crop. 860px kasih ruang lega. */
  min-height: 860px;
}

@media (max-width: 860px) {
  .dash-preview {
    min-height: 700px;
  }
}

.dash-preview-iframe {
  display: block;
  width: 100%;
  height: 860px;
  border: 0;
}

@media (max-width: 860px) {
  .dash-preview-iframe {
    height: 700px;
  }
}

.dash-preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.dash-preview-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.dash-spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  animation: dash-spin 0.7s linear infinite;
}

.dash-preview-error {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 0 16px;
}

.dash-preview-error p {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted, #64748b);
}

.dash-preview-error button {
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.dash-preview-overlay.is-error .dash-spinner {
  display: none;
}

.dash-preview-overlay.is-error .dash-preview-error {
  display: flex;
}

@keyframes dash-spin {
  to {
    transform: rotate(360deg);
  }
}
