/* QR Forge - App Styles
   Built on DesignKit tokens.
   Accent: electric blue for trust/utility feel
   ─────────────────────────────────────────── */

:root {
  --accent:       #3b82f6;
  --accent-dim:   rgba(59, 130, 246, 0.12);
  --accent-glow:  rgba(59, 130, 246, 0.28);
  --accent-hover: #2563eb;
}


/* ═══════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════ */

.site-header {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.logo-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--radius);
  letter-spacing: -0.02em;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.logo-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.2;
}


/* ═══════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════ */

.forge-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  padding: var(--space-xl) 0;
  align-items: start;
}

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


/* ═══════════════════════════════════════════
   INPUT PANEL
   ═══════════════════════════════════════════ */

.input-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}


/* ── Type Tabs ── */

.type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.type-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.type-tab:hover {
  color: var(--text);
  border-color: var(--border-bright);
  background: var(--bg-overlay);
}

.type-tab.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.tab-icon {
  font-size: 15px;
  line-height: 1;
}


/* ── Forms ── */

.type-form {
  display: none;
}
.type-form.active {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
  padding: 10px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-group select {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23999'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.password-wrapper {
  position: relative;
}
.password-wrapper input {
  width: 100%;
  padding-right: 44px;
}
.toggle-password {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 4px 8px;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.toggle-password:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}
.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}


/* ── Customize Section ── */

.customize-section {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
}

.customize-section summary {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.customize-section summary::-webkit-details-marker { display: none; }
.customize-section summary::before {
  content: '\25B6';
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}
.customize-section[open] summary::before {
  transform: rotate(90deg);
}

.customize-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-picker-row input[type="color"] {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  cursor: pointer;
  background: var(--bg-overlay);
}
.color-picker-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker-row input[type="color"]::-webkit-color-swatch { border: none; border-radius: 3px; }

.color-hex {
  flex: 1;
  padding: 8px 10px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-code);
  font-size: 13px;
  text-transform: uppercase;
}

