/* ============================================================================
   Publisher web app — dark glassmorphic theme
   Adapted from frontend/references/makeitpop-design-system.css.
   The app uses Tailwind-CDN utilities; rather than rewrite every class, this
   file re-maps the specific utilities the shell uses to a dark palette (scoped
   under body, !important to beat Tailwind's runtime utilities). The generated
   document preview lives in a separate <iframe> document and is NOT affected.
   ============================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Audiowide&display=swap');

:root {
  --bg-primary:    #121212;
  --bg-secondary:  #0d0d0d;
  --bg-card:       rgba(255, 255, 255, 0.06);
  --bg-card-hover: rgba(255, 255, 255, 0.10);
  --bg-glass:      rgba(0, 0, 0, 0.40);
  --bg-glass-heavy:rgba(18, 18, 18, 0.92);

  --accent-blue:   #3b82f6;
  --accent-green:  #4ade80;
  --accent-red:    #ef4444;

  --text-primary:   #ffffff;
  --text-secondary: #e0e0e0;
  --text-muted:     #9ca3af;

  --border-glass:       rgba(255, 255, 255, 0.10);
  --border-glass-thick: rgba(255, 255, 255, 0.20);

  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --transition-fast: all 0.15s ease-in-out;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  --font-logo: 'Audiowide', sans-serif;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
body {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

/* Premium thin scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.30); }

/* ── Tailwind utility re-map (app chrome only) ─────────────────────────────── */
body .bg-white            { background: var(--bg-card) !important; }
body .bg-gray-50          { background: rgba(255,255,255,0.03) !important; }
body .bg-gray-100         { background: var(--bg-secondary) !important; }
body .bg-gray-900         { background: var(--bg-glass) !important; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }

body .text-gray-900,
body .text-gray-800       { color: var(--text-primary) !important; }
body .text-gray-700,
body .text-gray-600       { color: var(--text-secondary) !important; }
body .text-gray-500,
body .text-gray-400       { color: var(--text-muted) !important; }

body .border-gray-200,
body .border-gray-300     { border-color: var(--border-glass) !important; }

body .hover\:bg-gray-50:hover,
body .hover\:bg-gray-100:hover,
body .hover\:bg-gray-200:hover,
body .hover\:bg-blue-50:hover { background: var(--bg-card-hover) !important; }

body .bg-blue-50          { background: rgba(59,130,246,0.14) !important; }
body .bg-blue-600         { background: var(--accent-blue) !important; }
body .hover\:bg-blue-700:hover { background: #2563eb !important; }
body .text-blue-600,
body .text-blue-700,
body .text-blue-800,
body .text-blue-500       { color: var(--accent-blue) !important; }

body .bg-red-100          { background: rgba(239,68,68,0.18) !important; }
body .text-red-500,
body .text-red-600,
body .text-red-700        { color: #f87171 !important; }

body .bg-gray-800         { background: rgba(255,255,255,0.10) !important; }
body .hover\:bg-gray-900:hover { background: rgba(255,255,255,0.18) !important; }

/* Form controls */
body input[type="text"],
body input[type="file"],
body select,
body textarea {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-glass) !important;
}
body select option { background: #1a1a1a; color: var(--text-primary); }
body input::placeholder, body textarea::placeholder { color: var(--text-muted) !important; }
body input:disabled, body textarea:disabled { background: rgba(255,255,255,0.03) !important; color: var(--text-muted) !important; }

/* Panes get a hairline glass divider feel */
body aside, body header { border-color: var(--border-glass) !important; }

/* Logo wordmark */
.app-logo { font-family: var(--font-logo); letter-spacing: -0.02em; }

/* ── Faster generation blink (≈0.45s) ──────────────────────────────────────── */
@keyframes fastblink { 0%,100% { opacity: 1; } 50% { opacity: 0.15; } }
.fast-blink { animation: fastblink 0.45s steps(1, end) infinite; }
/* Make Tailwind's animate-pulse on status dots much faster too */
body .animate-pulse { animation: fastblink 0.45s steps(1, end) infinite !important; }

/* ── Custom dropdown (Download, Run split, selects) ────────────────────────── */
.pub-dd { position: relative; display: inline-flex; }
.pub-dd-menu {
  position: fixed;
  min-width: 160px;
  z-index: 9999;
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.8);
  padding: 0.35rem;
  display: flex; flex-direction: column; gap: 2px;
  opacity: 0; transform: translateY(-8px) scale(0.98); pointer-events: none;
  transition: opacity 0.18s ease-out, transform 0.18s cubic-bezier(0.34,1.56,0.64,1);
}
.pub-dd.open .pub-dd-menu { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.pub-dd-item {
  display: flex; align-items: center; gap: 0.5rem;
  width: 100%; text-align: left;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-md);
  background: transparent; border: none;
  color: var(--text-secondary); font-size: 0.78rem; font-weight: 500;
  cursor: pointer; transition: var(--transition-fast); text-decoration: none;
}
.pub-dd-item:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.pub-dd-item[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }
.pub-dd-caret { transition: transform 0.2s ease; }
.pub-dd.open .pub-dd-caret { transform: rotate(180deg); }

/* ── Collapsible panels (right sidebar) ─────────────────────────────────────── */
.pub-panel-hdr {
  background: transparent; border: none; cursor: pointer;
  transition: background var(--transition-fast);
}
.pub-panel-hdr:hover { background: var(--bg-card); }

.pub-panel-body {
  overflow: visible;
  max-height: 600px;   /* generous default — content fits */
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity   0.2s ease;
  opacity: 1;
}
.pub-panel-body.collapsed { max-height: 0 !important; overflow: hidden; opacity: 0; }

.rotate-neg90 { transform: rotate(-90deg); }
/* Chevron flips when the panel is open */
[aria-expanded="true"] .transition-transform,
.open > .transition-transform { transform: rotate(0deg); }
[aria-expanded="false"] .transition-transform { transform: rotate(-90deg); }

/* ── Buttons (glass + primary) ─────────────────────────────────────────────── */
.pub-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.45rem 0.8rem; border-radius: var(--radius-lg);
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: var(--transition-fast);
  color: #fff; text-decoration: none;
}
.pub-btn-primary { background: var(--accent-blue); }
.pub-btn-primary:hover { background: #2563eb; transform: translateY(-1px); }
.pub-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.pub-btn-glass {
  background: rgba(255,255,255,0.12);
  border: 1px solid var(--border-glass-thick);
  color: var(--text-primary);
}
.pub-btn-glass:hover { background: rgba(255,255,255,0.20); }

/* Split-button: primary action + caret share one rounded shell */
.pub-split { display: inline-flex; align-items: stretch; }
.pub-split .pub-btn { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pub-split .pub-split-caret {
  border-top-left-radius: 0; border-bottom-left-radius: 0;
  padding-left: 0.5rem; padding-right: 0.5rem;
  border-left: 1px solid rgba(255,255,255,0.25);
}

/* Glass card for grouped controls (ingest) */
.pub-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
}
