/* Style Tokens & Root */
:root {
  color-scheme: light;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  color: #334155;
  background-color: #f8fafc;
}

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

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  min-height: 100vh;
  background-color: #fafafa;
  background-image: 
    radial-gradient(at 0% 0%, hsla(253,16%,7%,0) 0, transparent 50%), 
    radial-gradient(at 50% 0%, rgba(99, 102, 241, 0.05) 0, transparent 50%),
    radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.03) 0, transparent 40%);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}

/* --- Navigation Header --- */
.app-header {
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-container {
  max-width: 100%;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.2rem;
  color: #0f172a;
  letter-spacing: -0.02em;
}
.logo svg {
  color: #4f46e5;
  transform: rotate(-10deg);
}
.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid #e2e8f0;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

/* --- Layout --- */
.page-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 10px 24px 36px;
  flex: 1;
  width: 100%;
}

/* --- Hero Section --- */
.hero-section {
  text-align: center;
  margin-bottom: 16px;
}
.hero-content {
  max-width: 780px;
  margin: 0 auto;
}
.hero-eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.75rem;
  font-weight: 800;
  color: #4f46e5;
  background: rgba(79, 70, 229, 0.07);
  padding: 6px 16px;
  border-radius: 99px;
  margin-bottom: 20px;
}
.hero-content h1 {
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #0f172a;
  line-height: 1.1;
  margin-bottom: 20px;
}
.gradient-text {
  background: linear-gradient(135deg, #4f46e5, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-subtitle {
  font-size: 1.15rem;
  color: #475569;
  line-height: 1.6;
}

/* --- Central Tool Dashboard --- */
.dashboard-section {
  max-width: 100%;
  margin: 0 auto 36px;
}
.dashboard-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  box-shadow: 
    0 20px 25px -5px rgba(0, 0, 0, 0.04), 
    0 10px 10px -5px rgba(0, 0, 0, 0.02),
    0 0 1px rgba(0, 0, 0, 0.1) inset;
  overflow: hidden;
}
.card-header {
  padding: 20px 24px 0;
  border-bottom: 0;
}
.card-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.card-header p {
  font-size: 0.85rem;
  color: #64748b;
}

.preview-form {
  padding: 20px 24px 24px;
  display: grid;
  gap: 16px;
}

/* Form Groups & Inputs */
.form-group {
  display: grid;
  gap: 6px;
}
.form-group label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.01em;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}

/* Input / Select with Icon wrapper */
.input-with-icon, .select-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon, .select-icon {
  position: absolute;
  left: 14px;
  color: #94a3b8;
  pointer-events: none;
}
.input-with-icon input, .select-with-icon select {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-with-icon input:focus, .select-with-icon select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}
.input-with-icon input::placeholder {
  color: #94a3b8;
}

