/* === APP SHELL === */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(13, 13, 43, 0.95);
  border-bottom: 1px solid rgba(255, 215, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.logo-glyph { font-size: 1.4rem; }

.logo-text {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold), #fff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-nav { display: flex; gap: 1.5rem; }

.nav-link {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover { color: var(--gold); background: rgba(255,215,0,0.08); }
.nav-link.active { color: var(--gold); background: rgba(255,215,0,0.12); }

/* === GENERATOR PAGE === */
.generator-main {
  max-width: 1300px;
  margin: 0 auto;
  padding: 3rem 2rem 6rem;
}

.generator-hero {
  text-align: center;
  margin-bottom: 3rem;
}

.gen-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--mystery-purple), var(--bright-blue));
  color: white;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 1.2rem;
  border-radius: 50px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.gen-title {
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold) 0%, #fff 50%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.75rem;
}

.gen-subtitle {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.65);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

.generator-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 2rem;
  align-items: start;
}

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

/* === FORM PANEL === */
.form-card {
  background: rgba(26, 26, 78, 0.6);
  border: 1px solid rgba(255, 215, 0, 0.15);
  border-radius: 20px;
  padding: 2rem;
  backdrop-filter: blur(8px);
}

.form-card-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 1.5rem;
}

.form-group { margin-bottom: 1.5rem; }

.form-label {
  display: block;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--light);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.required { color: var(--fun-orange); }
.optional { color: rgba(255,255,255,0.4); font-weight: 400; text-transform: none; font-size: 0.8rem; }

.form-hint {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.45);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

/* Pillar grid */
.pillar-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pillar-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7);
  font-family: 'Nunito', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.4rem 0.9rem;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.18s;
}

.pillar-btn:hover {
  background: rgba(123, 47, 247, 0.2);
  border-color: var(--mystery-purple);
  color: white;
}

.pillar-btn.selected {
  background: linear-gradient(135deg, var(--mystery-purple), var(--bright-blue));
  border-color: transparent;
  color: white;
}

/* Input */
.form-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: var(--light);
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  outline: none;
}

.form-input::placeholder { color: rgba(255,255,255,0.3); }
.form-input:focus { border-color: var(--mystery-purple); }

/* Generate button */
.generate-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: linear-gradient(135deg, var(--mystery-purple), var(--bright-blue));
  color: white;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  padding: 0.9rem 2rem;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(123, 47, 247, 0.35);
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(123, 47, 247, 0.5);
}

.generate-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* === OUTPUT PANEL === */
.gen-output-panel {
  min-height: 400px;
}

/* Idle */
.output-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 300px;
  background: rgba(26, 26, 78, 0.3);
  border: 1px dashed rgba(255,215,0,0.2);
  border-radius: 20px;
  padding: 3rem;
  text-align: center;
}

.idle-icon { font-size: 3rem; opacity: 0.5; }
.idle-text { color: rgba(255,255,255,0.4); line-height: 1.6; font-size: 0.95rem; }

/* Loading */
.output-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  min-height: 300px;
  background: rgba(26, 26, 78, 0.4);
  border: 1px solid rgba(123, 47, 247, 0.3);
  border-radius: 20px;
  padding: 3rem;
  text-align: center;
}

.loading-orb {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--mystery-purple), var(--bright-blue));
  border-radius: 50%;
  animation: pulse-orb 1.4s ease-in-out infinite;
}

@keyframes pulse-orb {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
}

.loading-text {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.3rem;
  color: var(--gold);
}

.loading-subtext { font-size: 0.85rem; color: rgba(255,255,255,0.4); }

/* Error */
.output-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 200px;
  background: rgba(255, 107, 43, 0.08);
  border: 1px solid rgba(255, 107, 43, 0.3);
  border-radius: 20px;
  padding: 3rem;
  text-align: center;
}

.error-icon { font-size: 2.5rem; }
.error-text { color: rgba(255,255,255,0.7); font-size: 0.95rem; }

.retry-btn {
  background: rgba(255, 107, 43, 0.2);
  border: 1px solid var(--fun-orange);
  color: var(--fun-orange);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  padding: 0.5rem 1.5rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}
.retry-btn:hover { background: rgba(255,107,43,0.3); }

/* Result */
.output-result {
  background: rgba(26, 26, 78, 0.6);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 20px;
  padding: 2rem;
  backdrop-filter: blur(8px);
}

.script-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.script-pillar-badge {
  background: linear-gradient(135deg, var(--mystery-purple), var(--bright-blue));
  color: white;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 1rem;
  border-radius: 50px;
}