/* Frame & Label picker */
.frame-styles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
  margin: var(--space-md) 0 var(--space-sm);
  padding: 0;
  border: 0;
}
.frame-style-option {
  cursor: pointer;
  display: block;
}
.frame-style-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.frame-style-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-overlay);
  transition: border-color 120ms ease, background-color 120ms ease;
}
.frame-style-option input[type="radio"]:checked + .frame-style-card {
  border-color: var(--accent, #3b82f6);
  background: var(--accent-dim, rgba(59, 130, 246, 0.12));
}
.frame-style-option input[type="radio"]:focus-visible + .frame-style-card {
  outline: 2px solid var(--accent, #3b82f6);
  outline-offset: 2px;
}
.frame-style-name {
  font-size: 12px;
  color: var(--text);
  text-align: center;
}
.frame-style-preview {
  width: 56px;
  height: 56px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  border-radius: 4px;
  overflow: hidden;
}
.frame-preview-qr {
  flex: 1;
  background:
    linear-gradient(45deg, #0f172a 25%, transparent 25%) 0 0/8px 8px,
    linear-gradient(-45deg, #0f172a 25%, transparent 25%) 0 0/8px 8px,
    #fff;
  border-radius: 2px;
}
.frame-preview-none {
  background: #fff;
  border: 1px solid var(--border);
}
.frame-preview-bottom {
  background: #fff;
  padding-bottom: 0;
  gap: 3px;
}
.frame-preview-pill {
  height: 14px;
  background: var(--accent, #3b82f6);
  color: #fff;
  font-size: 7px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  letter-spacing: 0.5px;
}
.frame-preview-top {
  background: #fff;
  gap: 3px;
}
.frame-preview-strip {
  height: 14px;
  background: var(--accent, #3b82f6);
  color: #fff;
  font-size: 7px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
}
.frame-preview-tag {
  background: #fff;
  border: 2px solid var(--accent, #3b82f6);
  gap: 0;
  padding: 1px;
}
.frame-preview-tagbar {
  height: 12px;
  background: var(--accent, #3b82f6);
  color: #fff;
  font-size: 7px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
}
.frame-detail-grid {
  margin-top: var(--space-sm);
}
@media (max-width: 600px) {
  .frame-styles {
    grid-template-columns: repeat(2, 1fr);
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Embedded logo controls */
.logo-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.logo-upload-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.logo-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.logo-file-button {
  cursor: pointer;
}
.logo-file-name {
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logo-clear-btn {
  color: var(--accent, #3b82f6);
}
.logo-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
}
.logo-preview img {
  max-width: 100%;
  max-height: 100%;
  display: block;
}
.logo-size-range {
  width: 100%;
  cursor: pointer;
}
.logo-size-group {
  margin-top: var(--space-xs);
}


/* ═══════════════════════════════════════════
   PREVIEW PANEL
   ═══════════════════════════════════════════ */

.preview-panel {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

@media (max-width: 900px) {
  .preview-panel {
    position: static;
  }
}

.preview-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.qr-preview {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  overflow: hidden;
}

.qr-preview canvas {
  width: 100% !important;
  height: 100% !important;
  border-radius: var(--radius-sm);
  image-rendering: pixelated;
}

.qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-muted);
  font-size: 14px;
}

.placeholder-icon {
  font-size: 48px;
  opacity: 0.3;
}

.qr-data-display {
  font-family: var(--font-code);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-overlay);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  word-break: break-all;
}


/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

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

.btn-secondary {
  background: var(--bg-overlay);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-bright);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.download-actions .btn {
  flex: 1;
  min-width: 120px;
}


/* ── Bulk Section ── */

.bulk-section {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
}

.bulk-section summary {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.bulk-section summary::-webkit-details-marker { display: none; }
.bulk-section summary::before {
  content: '\25B6';
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}
.bulk-section[open] summary::before {
  transform: rotate(90deg);
}

.bulk-section textarea {
  width: 100%;
  margin-top: var(--space-sm);
  padding: 10px 14px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-code);
  resize: vertical;
}
.bulk-section textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  outline: none;
}


/* ═══════════════════════════════════════════
   WHY SECTION
   ═══════════════════════════════════════════ */

.why-section {
  padding: var(--space-3xl) 0 var(--space-2xl);
  border-top: 1px solid var(--border);
  margin-top: var(--space-xl);
}

.why-section h2 {
  text-align: center;
  font-size: 1.75rem;
}

.why-section-lede {
  text-align: center;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.why-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
}

.why-icon {
  font-size: 32px;
  margin-bottom: var(--space-sm);
}

.why-card h3 {
  font-size: 1rem;
  margin-bottom: var(--space-sm);
}

.why-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}


/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */

.site-footer {
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--border);
  margin-top: var(--space-xl);
}

.site-footer p {
  margin: 0;
}


/* ═══════════════════════════════════════════
   DASHBOARD - STATS BAR
   ═══════════════════════════════════════════ */

.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  padding: var(--space-xl) 0 var(--space-lg);
}

.stat-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  text-align: center;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}


/* ═══════════════════════════════════════════
   DASHBOARD - TOOLBAR
   ═══════════════════════════════════════════ */

.dash-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: var(--space-lg);
  align-items: center;
}

.dash-search {
  flex: 1;
  min-width: 200px;
  padding: 8px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
}
.dash-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  outline: none;
}

.dash-filter {
  padding: 8px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23999'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}


/* ═══════════════════════════════════════════
   DASHBOARD - QR CODE GRID
   ═══════════════════════════════════════════ */

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-md);
}

.qr-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  transition: border-color var(--transition-fast);
}
.qr-card:hover {
  border-color: var(--border-bright);
}

.qr-card-thumb {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}
.qr-card-thumb img {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.qr-card-body {
  flex: 1;
  min-width: 0;
}

.qr-card-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-card-meta {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.qr-type-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--accent-dim);
  color: var(--accent);
}

.qr-dynamic-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(39, 174, 96, 0.15);
  color: var(--success);
}

.qr-card-stats {
  display: flex;
  gap: var(--space-md);
}

.qr-card-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-danger-text {
  color: var(--danger);
}
.btn-danger-text:hover {
  background: rgba(231, 76, 60, 0.1);
}


/* ═══════════════════════════════════════════
   DASHBOARD - PAGINATION
   ═══════════════════════════════════════════ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-lg) 0;
}


/* ═══════════════════════════════════════════
   DASHBOARD - EMPTY STATE
   ═══════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: var(--space-3xl) 0;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 1.25rem;
  margin: var(--space-md) 0 var(--space-sm);
  color: var(--text);
}


/* ═══════════════════════════════════════════
   DASHBOARD - LOGIN PROMPT
   ═══════════════════════════════════════════ */