/* --- URL Input specific layout --- */
.url-scan-row {
  display: flex;
  gap: 8px;
  width: 100%;
}
.url-scan-row input {
  flex: 1;
}
.scan-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 700;
  background: #0f172a;
  color: #ffffff;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, transform 0.1s;
}
.scan-btn:hover { background-color: #1e293b; }
.scan-btn:active { transform: translateY(1px); }
.scan-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.scan-btn.scanning svg { animation: spin 0.9s linear infinite; }

/* --- Slot Picker & Chips --- */
.slot-picker-wrap {
  display: grid;
  gap: 10px;
}
.slot-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.slot-picker-header label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
}
.select-with-icon select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px;
}
.scan-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.scan-badge.hidden { display: none; }
.scan-badge.success { background: #d1fae5; border: 1px solid #a7f3d0; color: #065f46; }
.scan-badge.warn { background: #fef3c7; border: 1px solid #fde68a; color: #92400e; }
.scan-badge.error { background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; }

.scan-status {
  font-size: 0.8rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.scan-status.hidden { display: none; }
.scan-status.scanning { color: #4f46e5; }
.scan-status.error { color: #b91c1c; }

.slot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.slot-chips.hidden { display: none; }
.slot-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  transition: all 0.15s ease;
  user-select: none;
}
.slot-chip:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}
.slot-chip.active {
  background-color: #e0e7ff;
  border-color: #6366f1;
  color: #4f46e5;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}
.slot-chip .chip-size {
  font-size: 0.72rem;
  opacity: 0.72;
  font-weight: 400;
}

/* ── Static Sidebar Previews (Gutters) ────────────────────── */
.gutter-container {
  position: fixed;
  top: 110px;
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
  user-select: none;
}
.gutter-left {
  left: 12px;
  top: 75px; /* Shift the tall 300x600 slot higher up */
}
.gutter-right {
  right: 12px;
}
.gutter-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
}
.static-ad-slot {
  background: #ffffff;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.static-ad-slot:hover {
  border-color: #94a3b8;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.05);
}
.slot-300x600 {
  height: 600px;
  width: 300px;
}
.slot-300x250 {
  height: 250px;
  width: 300px;
}
.slot-placeholder {
  font-size: 0.85rem;
  font-weight: 600;
  color: #94a3b8;
  text-align: center;
}

/* Stacked ads inside 300x600 mockup */
.mockup-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  height: 100%;
  padding: 10px;
  background: #ffffff;
}
.mockup-stack a {
  display: block;
  width: 100%;
  height: calc(50% - 5px); /* Half height minus half of the 10px gap */
  border-radius: 6px;
  overflow: hidden;
}
.mockup-stack img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  border: 0;
  display: block;
}

/* Single ad link inside mockup */
.mockup-single-link {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
/* -------------------------------------------------------------
   VOICE TO TEXT STYLES
------------------------------------------------------------- */
@keyframes pulse-recording {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  }
  70% {
    box-shadow: 0 0 0 20px rgba(239, 68, 68, 0);
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  }
}

#btn-mic-toggle.recording {
  animation: pulse-recording 2s infinite;
}
.mockup-single-link img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  border: 0;
  display: block;
}

/* Responsive: prevent overlap and hide on small screens */
@media (max-width: 1440px) {
  .dashboard-section, .features-section {
    max-width: 740px;
  }
}

@media (max-width: 1350px) {
  .gutter-container {
    display: none;
  }
}


/* --- Upload Area --- */
.upload-zone {
  position: relative;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  transition: border-color 0.2s, background-color 0.2s;
  cursor: pointer;
  overflow: hidden;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: #6366f1;
  background-color: #f5f3ff;
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 36px 20px;
  color: #64748b;
  text-align: center;
}
.upload-placeholder svg {
  color: #94a3b8;
}
.upload-placeholder span {
  font-size: 0.9rem;
  font-weight: 600;
  color: #475569;
}
.text-link {
  color: #4f46e5;
  text-decoration: underline;
}
.upload-placeholder small {
  font-size: 0.78rem;
  color: #64748b;
}

.upload-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
}
.upload-preview.hidden { display: none; }
.upload-placeholder.hidden { display: none; }
.upload-preview img {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f1f5f9;
}
.preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
  pointer-events: all;
  z-index: 3;
}
.preview-meta span {
  font-size: 0.8rem;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
#remove-img {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #fca5a5;
  background: #fee2e2;
  color: #b91c1c;
  cursor: pointer;
  transition: all 0.15s;
}
#remove-img:hover {
  background-color: #fecaca;
  border-color: #f87171;
}

/* --- Submit Button --- */
.submit-btn {
  border: 0;
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  color: white;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
  transition: all 0.2s;
}
.submit-btn:hover {
  opacity: 0.95;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}
.submit-btn:active {
  transform: translateY(1px);
}

