@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600&display=swap');

/* ===========================
   CSS VARIABLES / DESIGN TOKENS
   =========================== */
:root {
  --primary: #E05C8A;
  --primary-dark: #C44872;
  --primary-light: #F2849E;
  --primary-pale: #FFE4EE;
  --primary-ultra-pale: #FFF5F8;

  --cream: #FFF8F2;
  --cream-dark: #F5EDE0;
  --cream-medium: #FAF0E8;
  --cream-border: #ECD9C6;

  --white: #FFFFFF;
  --off-white: #FDFBFA;

  --text-dark: #1E1B2E;
  --text-medium: #5D5470;
  --text-light: #9188A4;
  --text-placeholder: #C4BBD4;

  --border-light: #F0E8EE;
  --border-medium: #E8D5E2;

  --shadow-sm: 0 2px 8px rgba(224, 92, 138, 0.08);
  --shadow-md: 0 4px 20px rgba(224, 92, 138, 0.12);
  --shadow-lg: 0 8px 40px rgba(224, 92, 138, 0.15);
  --shadow-xl: 0 20px 60px rgba(224, 92, 138, 0.18);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;

  --font-primary: 'Outfit', sans-serif;
  --font-secondary: 'Inter', sans-serif;

  --sidebar-width: 380px;
  --topbar-height: 64px;
}

/* ===========================
   DARK MODE VARIABLES
   =========================== */