.login-prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
}

.login-box {
  text-align: center;
  max-width: 400px;
  padding: var(--space-2xl);
}

.login-box h2 {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}


/* ═══════════════════════════════════════════
   DASHBOARD - ANALYTICS MODAL
   ═══════════════════════════════════════════ */

.analytics-stats {
  display: flex;
  gap: var(--space-lg);
  margin-top: var(--space-md);
}

.analytics-stat {
  text-align: center;
}
.analytics-stat .stat-value {
  font-size: 1.5rem;
}

.analytics-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 120px;
  padding: var(--space-sm) 0;
  overflow-x: auto;
}

.chart-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 12px;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  width: 100%;
  min-height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  transition: height var(--transition-fast);
}

.chart-bar-label {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
}

.country-list, .device-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.country-row, .device-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  background: var(--bg-overlay);
  border-radius: var(--radius-sm);
  font-size: 13px;
}


/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

@media (max-width: 600px) {
  .type-tabs {
    gap: 4px;
  }
  .type-tab {
    padding: 6px 10px;
    font-size: 12px;
  }
  .tab-icon {
    display: none;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .customize-grid {
    grid-template-columns: 1fr;
  }
  .preview-card {
    padding: var(--space-lg);
  }
  .download-actions .btn {
    min-width: 0;
  }
  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }
  .qr-grid {
    grid-template-columns: 1fr;
  }
  .qr-card {
    flex-direction: column;
  }
  .qr-card-thumb {
    width: 60px;
    height: 60px;
  }
  .qr-card-actions {
    flex-direction: row;
  }
  .dash-toolbar {
    flex-direction: column;
  }
  .dash-search {
    min-width: 100%;
  }
}


/* ═══════════════════════════════════════════
   ACCESSIBILITY - skip link + focus rings
   ═══════════════════════════════════════════ */

.skip-link {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  width: auto;
  height: auto;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  z-index: 1000;
  border-radius: var(--radius);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: inherit;
  text-decoration: none;
}


/* ═══════════════════════════════════════════
   FOOTER (shared via footer.js)
   ═══════════════════════════════════════════ */

.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-xl) 0 var(--space-lg);
  margin-top: var(--space-xl);
  background: var(--bg);
}
.site-footer .container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-md);
  text-align: center;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}
.footer-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-decoration: none;
}
.footer-links a:hover { color: var(--text); }
.footer-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 8px 0;
}
.footer-meta a { color: var(--text-secondary); }
.footer-badge {
  color: var(--text-muted);
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 12px;
}


/* ═══════════════════════════════════════════
   COOKIE CONSENT BANNER
   ═══════════════════════════════════════════ */

.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 950;
  background: var(--bg-raised);
  border-top: 1px solid var(--border);
  padding: var(--space-md);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
}
.cookie-banner-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  justify-content: space-between;
}
.cookie-banner-text {
  font-size: 0.9rem;
  color: var(--text);
  margin: 0;
  flex: 1 1 280px;
}
.cookie-banner-text a { color: var(--accent); }
.cookie-banner-actions {
  display: flex;
  gap: var(--space-sm);
}


/* ═══════════════════════════════════════════
   AUTH PAGES (/login, /passkey-setup)
   ═══════════════════════════════════════════ */

.auth-container {
  display: flex;
  justify-content: center;
  padding: var(--space-xl) var(--space-md);
}
.auth-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  width: 100%;
  max-width: 440px;
}
.auth-card h2 {
  margin-bottom: var(--space-sm);
}
.auth-form {
  margin-top: var(--space-lg);
}
.auth-divider {
  position: relative;
  text-align: center;
  margin: var(--space-lg) 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 24px);
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }
.auth-divider span {
  background: var(--bg-raised);
  padding: 0 var(--space-sm);
  position: relative;
}
.auth-success {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--space-md);
  margin-top: var(--space-lg);
}
.auth-helper {
  display: block;
  margin-top: var(--space-md);
  text-align: center;
}

.btn-block { display: block; width: 100%; }