/* --- Generated Preview Card --- */
.result-card {
  max-width: 800px;
  margin: 0 auto 48px;
  padding: 36px 40px;
  border-radius: 24px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 30px -10px rgba(2, 6, 23, 0.08);
}
.result-card.hidden { display: none; }
.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #065f46;
  background: #d1fae5;
  padding: 6px 14px;
  border-radius: 99px;
  margin-bottom: 16px;
}
.result-card h2 {
  font-size: 1.5rem;
  color: #0f172a;
  margin-bottom: 8px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.result-card p {
  color: #475569;
  margin-bottom: 24px;
  font-size: 0.95rem;
}
.result-actions {
  display: flex;
  gap: 12px;
}
.result-actions a, .result-actions button {
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}
.result-actions a {
  background: #0f172a;
  color: #ffffff;
  border: 0;
}
.result-actions a:hover {
  background: #1e293b;
}
.result-actions button {
  background: #ffffff;
  color: #0f172a;
}
.result-actions button:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

/* --- Features Grid --- */
.features-section {
  border-top: 1px solid #e2e8f0;
  padding-top: 56px;
  margin: 16px auto 0;
  max-width: 800px;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 32px;
}
.feature-card {
  background: #ffffff;
  padding: 24px;
  border-radius: 16px;
  border: 1px solid #f1f5f9;
  transition: transform 0.2s, box-shadow 0.2s;
}
.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.02);
}
.feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.feature-icon.bg-indigo { background: rgba(79, 70, 229, 0.08); color: #4f46e5; }
.feature-icon.bg-blue { background: rgba(59, 130, 246, 0.08); color: #2563eb; }
.feature-icon.bg-violet { background: rgba(139, 92, 246, 0.08); color: #7c3aed; }
.feature-icon.bg-emerald { background: rgba(16, 185, 129, 0.08); color: #059669; }

.feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}
.feature-card p {
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.5;
}

/* --- Footer --- */
.app-footer {
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  padding: 16px 24px;
  text-align: center;
  background: #ffffff;
}
.app-footer p {
  font-size: 0.8rem;
  color: #94a3b8;
}

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

/* --- Creative Type Toggle --- */
.creative-type-toggle {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  width: fit-content;
}
.toggle-tab {
  border: 0;
  background: transparent;
  padding: 8px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #64748b;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.toggle-tab:hover {
  color: #0f172a;
}
.toggle-tab.active {
  background: #ffffff;
  color: #4f46e5;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* --- Code Editor Textarea --- */
.code-editor-wrapper {
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  overflow: hidden;
  background: #0f172a;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.code-editor-wrapper textarea {
  width: 100%;
  height: 180px;
  border: 0;
  padding: 16px;
  font-family: 'Fira Code', 'Courier New', Courier, monospace;
  font-size: 0.88rem;
  color: #f8fafc;
  background: #0f172a;
  resize: vertical;
  line-height: 1.5;
  outline: none;
  box-sizing: border-box;
}
.form-help-text {
  display: block;
  margin-top: 6px;
  font-size: 0.75rem;
  color: #64748b;
}

/* --- Iframe Preview Container --- */
.iframe-preview-wrapper {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}
.tag-preview-iframe {
  width: 100%;
  height: 250px;
  border: 0;
  display: block;
}

/* --- Share Container & Dropdown --- */
.share-container {
  position: relative;
  display: inline-block;
}
.share-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
  min-width: 160px;
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 4px;
  z-index: 100;
}
.share-dropdown.hidden {
  display: none;
}
.share-dropdown a {
  border: 0 !important;
  border-radius: 8px !important;
  padding: 10px 14px !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  color: #334155 !important;
  background: transparent !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  transition: background-color 0.15s !important;
  cursor: pointer !important;
  text-decoration: none !important;
}
.share-dropdown a:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}
.share-dropdown svg {
  color: #64748b;
  flex-shrink: 0;
}

/* Global Hidden Utility */
.hidden {
  display: none !important;
}

/* --- Header Alignments --- */
.header-container {
  display: flex;
  align-items: center;
  gap: 32px;
}
.header-badge {
  margin-left: auto;
}

/* --- Header Navigation Tabs --- */
.header-tabs {
  display: flex;
  gap: 8px;
}
.header-tab {
  background: transparent;
  border: 0;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: #64748b;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.header-tab:hover {
  color: #0f172a;
  background: #f1f5f9;
}
.header-tab.active {
  color: #4f46e5;
  background: rgba(79, 70, 229, 0.08);
}

/* --- Coming Soon Section --- */
.coming-soon-section {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 80px 24px;
  animation: fadeInPage 0.3s ease;
}
.coming-soon-card {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 24px;
  padding: 48px 32px;
  max-width: 480px;
  text-align: center;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.05), 0 10px 10px -5px rgba(0,0,0,0.02);
}
.coming-soon-icon {
  width: 80px;
  height: 80px;
  background: rgba(79, 70, 229, 0.05);
  color: #4f46e5;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}
.coming-soon-card h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}
.coming-soon-badge {
  display: inline-block;
  background: rgba(245, 158, 11, 0.08);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.2);
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  margin-bottom: 20px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.coming-soon-description {
  font-size: 0.95rem;
  color: #64748b;
  line-height: 1.6;
}

@keyframes fadeInPage {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Tag Checker Grid Layout --- */
.tagchecker-section {
  padding: 40px 24px;
  max-width: 1120px;
  margin: 0 auto;
  animation: fadeInPage 0.35s ease;
}

/* --- PDF Editor Full Width Override --- */
#page-pdfeditor {
  /* break out of .page-shell max-width and padding */
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  width: 100vw;
  box-sizing: border-box;
  animation: fadeInPage 0.35s ease;
}
.pdf-editor-section {
  padding: 24px 32px;
  width: 100%;
  box-sizing: border-box;
}
.tagchecker-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr 1fr;
  gap: 24px;
}
@media (max-width: 1200px) {
  .tagchecker-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 800px) {
  .tagchecker-grid {
    grid-template-columns: 1fr;
  }
}
.tagchecker-card {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02), 0 2px 4px -1px rgba(0,0,0,0.01);
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.tagchecker-card h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.tagchecker-card-desc {
  font-size: 0.88rem;
  color: #64748b;
  margin-bottom: 24px;
  line-height: 1.4;
}