body.dark-mode {
  --primary: #F07CA8;
  --primary-dark: #E05C8A;
  --primary-light: #F5A0C0;
  --primary-pale: rgba(240, 124, 168, 0.15);
  --primary-ultra-pale: rgba(240, 124, 168, 0.07);
  --cream: #1E1B2E;
  --cream-dark: #17141F;
  --cream-medium: #1A1726;
  --cream-border: #2D2840;
  --white: #1A1726;
  --off-white: #13111C;
  --text-dark: #F0EBF8;
  --text-medium: #C4B8D8;
  --text-light: #8A7FAA;
  --text-placeholder: #4A4065;
  --border-light: #2D2840;
  --border-medium: #3D3558;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.6);
  color-scheme: dark;
  background-color: #13111C;
  color: #F0EBF8;
}
body.dark-mode .topbar {
  background: rgba(26,23,38,0.95);
  border-bottom-color: #2D2840;
}
body.dark-mode .form-input {
  background: #13111C;
  color: #F0EBF8;
  border-color: #3D3558;
}
body.dark-mode .form-input:focus {
  background: rgba(240,124,168,0.07);
}
body.dark-mode .card,
body.dark-mode .result-wrapper,
body.dark-mode .form-sidebar,
body.dark-mode .generate-area {
  background: #1A1726;
  border-color: #2D2840;
}
body.dark-mode .result-top-bar {
  background: linear-gradient(135deg, rgba(240,124,168,0.1), rgba(26,23,38,0.5));
}
body.dark-mode .toast {
  background: #1A1726;
  border-color: #2D2840;
  color: #F0EBF8;
}
body.dark-mode .nav-dropdown-menu {
  background: #1A1726;
  border-color: #2D2840;
}
body.dark-mode ::-webkit-scrollbar-track { background: #13111C; }
body.dark-mode ::-webkit-scrollbar-thumb { background: #3D3558; }
body.dark-mode ::-webkit-scrollbar-thumb:hover { background: #E05C8A; }
body { transition: background-color 0.3s ease, color 0.3s ease; }

/* ===========================
   RESET & BASE
   =========================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  background-color: var(--off-white);
  color: var(--text-dark);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  font-family: var(--font-primary);
  border: none;
  outline: none;
}

input, textarea, select {
  font-family: var(--font-primary);
  outline: none;
}

img {
  max-width: 100%;
}

/* ===========================
   SCROLLBAR
   =========================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--primary-ultra-pale);
}
::-webkit-scrollbar-thumb {
  background: var(--primary-pale);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

/* ===========================
   TOPBAR / NAVBAR
   =========================== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
}

.topbar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(224, 92, 138, 0.35);
}

.topbar-logo span.brand {
  background: linear-gradient(135deg, var(--primary), #9B59B6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-medium);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-link:hover {
  color: var(--primary);
  background: var(--primary-ultra-pale);
}

.nav-link.active {
  color: var(--primary);
  background: var(--primary-pale);
  font-weight: 600;
}

.topbar-cta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ===========================
   BUTTONS
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 4px 15px rgba(224, 92, 138, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(224, 92, 138, 0.45);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--white);
  color: var(--primary);
  border: 1.5px solid var(--border-medium);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  border-color: var(--primary-light);
  background: var(--primary-ultra-pale);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-medium);
  border: 1px solid var(--border-light);
}

.btn-ghost:hover {
  background: var(--primary-ultra-pale);
  color: var(--primary);
  border-color: var(--primary-pale);
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--primary-ultra-pale);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition);
  border: 1px solid var(--border-light);
}

.btn-icon:hover {
  background: var(--primary-pale);
  transform: scale(1.05);
}

.btn-generate {
  width: 100%;
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--primary), #9B59B6);
  color: white;
  box-shadow: 0 6px 25px rgba(224, 92, 138, 0.4);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  gap: 0.6rem;
}

.btn-generate::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #9B59B6, var(--primary));
  opacity: 0;
  transition: var(--transition);
}

.btn-generate:hover::before {
  opacity: 1;
}

.btn-generate:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 35px rgba(224, 92, 138, 0.5);
}

.btn-generate span, .btn-generate svg {
  position: relative;
  z-index: 1;
}

.btn-generate:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* ===========================
   CARDS
   =========================== */
.card {
  background: var(--white);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body {
  padding: 1.5rem;
}

/* ===========================
   FORM ELEMENTS
   =========================== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-medium);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-label .required {
  color: var(--primary);
  margin-left: 2px;
}

.form-input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-dark);
  background: var(--white);
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(224, 92, 138, 0.1);
  background: var(--primary-ultra-pale);
}

.form-input::placeholder {
  color: var(--text-placeholder);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23E05C8A' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 16px;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* ===========================
   CHIP SELECTORS
   =========================== */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: 1.5px solid var(--border-light);
  background: var(--white);
  color: var(--text-medium);
  user-select: none;
}

.chip:hover {
  border-color: var(--primary-light);
  color: var(--primary);
  background: var(--primary-ultra-pale);
}

.chip.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 3px 10px rgba(224, 92, 138, 0.3);
}

.chip-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  border: 1.5px solid rgba(255,255,255,0.5);
}

/* ===========================
   BLUEPRINT TYPE GRID
   =========================== */
.bp-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.bp-type-item {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-medium);
  background: var(--white);
}

.bp-type-item .bp-icon {
  font-size: 1rem;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--primary-ultra-pale);
  flex-shrink: 0;
  transition: var(--transition);
}

.bp-type-item:hover {
  border-color: var(--primary-light);
  color: var(--primary);
  background: var(--primary-ultra-pale);
}

.bp-type-item.selected {
  border-color: var(--primary);
  background: var(--primary-pale);
  color: var(--primary-dark);
  font-weight: 600;
}

.bp-type-item.selected .bp-icon {
  background: var(--primary);
  color: white;
  box-shadow: 0 3px 8px rgba(224, 92, 138, 0.3);
}

/* ===========================
   RESULT PANEL
   =========================== */
.result-panel {
  background: var(--white);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.result-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: linear-gradient(135deg, var(--primary-ultra-pale), var(--cream));
  flex-shrink: 0;
}

.result-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.result-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.result-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.result-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 3rem 2rem;
  gap: 1rem;
  color: var(--text-light);
  min-height: 300px;
}