.form-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 6px;
}
.form-success {
  color: var(--success);
  font-size: 0.85rem;
  margin-top: 6px;
}
input.has-error,
textarea.has-error,
select.has-error {
  border-color: var(--danger);
  outline-color: var(--danger);
}


/* ═══════════════════════════════════════════
   HAMBURGER NAV (< 1024px)
   ═══════════════════════════════════════════ */

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.nav-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.nav-toggle .nav-toggle-icon,
.nav-toggle .nav-toggle-icon::before,
.nav-toggle .nav-toggle-icon::after {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}
.nav-toggle .nav-toggle-icon {
  position: relative;
}
.nav-toggle .nav-toggle-icon::before,
.nav-toggle .nav-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-toggle .nav-toggle-icon::before { top: -7px; }
.nav-toggle .nav-toggle-icon::after  { top:  7px; }

@media (max-width: 1023px) {
  .nav-toggle { display: inline-flex; }
  [data-nav-menu] {
    display: none;
    position: absolute;
    top: 100%;
    right: var(--space-md);
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  }
  [data-nav-menu].open { display: flex; }
}


/* ═══════════════════════════════════════════
   RESPONSIVE BREAKPOINTS - 375 / 1440 / 1920 / 2560
   (768 + 1024 already covered above)
   ═══════════════════════════════════════════ */

@media (max-width: 374px) {
  .container { padding: 0 var(--space-sm); }
  .logo-tagline { display: none; }
}

@media (min-width: 1440px) {
  .container { max-width: 1280px; }
}

@media (min-width: 1920px) {
  .container { max-width: 1400px; }
}

@media (min-width: 2560px) {
  body { font-size: 17px; }
  .container { max-width: 1600px; }
}

/* === Refactored from inline styles in dashboard.js === */

/* Modal headings */
.h-mb-4 { margin-bottom: 4px; }
.h-mb-12 { margin-bottom: 12px; }
.h-mb-16 { margin-bottom: 16px; }
.h-mb-20 { margin-bottom: 20px; }

/* Spacing modifiers */
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mt-16-flex-gap8 { margin-top: 16px; display: flex; gap: 8px; }
.mt-20-flex-gap8 { margin-top: 20px; display: flex; gap: 8px; }
.mt-24-flex-gap8 { margin-top: 24px; display: flex; gap: 8px; }
.section-heading-spaced { margin-top: 20px; margin-bottom: 8px; }

/* Layout */
.flex-1 { flex: 1; }
.row-bordered { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }

/* Inputs */
.color-picker-soft { width: 40px; height: 38px; padding: 2px; }

/* Empty state */
.empty-note-mt16 { margin: 16px 0; }

/* Action buttons */
.btn-danger-inline { background: var(--danger); border-color: var(--danger); }