/* Instructions card */
.instructions-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  margin-top: 24px;
}
.instructions-card h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
}
.instructions-list {
  padding-left: 18px;
  margin: 0;
}
.instructions-list li {
  font-size: 0.82rem;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 8px;
}
.instructions-list li:last-child {
  margin-bottom: 0;
}

/* Diagnostic / Meta Info */
.tag-meta-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  margin-top: 24px;
}
.tag-meta-card h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 16px;
}
.meta-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed #e2e8f0;
}
.meta-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.meta-row:first-child {
  padding-top: 0;
}
.meta-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
}
.meta-value {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
}

/* Live Preview Frame elements */
.checker-preview-frame-container {
  flex-grow: 1;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  min-height: 320px;
}
.checker-preview-frame-wrapper {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  overflow: hidden;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.checker-placeholder-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #94a3b8;
}
.checker-placeholder-state span {
  font-size: 0.88rem;
  font-weight: 600;
}
#checker-preview-iframe {
  border: 0;
  display: block;
}

/* --- Top Leaderboard Ad Slot --- */
.top-leaderboard-ad {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
  margin-top: 16px;
}
.top-ad-label {
  font-size: 0.68rem;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.slot-728x90 {
  width: 728px;
  height: 90px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  background: #ffffff;
}
.slot-728x90 img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Gutter Hiding Utility */
body.hide-gutters .gutter-container {
  display: none !important;
}

/* --- Tag Details & Diagnostics --- */
.tag-details-table {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.diagnostic-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.diagnostic-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.diagnostic-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
}
.diagnostic-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  background: #e2e8f0;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.diagnostic-badge.secure {
  background: rgba(16, 185, 129, 0.08);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.diagnostic-badge.warning {
  background: rgba(245, 158, 11, 0.08);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.2);
}
.diagnostic-badge.info {
  background: rgba(79, 70, 229, 0.08);
  color: #4f46e5;
  border: 1px solid rgba(79, 70, 229, 0.2);
}
.diagnostic-badge.click-url-badge {
  background: rgba(59, 130, 246, 0.08);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.2);
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
}
.diagnostic-badge.click-url-badge:hover {
  background: rgba(59, 130, 246, 0.15);
}
.diagnostic-meta {
  font-size: 0.76rem;
  color: #64748b;
  line-height: 1.35;
}

/* --- Tag Checker Inner Tabs --- */
.checker-tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 28px;
  padding-bottom: 2px;
}
.checker-nav-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 12px 24px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: -4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.checker-nav-tab:hover {
  color: #0f172a;
}
.checker-nav-tab.active {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
}
.badge-count {
  font-size: 0.7rem;
  font-weight: 700;
  background: #f1f5f9;
  color: #64748b;
  padding: 2px 6px;
  border-radius: 999px;
  transition: all 0.15s ease;
}
.checker-nav-tab.active .badge-count {
  background: rgba(79, 70, 229, 0.1);
  color: #4f46e5;
}