.result-empty-icon {
  font-size: 3.5rem;
  opacity: 0.5;
  animation: float 3s ease-in-out infinite;
}

.result-empty h3 {
  font-size: 1.1rem;
  color: var(--text-medium);
  font-weight: 600;
}

.result-empty p {
  font-size: 0.85rem;
  max-width: 280px;
  line-height: 1.7;
}

.result-content {
  font-size: 0.875rem;
  line-height: 1.8;
  color: var(--text-dark);
  white-space: pre-wrap;
  word-break: break-word;
}

.result-content h1, .result-content h2, .result-content h3 {
  color: var(--primary-dark);
  margin: 1.25rem 0 0.6rem;
  font-family: var(--font-primary);
}

.result-content h2 {
  font-size: 1rem;
  font-weight: 700;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--primary-pale);
}

.result-content h3 {
  font-size: 0.9rem;
  font-weight: 600;
}

.result-content ul, .result-content ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}

.result-content li {
  margin-bottom: 0.3rem;
}

.result-content strong {
  color: var(--primary-dark);
  font-weight: 700;
}

.result-content code {
  background: var(--primary-ultra-pale);
  color: var(--primary-dark);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: 'Courier New', monospace;
}

.result-content blockquote {
  border-left: 3px solid var(--primary-light);
  padding: 0.5rem 1rem;
  background: var(--primary-ultra-pale);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 0.75rem 0;
}

/* ===========================
   LOADING
   =========================== */
.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  gap: 1.5rem;
  min-height: 300px;
}

.loading-dots {
  display: flex;
  gap: 0.5rem;
}

.loading-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  animation: dotPulse 1.4s ease-in-out infinite;
}

.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

.loading-text {
  font-size: 0.9rem;
  color: var(--text-medium);
  text-align: center;
  font-weight: 500;
}

.loading-step {
  font-size: 0.8rem;
  color: var(--text-light);
  text-align: center;
  animation: fadeInUp 0.5s ease;
}

/* ===========================
   TOAST
   =========================== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dark);
  animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 200px;
  max-width: 320px;
}

.toast.success { border-left: 4px solid #10B981; }
.toast.error { border-left: 4px solid #EF4444; }
.toast.info { border-left: 4px solid var(--primary); }

.toast-icon { font-size: 1.1rem; }
.toast.success .toast-icon { color: #10B981; }
.toast.error .toast-icon { color: #EF4444; }
.toast.info .toast-icon { color: var(--primary); }

/* ===========================
   SECTION HEADERS
   =========================== */
.section-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0 1rem;
}

.section-divider-line {
  height: 1px;
  background: var(--border-light);
  flex: 1;
}

.section-divider-text {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

/* ===========================
   BADGES & TAGS
   =========================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-pink {
  background: var(--primary-pale);
  color: var(--primary-dark);
}

.badge-new {
  background: linear-gradient(135deg, var(--primary), #9B59B6);
  color: white;
  box-shadow: 0 2px 8px rgba(224, 92, 138, 0.3);
}

/* ===========================
   HISTORY ITEMS
   =========================== */
.history-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 0.75rem;
}

.history-item:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

.history-item-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-pale), var(--cream));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.history-item-info {
  flex: 1;
  min-width: 0;
}

.history-item-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-meta {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.history-item-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

/* ===========================
   TEMPLATE CARDS
   =========================== */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.template-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.template-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: var(--primary-light);
}

.template-card-header {
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--primary-ultra-pale), var(--cream));
  display: flex;
  align-items: center;
  gap: 1rem;
}

.template-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 12px rgba(224, 92, 138, 0.3);
  color: white;
}

.template-card-body {
  padding: 1.25rem 1.5rem;
}

.template-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.35rem;
}