/* Folder swatch */
.folder-swatch { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

/* Bar chart */
.chart-bar-dyn { /* width set via JS height attribute */ }
.btn-tiny { font-size: 11px; }

/* ═══════════════════════════════════════════
   API KEYS SECTION (dashboard)
   ═══════════════════════════════════════════ */

.api-keys-section {
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
}
.api-keys-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}
.api-keys-header h2 {
  margin: 0 0 4px;
  font-size: 1.5rem;
}
.api-keys-lede {
  margin: 0;
  max-width: 720px;
}
.api-keys-lede code {
  background: var(--bg-overlay);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font-code);
}
.api-keys-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
}
.api-keys-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.api-keys-table thead th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-overlay);
  border-bottom: 1px solid var(--border);
}
.api-keys-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.api-keys-table tbody tr:last-child td { border-bottom: none; }
.api-keys-actions-col,
.api-keys-actions-cell { text-align: right; }
.api-key-prefix {
  font-family: var(--font-code);
  font-size: 13px;
  background: var(--bg-overlay);
  padding: 4px 8px;
  border-radius: 4px;
}
.api-key-badge {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.api-key-badge-revoked {
  background: rgba(220, 53, 69, 0.15);
  color: #dc3545;
}
.api-key-row-revoked { opacity: 0.55; }
.api-key-revoke-btn { color: #dc3545; }

.api-keys-empty {
  padding: var(--space-md) 0;
}

/* ═══════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
}
.modal-panel {
  position: relative;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}
.modal-panel h3 {
  margin-top: 0;
  margin-bottom: var(--space-sm);
}
.modal-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-top: var(--space-lg);
}
body.modal-open {
  overflow: hidden;
}

.api-key-reveal {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-sm) var(--space-md);
  margin-top: var(--space-md);
}
.api-key-plaintext {
  flex: 1;
  font-family: var(--font-code);
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
  overflow-wrap: anywhere;
}
.api-key-curl {
  margin-top: var(--space-md);
}
.api-key-curl-block {
  background: #0f172a;
  color: #e2e8f0;
  padding: var(--space-md);
  border-radius: var(--radius);
  font-family: var(--font-code);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}
@media (max-width: 600px) {
  .api-keys-table thead { display: none; }
  .api-keys-table tbody td {
    display: block;
    padding: 8px 16px;
  }
  .api-keys-table tbody tr {
    border-bottom: 1px solid var(--border);
  }
  .api-keys-actions-cell { text-align: left; }
}

/* ═══════════════════════════════════════════
   CUSTOM DOMAINS SECTION (dashboard)
   ═══════════════════════════════════════════ */

.custom-domains-section {
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
}
.custom-domains-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}
.custom-domains-header h2 {
  margin: 0 0 4px;
  font-size: 1.5rem;
}
.custom-domains-lede {
  margin: 0;
  max-width: 720px;
}
.custom-domains-lede code {
  background: var(--bg-overlay);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font-code);
}
.custom-domains-locked {
  padding: var(--space-md);
  background: var(--bg-overlay);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.custom-domains-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
}
.custom-domains-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.custom-domains-table thead th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-overlay);
  border-bottom: 1px solid var(--border);
}
.custom-domains-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.custom-domains-table tbody tr:last-child td { border-bottom: none; }
.custom-domains-actions-col,
.custom-domains-actions-cell { text-align: right; white-space: nowrap; }
.custom-domains-actions-cell .btn { margin-left: 6px; }
.custom-domains-empty { padding: var(--space-md) 0; }

.cd-row-revoked { opacity: 0.55; }
.cd-remove-btn { color: #dc3545; }
.cd-failure-reason { margin: 6px 0 0; max-width: 480px; }

.cd-badge {
  display: inline-block;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cd-badge-pending {
  background: rgba(234, 179, 8, 0.15);
  color: #b97700;
}
.cd-badge-verifying {
  background: rgba(59, 130, 246, 0.18);
  color: #2563eb;
}
.cd-badge-active {
  background: rgba(34, 197, 94, 0.18);
  color: #16a34a;
}
.cd-badge-failed {
  background: rgba(220, 53, 69, 0.15);
  color: #dc3545;
}
.cd-badge-revoked {
  background: rgba(148, 163, 184, 0.18);
  color: #64748b;
}

.modal-panel-wide { max-width: 720px; }
.dns-step-heading {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
  font-size: 1rem;
  font-weight: 600;
}
.dns-record-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.dns-record-table th,
.dns-record-table td {
  padding: 10px 14px;
  font-size: 13px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.dns-record-table tr:last-child th,
.dns-record-table tr:last-child td { border-bottom: none; }
.dns-record-table th {
  width: 110px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dns-record-table code {
  font-family: var(--font-code);
  font-size: 12px;
  background: var(--bg-raised);
  padding: 2px 6px;
  border-radius: 4px;
  word-break: break-all;
  overflow-wrap: anywhere;
}
.dns-tip {
  margin-top: var(--space-md);
  padding: 8px 12px;
  background: var(--bg-overlay);
  border-left: 3px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
}

@media (max-width: 600px) {
  .custom-domains-table thead { display: none; }
  .custom-domains-table tbody td {
    display: block;
    padding: 8px 16px;
  }
  .custom-domains-table tbody tr {
    border-bottom: 1px solid var(--border);
  }
  .custom-domains-actions-cell { text-align: left; }
}

/* Display URL chip on QR detail modal + grid card */
.display-url {
  display: block;
  font-family: var(--font-code);
  font-size: 13px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 6px;
  word-break: break-all;
  overflow-wrap: anywhere;
}
.qr-card-display-url {
  margin-top: 6px;
  font-family: var(--font-code);
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-all;
  line-height: 1.3;
}
.qr-card-display-url-custom {
  color: var(--accent, #3B82F6);
}