/* Tab Panels */
.checker-tab-content-panel {
  animation: fadeInPage 0.3s ease;
}
.checker-tab-content-panel.hidden {
  display: none !important;
}

/* --- Multi Previews Grid --- */
.checker-multi-previews-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 24px;
  align-items: start;
}
.checker-preview-card-item {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.02);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.checker-preview-card-item h4 {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.checker-preview-card-item .checker-preview-frame-container {
  min-height: 280px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
}

/* --- Stash Table --- */
.stash-table-wrapper {
  overflow-x: auto;
  margin-top: 16px;
}
.stash-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.stash-table th,
.stash-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.88rem;
}
.stash-table th {
  font-weight: 700;
  color: #475569;
  background: #f8fafc;
}
.stash-table td {
  color: #0f172a;
}
.stash-snippet-code {
  font-family: monospace;
  font-size: 0.78rem;
  background: #f1f5f9;
  padding: 4px 8px;
  border-radius: 6px;
  color: #334155;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.stash-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.stash-btn {
  background: transparent;
  border: 0;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.1s ease;
}
.stash-btn.btn-load {
  color: #4f46e5;
  background: rgba(79, 70, 229, 0.06);
}
.stash-btn.btn-load:hover {
  background: rgba(79, 70, 229, 0.12);
}
.stash-btn.btn-delete {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.06);
}
.stash-btn.btn-delete:hover {
  background: rgba(239, 68, 68, 0.12);
}

/* --- Wide Screen Two Column Dashboard Grid --- */
.dashboard-columns-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 48px;
}
@media (max-width: 1024px) {
  .dashboard-columns-grid {
    grid-template-columns: 1fr;
  }
}
.dashboard-column-left,
.dashboard-column-right {
  display: flex;
  flex-direction: column;
}
.dashboard-column-right .preview-card {
  height: 100%;
}

/* --- Slot Status Row & Pill --- */
.slot-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.slot-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
  flex: 1;
}
.slot-status-pill.selected {
  background: rgba(34, 197, 94, 0.1);
  color: #15803d;
  border-color: rgba(34, 197, 94, 0.35);
}
.slot-status-pill svg {
  flex-shrink: 0;
}

/* --- Refresh Slots Button --- */
.refresh-slots-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.refresh-slots-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

/* --- Preview Slot Badge (top right of preview card) --- */
.preview-slot-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
  border: 1px solid rgba(34, 197, 94, 0.3);
  letter-spacing: 0.02em;
}

/* --- Site Preview Container --- */
.site-preview-container {
  flex-grow: 1;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  margin: 0 16px 16px;
  transition: min-height 0.3s ease;
}

/* Placeholder state */
.site-preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 24px;
  text-align: center;
  color: #94a3b8;
}
.site-preview-placeholder svg { color: #cbd5e1; }
.site-preview-placeholder p {
  font-size: 0.9rem;
  font-weight: 600;
  color: #64748b;
  margin: 0;
}
.site-preview-placeholder small {
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.5;
  max-width: 320px;
}

/* Loading spinner state */
.site-preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #f8fafc;
  z-index: 10;
}
.site-preview-loading p {
  font-size: 0.82rem;
  color: #64748b;
  font-weight: 500;
  margin: 0;
}
.preview-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e2e8f0;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin-preview 0.7s linear infinite;
}
@keyframes spin-preview {
  to { transform: rotate(360deg); }
}

/* Scaled iframe wrapper */
.site-preview-scaler {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
}
.site-preview-scaler iframe {
  display: block;
  background: #fff;
}

/* --- Global Mobile Responsiveness --- */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
  width: 100% !important;
}