.template-desc {
  font-size: 0.8rem;
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.template-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.template-tag {
  padding: 0.2rem 0.6rem;
  background: var(--primary-ultra-pale);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
}

.template-card-footer {
  padding: 0.85rem 1.5rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ===========================
   SETTINGS
   =========================== */
.settings-section {
  background: var(--white);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  margin-bottom: 1.5rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.settings-section-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(135deg, var(--primary-ultra-pale), var(--cream));
}

.settings-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-section-body {
  padding: 1.5rem;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
  gap: 1rem;
}

.settings-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.settings-row-info {
  flex: 1;
}

.settings-row-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-dark);
}

.settings-row-desc {
  font-size: 0.775rem;
  color: var(--text-light);
  margin-top: 0.2rem;
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  display: none;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-medium);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.toggle-slider:before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* API Key Input */
.api-key-wrapper {
  position: relative;
  display: flex;
  gap: 0.5rem;
}

.api-key-input {
  flex: 1;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.05em;
}

.api-key-toggle {
  width: 40px;
  background: var(--primary-ultra-pale);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-medium);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.api-key-toggle:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

/* ===========================
   PAGE LAYOUTS
   =========================== */
.page-content {
  padding-top: var(--topbar-height);
  min-height: 100vh;
}

.page-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.page-subtitle {
  font-size: 0.95rem;
  color: var(--text-light);
}

/* Generator layout */
.generator-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 1.5rem;
  height: calc(100vh - var(--topbar-height) - 3rem);
}

.generator-sidebar {
  overflow-y: auto;
  background: var(--white);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.sidebar-section {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-section:last-child {
  border-bottom: none;
}

.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.generator-main {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

/* ===========================
   MOBILE MENU
   =========================== */
.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--primary-ultra-pale);
  border: 1px solid var(--border-light);
  color: var(--text-medium);
  font-size: 1.1rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ===========================
   LANDING PAGE
   =========================== */
.hero {
  padding: 6rem 1.5rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(224, 92, 138, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: var(--primary-pale);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 1.5rem;
  border: 1.5px solid var(--primary-light);
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.2;
  margin-bottom: 1.25rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.hero-title .gradient-text {
  background: linear-gradient(135deg, var(--primary), #9B59B6, #3B82F6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-medium);
  max-width: 560px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
  font-family: var(--font-secondary);
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 3.5rem;
}

.hero-stats {
  display: flex;
  gap: 2.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
}

.hero-stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #9B59B6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-stat-label {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.2rem;
}

/* Features Section */
.features-section {
  padding: 4rem 1.5rem;
  background: var(--cream);
}

.section-title {
  font-size: 1.8rem;
  font-weight: 800;
  text-align: center;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.section-desc {
  font-size: 0.95rem;
  color: var(--text-light);
  text-align: center;
  margin-bottom: 3rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
  max-width: 1100px;
  margin: 0 auto;
}

.feature-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.feature-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: var(--primary-pale);
}

.feature-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary-pale), var(--cream));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
}

.feature-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.feature-desc {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.7;
  font-family: var(--font-secondary);
}

/* BP Types Section */
.bp-types-section {
  padding: 4rem 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.bp-types-scroll {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.bp-type-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  background: var(--white);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-medium);
  transition: var(--transition);
  cursor: default;
  box-shadow: var(--shadow-sm);
}

.bp-type-pill:hover {
  border-color: var(--primary-light);
  color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* CTA Section */
.cta-section {
  padding: 5rem 1.5rem;
  background: linear-gradient(135deg, var(--primary), #9B59B6);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.cta-title {
  font-size: 2rem;
  font-weight: 800;
  color: white;
  margin-bottom: 1rem;
  position: relative;
}

.cta-desc {
  font-size: 1rem;
  color: rgba(255,255,255,0.85);
  margin-bottom: 2.5rem;
  position: relative;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.btn-cta {
  background: white;
  color: var(--primary);
  padding: 0.9rem 2.5rem;
  border-radius: var(--radius-full);
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 8px 25px rgba(0,0,0,0.2);
  transition: var(--transition);
  position: relative;
}

.btn-cta:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(0,0,0,0.25);
}

/* Footer */
.footer {
  padding: 2rem 1.5rem;
  background: var(--text-dark);
  color: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: white;
}

/* ===========================
   ANIMATIONS
   =========================== */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

@keyframes slideInRight {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-fade-in {
  animation: fadeIn 0.4s ease;
}

.animate-fade-in-up {
  animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--primary-ultra-pale) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ===========================
   UTILITY
   =========================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-light); }
.text-primary { color: var(--primary); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 100%;
    --topbar-height: 58px;
  }

  .topbar {
    padding: 0 1rem;
  }

  .topbar-nav {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .generator-layout {
    grid-template-columns: 1fr;
    height: auto;
    padding-bottom: 2rem;
  }

  .generator-sidebar {
    max-height: 600px;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-actions .btn {
    width: 100%;
    max-width: 280px;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
    text-align: center;
  }

  .page-container {
    padding: 1.5rem 1rem;
  }

  .template-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) and (max-width: 1100px) {
  :root {
    --sidebar-width: 320px;
  }
}

/* ===========================
   SIDEBAR & LAYOUT DASHBOARD
   =========================== */
.sidebar {
  width: 260px;
  background: var(--white);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 50;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

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

.sidebar-logo .logo-icon {
  font-size: 1.5rem;
}

.sidebar-logo .brand {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.5px;
}

.sidebar-menu {
  padding: 1rem 0;
  flex: 1;
  overflow-y: auto;
}

.menu-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 1.5rem;
  margin-bottom: 0.5rem;
  margin-top: 1rem;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1.5rem;
  color: var(--text-medium);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  border-left: 3px solid transparent;
  transition: var(--transition);
}

.menu-link:hover {
  background: var(--off-white);
  color: var(--text-dark);
}

.menu-link.active {
  background: var(--primary-ultra-pale);
  color: var(--primary);
  border-left-color: var(--primary);
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-light);
}

.btn-logout {
  width: 100%;
  border: 1.5px solid var(--border-light);
  background: transparent;
  padding: 0.6rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  color: var(--text-medium);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-logout:hover {
  background: #FEF2F2;
  color: #EF4444;
  border-color: #FCA5A5;
}

/* MAIN CONTENT */
body.dashboard-layout {
  display: flex !important;
  padding-top: 0 !important;
}

.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 2.5rem;
  position: relative;
  min-height: 100vh;
  width: calc(100% - 260px);
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-dark);
  margin-bottom: 1.5rem;
  align-items: center;
  gap: 0.5rem;
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 40;
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 1.5rem; width: 100%; }
  .mobile-menu-btn { display: flex; }
}