.copy-all-btn {
  background: rgba(255,215,0,0.1);
  border: 1px solid rgba(255,215,0,0.3);
  color: var(--gold);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.4rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.copy-all-btn:hover { background: rgba(255,215,0,0.2); }

/* Script sections */
.script-section {
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.hook-section { background: rgba(123, 47, 247, 0.12); border: 1px solid rgba(123, 47, 247, 0.25); }
.body-section { background: rgba(58, 94, 255, 0.1); border: 1px solid rgba(58, 94, 255, 0.2); }
.cta-section { background: rgba(255, 215, 0, 0.06); border: 1px solid rgba(255, 215, 0, 0.2); }

.section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.section-icon { font-size: 1.1rem; }

.section-label {
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold);
}

.section-timing {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.35);
  margin-left: auto;
}

.section-content {
  font-size: 0.97rem;
  color: rgba(255,255,255,0.88);
  line-height: 1.7;
  white-space: pre-wrap;
}

/* SEO panel */
.seo-panel {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-top: 1.25rem;
}

.seo-title-label {
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  color: var(--kid-green);
  margin-bottom: 0.75rem;
}

.seo-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.seo-row:last-child { border-bottom: none; }

.seo-field-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.35);
  min-width: 80px;
  padding-top: 0.1rem;
}

.seo-value {
  flex: 1;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.75);
  line-height: 1.5;
}

.seo-copy-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.seo-copy-btn:hover { background: rgba(255,255,255,0.1); color: white; }

.seo-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.tag-chip {
  display: inline-block;
  background: rgba(46, 207, 108, 0.12);
  border: 1px solid rgba(46, 207, 108, 0.25);
  color: var(--kid-green);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
}

/* Result actions */
.result-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.generate-another-btn {
  background: linear-gradient(135deg, var(--mystery-purple), var(--bright-blue));
  color: white;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.7rem 1.8rem;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.generate-another-btn:hover { opacity: 0.9; transform: translateY(-1px); }

.view-all-link {
  color: var(--gold);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.9rem;
}
.view-all-link:hover { text-decoration: underline; }

/* === LIBRARY PAGE === */
.library-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem 6rem;
}

.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.library-title {
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold), #fff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.new-script-btn {
  background: linear-gradient(135deg, var(--mystery-purple), var(--bright-blue));
  color: white;
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.65rem 1.5rem;
  border-radius: 12px;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s;
  box-shadow: 0 4px 16px rgba(123, 47, 247, 0.35);
}
.new-script-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* Filters */
.library-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.filter-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  font-family: 'Nunito', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.9rem;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.18s;
}
.filter-btn:hover { border-color: rgba(255,215,0,0.3); color: var(--gold); }
.filter-btn.active {
  background: rgba(255,215,0,0.12);
  border-color: rgba(255,215,0,0.4);
  color: var(--gold);
}

/* Script cards grid */
.scripts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.empty-state {
  grid-column: 1/-1;
  text-align: center;
  padding: 4rem 2rem;
  color: rgba(255,255,255,0.4);
  font-size: 1rem;
  line-height: 1.8;
}
.empty-state a { color: var(--gold); }
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }

.script-card {
  background: rgba(26, 26, 78, 0.6);
  border: 1px solid rgba(255,215,0,0.12);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.18s, border-color 0.18s;
}
.script-card:hover { transform: translateY(-3px); border-color: rgba(255,215,0,0.3); }

.script-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-pillar-badge {
  background: rgba(123, 47, 247, 0.2);
  border: 1px solid rgba(123, 47, 247, 0.4);
  color: rgba(200,180,255,0.9);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
}

.card-date { font-size: 0.75rem; color: rgba(255,255,255,0.3); }

.card-seo-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--light);
  line-height: 1.3;
}

.card-hook {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.5;
  flex: 1;
}

.card-expand-btn {
  align-self: flex-start;
  background: rgba(255,215,0,0.08);
  border: 1px solid rgba(255,215,0,0.2);
  color: var(--gold);
  font-family: 'Nunito', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s;
}
.card-expand-btn:hover { background: rgba(255,215,0,0.18); }

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: #141432;
  border: 1px solid rgba(255,215,0,0.2);
  border-radius: 20px;
  padding: 2rem;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
  font-size: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover { color: white; background: rgba(255,255,255,0.1); }

.modal-header { margin-bottom: 1.25rem; }
.modal-pillar-badge {
  background: linear-gradient(135deg, var(--mystery-purple), var(--bright-blue));
  color: white;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 1rem;
  border-radius: 50px;
}

.modal-section {
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}
.modal-section:nth-child(2) { background: rgba(123, 47, 247, 0.1); border: 1px solid rgba(123, 47, 247, 0.2); }
.modal-section:nth-child(3) { background: rgba(58, 94, 255, 0.08); border: 1px solid rgba(58, 94, 255, 0.15); }
.modal-section:nth-child(4) { background: rgba(255, 215, 0, 0.05); border: 1px solid rgba(255, 215, 0, 0.15); }

.modal-seo { margin-top: 1rem; }

/* === UTILITIES === */
.hidden { display: none !important; }