@media (max-width: 1024px) {
  .page-shell {
    padding: 20px 16px;
    max-width: 100vw;
    box-sizing: border-box;
  }
  .header-container {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 12px;
    max-width: 100vw;
    box-sizing: border-box;
  }
  .header-badge {
    display: none; /* Hide badge on smaller screens to save space */
  }
  .header-tabs {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 4px; /* for scrollbar */
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    scrollbar-width: none; /* Firefox */
    box-sizing: border-box;
  }
  .header-tabs::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }
  .header-tab {
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 0.85rem;
    flex-shrink: 0;
  }
  .glass-card, .dashboard-card {
    padding: 16px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .hero-content h1 {
    font-size: 2rem !important;
    word-break: break-word;
  }
}

@media (max-width: 768px) {
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }
  /* Ensure inputs and buttons stretch fully */
  .preview-form button {
    width: 100%;
  }
  .hero-eyebrow {
    font-size: 0.7rem;
  }
  .dashboard-columns-grid, .specs-grid, .checker-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* --- Voice to Text Mobile Responsiveness --- */
  .voicetotext-section, .translator-section {
    padding: 12px 8px !important;
    min-height: auto !important;
  }
  .voicetotext-container, .translator-container {
    flex-direction: column !important;
    min-height: auto !important;
    border-radius: 16px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .voicetotext-left, .translator-left {
    flex: none !important;
    width: 100% !important;
    padding: 20px 16px !important;
    border-right: none !important;
    border-bottom: 1px solid #e2e8f0 !important;
    box-sizing: border-box !important;
  }
  .voicetotext-left h2, .translator-left h2 {
    font-size: 1.5rem !important;
    margin-bottom: 4px !important;
  }
  .voicetotext-left p, .translator-left p {
    font-size: 0.88rem !important;
    margin-bottom: 16px !important;
  }
  .voice-controls {
    margin: 20px 0 !important;
  }
  #btn-mic-toggle {
    width: 76px !important;
    height: 76px !important;
  }
  #btn-mic-toggle svg {
    width: 32px !important;
    height: 32px !important;
  }
  #mic-pulse-ring {
    width: 96px !important;
    height: 96px !important;
  }
  #voice-status {
    font-size: 1rem !important;
    margin-top: 12px !important;
  }
  .voicetotext-right, .translator-right {
    flex: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .voicetotext-toolbar, .translator-toolbar {
    padding: 12px 16px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  #voice-text-area, #translator-extracted-text {
    min-height: 200px !important;
    height: 220px !important;
    padding: 16px !important;
    font-size: 1rem !important;
    line-height: 1.6 !important;
  }
  .voicetotext-footer, .translator-footer {
    padding: 16px !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 10px !important;
    box-sizing: border-box !important;
  }
  .voicetotext-footer button, .translator-footer button {
    width: 100% !important;
    justify-content: center !important;
  }
}


/* Feedback Widget */
#feedback-widget {
  position: fixed;
  bottom: 80px;
  left: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.feedback-btn {
  background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 99px;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
  cursor: pointer;
  transition: all 0.2s ease;
}
.feedback-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.5);
}

.feedback-modal {
  position: absolute;
  bottom: 60px;
  left: 0;
  width: 340px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform-origin: bottom left;
}
.feedback-modal.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95) translateY(10px);
}

.feedback-header {
  padding: 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.feedback-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: #0f172a;
}
.feedback-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}
.feedback-close:hover {
  color: #0f172a;
}

.feedback-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
}
.feedback-body p {
  font-size: 0.85rem;
  color: #475569;
  margin: 0 0 16px 0;
}

.feedback-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}
.label-with-mic {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.feedback-group label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0;
}
.mic-btn-small {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  color: #2563eb;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 3px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.mic-btn-small:hover {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}
.mic-btn-small.listening {
  background: #ef4444;
  color: #ffffff;
  border-color: #dc2626;
  animation: pulse-recording 1.5s infinite;
}
@keyframes pulse-recording {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.feedback-group input,
.feedback-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.85rem;
  background: #ffffff;
  color: #0f172a;
  outline: none;
  transition: border-color 0.2s;
}
.feedback-group input:focus,
.feedback-group textarea:focus {
  border-color: #2563eb;
}

#feedback-submit {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border: none;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
}
#feedback-submit:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.45);
}

#feedback-status {
  margin-top: 12px;
  font-size: 0.8rem;
  text-align: center;
  font-weight: 600;
}
#feedback-status.success { color: #16a34a; }
#feedback-status.error { color: #dc2626; }