/* Dropdown nav */
.nav-dropdown {
  position: relative;
}
.nav-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-medium);
  transition: var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font-primary);
}
.nav-dropdown-trigger:hover,
.nav-dropdown:hover .nav-dropdown-trigger {
  color: var(--primary);
  background: var(--primary-ultra-pale);
}
.nav-dropdown-trigger .arrow {
  font-size: 0.6rem;
  transition: var(--transition);
}
.nav-dropdown:hover .arrow { transform: rotate(180deg); }
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  min-width: 300px;
  padding: 0.75rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(-50%) translateY(-8px);
  z-index: 1100;
}
.nav-dropdown:hover .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
}
.dropdown-item:hover {
  background: var(--primary-ultra-pale);
}
.dropdown-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.dropdown-icon-img { background: linear-gradient(135deg, #FFE4EE, #FFF3D6); }
.dropdown-icon-prompt { background: linear-gradient(135deg, #EDE8F5, #E8F5EC); }
.dropdown-item-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.2rem;
}
.dropdown-item-desc {
  font-size: 0.75rem;
  color: var(--text-light);
  line-height: 1.4;
}
.dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: 0.4rem 0;
}
.dropdown-free-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 0.1rem 0.5rem;
  background: #DCFCE7;
  color: #16A34A;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.2rem;
}
