/* ==========================================================================
   1. CSS VARIABLES & GLOBAL SETTINGS - Aligned with prompt-database theme
   ========================================================================== */
:root {
  --primary-color: #4F46E5;
  --secondary-color: #7C3AED;
  --accent-primary: #A78BFA;
  
  /* Dark theme colors - matching prompt-database */
  --bg-primary: #0D0C1D;
  --bg-secondary: #1A1A2E;
  --surface-glass: rgba(255, 255, 255, 0.05);
  --surface-glass-hover: rgba(255, 255, 255, 0.08);
  
  /* Text colors */
  --text-primary: #FFFFFF;
  --text-secondary: #9CA3AF;
  --text-tertiary: #6B7280;
  --text-headings: #E5E7EB;
  
  /* Borders and dividers */
  --border-glass: rgba(255, 255, 255, 0.1);
  --border-glass-hover: rgba(255, 255, 255, 0.2);
  
  /* Component backgrounds */
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-bg-hover: rgba(255, 255, 255, 0.06);
  --dropdown-bg: #0D0C1D;
  
  /* Additional colors for compatibility */
  --accent-color: #06b6d4;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  
  /* Transitions */
  --transition-speed: 0.3s;
  --transition-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Border radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
}
/* ==========================================================================
   2. BASE STYLES
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

/* ==========================================================================
   3. PERSONA STUDIO MAIN CONTAINER
   ========================================================================== */
.persona-studio {
  min-height: 100vh;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  position: relative;
  isolation: isolate;
  
}

/* Aurora background effects */
.persona-studio::before {
  content: '';
  position: fixed;
  top: -20%;
  left: -20%;
  width: 60%;
  height: 60%;
  background: var(--aurora-gradient);
  opacity: 0.15;
  filter: blur(100px);
  z-index: -1;
  animation: pulse-glow-1 15s infinite alternate;
  pointer-events: none;
}

.persona-studio::after {
  content: '';
  position: fixed;
  bottom: -20%;
  right: -20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
  opacity: 0.15;
  filter: blur(100px);
  z-index: -1;
  animation: pulse-glow-2 12s infinite alternate;
  pointer-events: none;
}

@keyframes pulse-glow-1 {
  from { transform: scale(0.8) rotate(0deg); opacity: 0.1; }
  to { transform: scale(1.2) rotate(45deg); opacity: 0.2; }
}

@keyframes pulse-glow-2 {
  from { transform: scale(1.2) rotate(0deg); opacity: 0.2; }
  to { transform: scale(0.8) rotate(-45deg); opacity: 0.1; }
}

/* ==========================================================================
   4. HERO SECTION
   ========================================================================== */
.studio-hero {
  padding: 3rem 0 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.studio-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -25%;
  width: 150%;
  height: 200%;
  background: var(--aurora-gradient);
  opacity: 0.1;
  filter: blur(100px);
  animation: float 20s infinite alternate;
}

@keyframes float {
  from { transform: scale(0.8) rotate(0deg); }
  to { transform: scale(1.2) rotate(45deg); }
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--glass-background);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  margin-bottom: 1.5rem;
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 0.875rem;
  box-shadow: var(--shadow-glass);
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.2;
  color: var(--text-headings);
}

.gradient-text {
  display: block;
  background: linear-gradient(135deg, #FFFFFF 30%, #A78BFA 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

/* ==========================================================================
   5. USAGE TRACKER
   ========================================================================== */
.usage-tracker {
  max-width: 450px;
  margin: 0 auto;
  background: var(--glass-background);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-2xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-glass);
  position: relative;
  overflow: hidden;
}

.usage-tracker::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
}

.usage-bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.75rem;
  position: relative;
}

.usage-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 999px;
  transition: width 0.8s ease;
  position: relative;
  overflow: hidden;
}

.usage-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.usage-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.upgrade-link {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 600;
  transition: all var(--transition-speed);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-md);
  background: rgba(167, 139, 250, 0.1);
}

.upgrade-link:hover {
  color: var(--text-primary);
  background: rgba(167, 139, 250, 0.2);
  transform: translateY(-1px);
}

/* ==========================================================================
   6. FILTER BAR
   ========================================================================== */
.filter-bar {
  padding: 2rem 0 1.5rem;
  background: var(--glass-background);
  backdrop-filter: blur(15px);
  border-top: 1px solid var(--border-glass);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 64px;
  z-index: 40;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.filter-wrapper {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0 1rem 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.filter-wrapper::-webkit-scrollbar {
  height: 4px;
}

.filter-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.filter-wrapper::-webkit-scrollbar-thumb {
  background: var(--border-glass-hover);
  border-radius: 2px;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-speed);
  position: relative;
  overflow: hidden;
}

.filter-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--primary-gradient);
  transition: left var(--transition-speed);
  z-index: -1;
}

.filter-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.filter-btn:hover::before {
  left: 0;
}

.filter-btn.active {
  background: var(--primary-gradient);
  border-color: transparent;
  color: white;
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

.filter-btn.active::before {
  left: 0;
}

.filter-btn i {
  font-size: 1.1rem;
}

/* ==========================================================================
   7. PERSONAS GRID & CARDS - THE STAR OF THE SHOW
   ========================================================================== */
.personas-section {
  padding: 4rem 0;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
}

.personas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

/* ==========================================================================
   8. PERSONA CARD - PREMIUM DESIGN
   ========================================================================== */
.persona-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  position: relative;
  group: hover;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.persona-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity var(--transition-speed);
  z-index: 0;
  border-radius: var(--radius-2xl);
}

.persona-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 
    0 25px 60px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(167, 139, 250, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border-color: var(--accent-primary);
}

.persona-card:hover::before {
  opacity: 0.05;
}

/* Persona Image Section */
.persona-image {
  position: relative;
  height: 280px;
  overflow: hidden;
  background: linear-gradient(135deg, 
    var(--primary-color) 0%, 
    var(--secondary-color) 50%, 
    var(--accent-primary) 100%);
}

.persona-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  filter: brightness(1.1) saturate(1.2);
}

.persona-card:hover .persona-image img {
  transform: scale(1.1);
  filter: brightness(1.2) saturate(1.3);
}

/* Overlay Effects */
.persona-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    to bottom, 
    transparent 0%, 
    rgba(0, 0, 0, 0.1) 30%,
    rgba(0, 0, 0, 0.6) 80%,
    rgba(0, 0, 0, 0.9) 100%
  );
  pointer-events: none;
  transition: all var(--transition-speed);
}

.persona-card:hover .persona-overlay {
  background: linear-gradient(
    to bottom, 
    rgba(0, 0, 0, 0.1) 0%, 
    rgba(0, 0, 0, 0.2) 30%,
    rgba(0, 0, 0, 0.7) 80%,
    rgba(0, 0, 0, 0.95) 100%
  );
}

/* Chat Count Badge */
.chat-count {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  padding: 0.5rem 0.875rem;
  border-radius: 999px;
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: all var(--transition-speed);
}

.persona-card:hover .chat-count {
  background: rgba(167, 139, 250, 0.9);
  transform: scale(1.05);
  box-shadow: 0 6px 25px rgba(167, 139, 250, 0.4);
}

.chat-count i {
  margin-right: 0.375rem;
  color: var(--accent-primary);
}

.persona-card:hover .chat-count i {
  color: white;
}

/* Content Section */
.persona-content {
  padding: 2rem;
  position: relative;
  z-index: 1;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
}

.persona-name {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-headings);
  line-height: 1.3;
}

.persona-tagline {
  color: var(--accent-primary);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.persona-description {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: all var(--transition-speed);
}

.persona-card:hover .persona-description {
  color: var(--text-primary);
  -webkit-line-clamp: unset;
  max-height: none;
}

/* Tags */
.persona-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.tag {
  padding: 0.375rem 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  transition: all var(--transition-speed);
  backdrop-filter: blur(5px);
}

.persona-card:hover .tag {
  background: rgba(167, 139, 250, 0.15);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

/* Chat Button - The Call to Action */
.chat-btn {
  width: 100%;
  padding: 1rem 1.5rem;
  background: var(--primary-gradient);
  border: none;
  border-radius: var(--radius-xl);
  color: white;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.3);
}

.chat-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.4s ease;
}

.chat-btn:hover {
  transform: translateY(-3px);
  box-shadow: 
    0 15px 40px rgba(79, 70, 229, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1);
}

.chat-btn:hover::before {
  width: 300px;
  height: 300px;
}

.chat-btn:active {
  transform: translateY(-1px);
}

.chat-btn i {
  font-size: 1.1rem;
  transition: transform var(--transition-speed);
}

.chat-btn:hover i {
  transform: translateX(3px);
}

/* ==========================================================================
   9. CHAT MODAL - SLEEK & MODERN
   ========================================================================== */
.chat-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.chat-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.chat-container {
  width: 100%;
  max-width: 900px;
  height: 85vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-2xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

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

@keyframes slideUp {
  from {
    transform: translateY(30px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Chat Header */
.chat-header {
  padding: 1.5rem 2rem;
  background: var(--glass-background);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.chat-header::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--primary-gradient);
  opacity: 0.3;
}

.chat-persona-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.chat-persona-info img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-primary);
  box-shadow: 0 4px 15px rgba(167, 139, 250, 0.3);
}

.chat-persona-info h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-headings);
  font-weight: 600;
}

.status-online {
  color: var(--success-color);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-weight: 500;
}

.status-online::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--success-color);
  border-radius: 50%;
  animation: pulse 2s infinite;
  box-shadow: 0 0 10px var(--success-color);
}

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

.close-chat {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-speed);
  font-size: 1.1rem;
}

.close-chat:hover {
  background: var(--surface-glass-hover);
  border-color: var(--danger-color);
  color: var(--danger-color);
  transform: scale(1.05);
}

/* Chat Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: var(--bg-primary);
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-glass-hover);
  border-radius: 3px;
}

/* Individual Messages */
.message {
  display: flex;
  gap: 1rem;
  animation: fadeInUp 0.4s ease;
  max-width: 85%;
}

.message.user {
  flex-direction: row-reverse;
  margin-left: auto;
}

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

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid var(--border-glass);
}

.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message.user .message-avatar {
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
  border: 2px solid var(--primary-color);
}

.message-content {
  background: var(--glass-background);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: 1.25rem;
  padding: 1rem 1.25rem;
  color: var(--text-primary);
  line-height: 1.6;
  position: relative;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.message.user .message-content {
  background: var(--primary-gradient);
  border: 1px solid var(--primary-color);
  color: white;
}

.message-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  opacity: 0.8;
}

.message.user .message-time {
  color: rgba(255, 255, 255, 0.8);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 0.375rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  background: var(--glass-background);
  border-radius: 1.25rem;
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(10px);
  width: fit-content;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--accent-primary);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-15px);
    opacity: 1;
  }
}

/* Chat Input Area */
.chat-input-wrapper {
  padding: 1.5rem 2rem;
  background: var(--glass-background);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  position: relative;
}

.chat-input-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--primary-gradient);
  opacity: 0.3;
}

.chat-input-form {
  display: flex;
  gap: 1rem;
  align-items: end;
}

#chatInput {
  flex: 1;
  background: var(--bg-primary);
  border: 2px solid var(--border-glass);
  border-radius: 1.25rem;
  padding: 1rem 1.5rem;
  color: var(--text-primary);
  font-size: 1rem;
  resize: none;
  min-height: 50px;
  max-height: 120px;
  transition: all var(--transition-speed);
  font-family: inherit;
}

#chatInput:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.1);
  background: var(--surface-glass);
}

#chatInput::placeholder {
  color: var(--text-muted);
}

#sendBtn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary-gradient);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-speed);
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

#sendBtn:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

#sendBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================================
   10. MODALS & OVERLAYS
   ========================================================================== */
.limit-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
  padding: 1rem;
}

.limit-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-2xl);
  padding: 2.5rem;
  max-width: 450px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
}

.limit-content h3 {
  color: var(--warning-color);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.limit-content p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.limit-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.limit-actions button {
  padding: 0.875rem 1.5rem;
  background: transparent;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-speed);
  font-weight: 500;
}

.limit-actions button:hover {
  background: var(--surface-glass-hover);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.upgrade-btn {
  padding: 0.875rem 1.5rem;
  background: var(--primary-gradient);
  border: none;
  border-radius: var(--radius-lg);
  color: white !important;
  text-decoration: none;
  font-weight: 600;
  transition: all var(--transition-speed);
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.upgrade-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
  color: white !important;
}

/* ==========================================================================
   11. ERROR STATES & NOTIFICATIONS
   ========================================================================== */
.error-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: linear-gradient(135deg, var(--danger-color), #dc2626);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideInRight 0.4s ease;
  z-index: 3000;
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.success-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: linear-gradient(135deg, var(--success-color), #059669);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideInRight 0.4s ease;
  z-index: 3000;
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

/* ==========================================================================
   12. RESPONSIVE DESIGN
   ========================================================================== */

/* Tablet */
@media (max-width: 1024px) {
  .personas-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .chat-container {
    width: 95%;
    height: 90vh;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .persona-studio {
    padding-top: 64px;
  }
  
  .studio-hero {
    padding: 2rem 0 1.5rem;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-subtitle {
    font-size: 1.1rem;
  }
  
  .personas-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
  }
  
  .persona-content {
    padding: 1.5rem;
  }
  
  .filter-bar {
    padding: 1.5rem 0;
  }
  
  .filter-wrapper {
    justify-content: flex-start;
    padding: 0 1rem;
  }
  
  .chat-container {
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }
  
  .chat-header,
  .chat-input-wrapper {
    padding: 1rem 1.5rem;
  }
  
  .chat-messages {
    padding: 1.5rem;
  }
  
  .message {
    max-width: 90%;
  }
  
  .usage-tracker {
    margin: 0 1rem;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .personas-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .hero-content {
    padding: 0 0.75rem;
  }
  
  .filter-wrapper {
    padding: 0 0.75rem;
  }
  
  .container {
    padding: 0 0.75rem;
  }
  
  .persona-image {
    height: 240px;
  }
  
  .hero-title {
    font-size: 1.75rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .limit-content {
    padding: 2rem 1.5rem;
    margin: 1rem;
  }
  
  .limit-actions {
    flex-direction: column;
  }
}

/* ==========================================================================
   13. UTILITY ANIMATIONS
   ========================================================================== */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(167, 139, 250, 0.5);
  }
}

.glow-effect {
  animation: glow 2s infinite;
}

@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    transform: translateY(0);
  }
  40%, 43% {
    transform: translateY(-10px);
  }
  70% {
    transform: translateY(-5px);
  }
  90% {
    transform: translateY(-2px);
  }
}

.bounce-effect {
  animation: bounce 1s infinite;
}

/* ==========================================================================
   14. ACCESSIBILITY & FOCUS STATES
   ========================================================================== */
.filter-btn:focus,
.chat-btn:focus,
#sendBtn:focus,
#chatInput:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.persona-card:focus-within {
  transform: translateY(-4px);
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.3),
    0 0 0 2px var(--accent-primary);
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .persona-card:hover {
    transform: none;
  }
  
  .chat-btn:hover {
    transform: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border-glass: rgba(255, 255, 255, 0.3);
    --border-glass-hover: rgba(255, 255, 255, 0.5);
    --text-secondary: #E5E7EB;
  }
}

/* ==========================================================================
   15. LOADING STATES
   ========================================================================== */
.loading-skeleton {
  background: linear-gradient(
    90deg, 
    var(--surface-glass) 25%, 
    rgba(255, 255, 255, 0.1) 50%, 
    var(--surface-glass) 75%
  );
  background-size: 200% 100%;
  animation: loading-shimmer 2s infinite;
}

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

.persona-card-skeleton {
  height: 500px;
  border-radius: var(--radius-2xl);
  background: var(--card-bg);
  border: 1px solid var(--border-glass);
}

/* ==========================================================================
   16. PRINT STYLES
   ========================================================================== */
@media print {
  .chat-modal,
  .filter-bar,
  .usage-tracker,
  .chat-btn {
    display: none !important;
  }
  
  .persona-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
}


/* ==========================================================================
   4. NAVIGATION & MOBILE MENU
   ========================================================================== */
.nav-container {
  position: sticky;
  top: 0;
  z-index: 100; /* Increased from 50 to ensure it stays above sidebar */
  background: var(--bg-primary);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-glass);
}

.nav-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  height: 4rem;
}

/* Base state - mobile first */
.nav-links {
  display: none;
}

.auth-buttons {
  display: none;
}

/* Navigation Links */
.nav-link {
  padding: 0.5rem 0.75rem;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 0.375rem;
  transition: background-color var(--transition-speed), color var(--transition-speed);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  position: relative;
  z-index: 1;
}

.nav-link:hover {
  background-color: var(--surface-glass-hover);
  color: var(--text-primary);
}

.nav-link.active {
  background-color: var(--surface-glass-hover);
  border: 1px solid var(--border-glass);
}

/* Desktop Dropdown Styles */
.nav-item.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-toggle {
  cursor: pointer;
}

.dropdown-arrow {
  margin-left: 0.4em;
  font-size: 0.7em;
  transition: transform var(--transition-speed) ease;
  display: inline-block;
  vertical-align: middle;
}

.nav-dropdown-menu {
  display: block;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  min-width: 200px;
  padding: 0.5rem 0;
  background: var(--dropdown-bg);
  backdrop-filter: blur(15px);
  border: 1px solid var(--border-glass);
  border-radius: 0.5rem;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(5px);
  pointer-events: none;
  transition: opacity var(--transition-speed) ease,
              visibility var(--transition-speed) ease,
              transform var(--transition-speed) ease;
}

.nav-item.nav-dropdown:hover > .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-item.nav-dropdown:hover > .nav-dropdown-toggle .dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-item {
  display: block;
  padding: 0.6rem 1.2rem;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
  background-color: transparent;
  border: 0;
  transition: background-color var(--transition-speed), color var(--transition-speed);
}

.nav-dropdown-item:hover,
.nav-dropdown-item:focus,
.nav-dropdown-item.active {
  background-color: var(--surface-glass-hover);
  color: var(--text-primary);
  text-decoration: none;
}

/* Mobile Menu Button */
.mobile-menu-button {
  display: block;
  background: none;
  border: none;
  color: var(--text-primary);
  padding: 0.5rem;
  cursor: pointer;
  transition: opacity var(--transition-speed);
  z-index: 51;
}

.mobile-menu-button:hover {
  opacity: 0.8;
}

/* Mobile Menu Panel */
.mobile-menu {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  backdrop-filter: blur(12px);
  padding: 1rem 0;
  overflow-y: auto;
  transform: translateY(-100%);
  transition: transform var(--transition-speed) ease-out;
  z-index: 49;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mobile-menu.active {
  transform: translateY(0);
  display: block;
}

.mobile-menu .nav-link:not(.sub-link),
.mobile-menu .mobile-submenu-toggle {
  display: block;
  padding: 0.9rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border-glass);
  text-decoration: none;
  font-size: 1rem;
  width: 100%;
  box-sizing: border-box;
  color: var(--text-primary);
}

.mobile-menu > *:not(.mobile-menu-section):not(.auth-buttons-mobile):last-of-type {
  border-bottom: none;
}

.mobile-menu .mobile-menu-section:last-of-type > .mobile-submenu-toggle {
  border-bottom: none;
}

/* Mobile Submenu Styles */
.mobile-submenu-toggle {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-submenu-toggle .dropdown-arrow {
  transition: transform var(--transition-speed) ease;
  font-size: 0.9em;
}

.mobile-submenu-toggle[aria-expanded="true"] .dropdown-arrow {
  transform: rotate(180deg);
}

.mobile-submenu {
  background-color: rgba(0, 0, 0, 0.1);
  padding-left: 0;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease-out;
}

.mobile-submenu .sub-link {
  display: block;
  padding: 0.75rem 1.5rem 0.75rem 2.5rem;
  text-align: left;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-decoration: none;
}

.mobile-submenu .sub-link:last-child {
  border-bottom: none;
}

.mobile-submenu .sub-link:hover,
.mobile-submenu .sub-link.active {
  background-color: var(--surface-glass);
  color: var(--text-primary);
}

.mobile-menu .auth-buttons-mobile {
  border-top: 1px solid var(--border-glass);
  padding-top: 1.5rem;
  margin-top: 1rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  padding-bottom: 1rem;
}

.auth-buttons-mobile {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 0.75rem;
}

/* Logo Styling */
.nav-logo-link {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0.25rem 0;
  margin-right: 1rem;
}

.nav-logo-img {
  height: 32px;
  width: auto;
  max-height: calc(100% - 0.5rem);
  transition: height var(--transition-speed) ease;
  display: block;
}

/* ==========================================================================
   12. FOOTER
   ========================================================================== */
.footer {
  background: var(--bg-primary)!important;
  backdrop-filter: blur(10px);
  padding: 4rem 0 0;
  margin-top: 4rem;
  border-top: 1px solid var(--border-glass);
}

.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
  background: var(--bg-primary)!important;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 3rem;
  margin-bottom: 4rem;
}

.footer-section h4 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-headings);
}

.footer-description {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-speed);
}

.footer-links a:hover {
  color: var(--text-primary);
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  transition: all var(--transition-speed);
}

.social-link:hover {
  background: var(--surface-glass-hover);
  transform: translateY(-2px);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.footer-bottom {
  border-top: 1px solid var(--border-glass);
  padding: 2rem 0;
  margin-top: 2rem;
}

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

.footer-bottom p {
  margin: 0;
  color: var(--text-secondary);
}

.footer-bottom-links {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-bottom-links a,
.footer-bottom-links button {
  color: var(--text-secondary);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
  transition: color var(--transition-speed);
}

.footer-bottom-links a:hover,
.footer-bottom-links button:hover {
  color: var(--text-primary);
}


/* ==========================================================================
   13. RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 640px) {
  .banner-link {
    font-size: 0.75rem;
    padding: 0.5rem;
  }

  .hero-title {
    font-size: 2.25rem;
  }
  
  .hero-description {
    font-size: 1rem;
  }

  .modal-dialog {
    margin: 1rem;
    width: calc(100% - 2rem);
  }
  
  .modal-content {
    border-radius: 1.25rem;
  }
  
  .modal-body {
    padding: 1.5rem;
    font-size: 1.1rem;
  }
  
  .modal-footer {
    flex-direction: column;
    gap: 0.75rem;
  }

  .modal-footer .button {
    width: 100%;
    padding: 0.75rem;
  }
  
  .submit-form {
    padding: 1.5rem;
  }
  
  .submit-button {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .footer-grid {
    gap: 2rem;
  }

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

  .footer-bottom-links {
    justify-content: center;
  }

  .footer-container {
    padding: 0 1rem;
  }
}

@media (max-width: 859px) {
  .nav-links,
  .auth-buttons {
    display: none;
  }
  
  .mobile-menu-button {
    display: block;
    margin-left: auto;
  }
  
  .nav-container {
    height: 4rem;
  }
  
  .mobile-menu {
    top: 3.5rem;
    max-height: calc(100vh - 3.5rem);
  }

  .nav-logo-img {
    height: 64px;
  }
  
  .nav-logo-link {
    margin-right: 0.5rem;
  }
}

@media (min-width: 860px) {
  .mobile-menu-button {
    display: none;
  }
  
  .mobile-menu {
    display: none !important;
  }
  
  .nav-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-left: 1rem;
    margin-right: auto;
  }
  
  .nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }
  
  .auth-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-left: 1rem;
  }
  
  .nav-content {
    height: 4rem;
  }

  .nav-logo-img {
    height: 64px;
  }
  
  .nav-logo-link {
    margin-right: 1rem;
  }
}

@media (min-width: 1024px) {
  .nav-links {
    gap: 1rem;
  }
  
  .nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
  }
  
  .auth-buttons {
    gap: 0.75rem;
  }
  
  .button {
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
  }
}

@media (min-width: 1280px) {
  .nav-content, .footer-container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
  
  .nav-links {
    gap: 1.5rem;
  }
}
/* ==========================================================================
   3. BANNER COMPONENT
   ========================================================================== */
.banner-container {
  width: 100%;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.banner-content {
  margin: 0 auto;
  position: relative;
  z-index: 10;
}

.banner-link {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  background: var(--surface-glass);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-glass);
  text-align: center;
  font-size: 0.875rem;
  transition: opacity 0.3s ease;
}

.banner-link:hover {
  opacity: 0.9;
  color: var(--text-primary);
}

.footer-v2 {
    background: var(--bg-primary)!important;
    margin-top:0!important;
    padding: 2rem 0 0!important;
}

.button {
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all var(--transition-speed);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
  font-size: 0.95rem;
}

.button-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: var(--text-primary);
  border: 1px solid transparent;
}

.button-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

.button-outline {
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
}

.button-outline:hover {
  background: var(--surface-glass-hover);
  border-color: var(--border-glass-hover);
}


.profile-icon, .submit-icon {
    padding: 10px!important;
}

.profile-menu.show {
    background:  var(--bg-primary)!important;
}

.profile-item {
    color:white!important;
}

.profile-item.logout {
    color:red!important;
}

/* ==========================================================================
   REDESIGNED LAYOUT - BUBLO STYLE
   ========================================================================== */

/* Hide original hero and sections */
.studio-hero,
.filter-bar,
.personas-section,
.footer,
.footer-v2 {
  display: none !important;
}

/* Main Layout Container */
.persona-studio-main {
  display: flex;
  height: calc(100vh - 64px); /* Changed from min-height to height */
  background: var(--bg-primary);
  position: relative;
  padding-top: 0;
  overflow: hidden; /* Prevent the main container from scrolling */
}

/* Left Sidebar */
/* Left Sidebar */
/* Left Sidebar */
.studio-sidebar {
  width: 240px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: hidden; /* Changed from auto to hidden - no scrolling */
  z-index: 30;
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 60px;
}

.studio-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.1rem;
}

.studio-logo i {
  color: var(--accent-primary);
  font-size: 1.3rem;
}

.beta-badge {
  background: var(--primary-gradient);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  flex: 1;
  
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1.25rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-speed);
  position: relative;
  font-size: 0.95rem;
  font-weight: 500;
}

.sidebar-item i {
  width: 20px;
  font-size: 1.1rem;
  text-align: center;
}

.sidebar-item:hover {
  background: var(--surface-glass);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: var(--surface-glass);
  color: var(--accent-primary);
  border-left: 3px solid var(--accent-primary);
}

.sidebar-item.active i {
  color: var(--accent-primary);
}

.sidebar-footer {
  border-top: 1px solid var(--border-glass);
  padding: 0.5rem 0;
}

.sidebar-item.feedback {
  margin-top: 0.5rem;
}

/* Usage Tracker in Sidebar */
.usage-tracker-sidebar {
  padding: 1rem 1.25rem;
  margin: 0.5rem 0;
}

.usage-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.usage-tracker-sidebar .usage-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.usage-tracker-sidebar .usage-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 999px;
  transition: width 0.8s ease;
}

.upgrade-link-sidebar {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--accent-primary);
  text-decoration: none;
  margin-top: 0.25rem;
  font-weight: 500;
}

.upgrade-link-sidebar:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Main Content Area */
/* Main Content Area */
.studio-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-primary);
  margin-left: 240px; /* Account for fixed sidebar width */
  height: calc(100vh - 64px); /* Set explicit height */
  position: relative;
}

/* Category Bar */
/* Category Bar */
.category-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0; /* Changed from 64px to 0 since it's within studio-content */
  z-index: 25;
  padding: 0;
}

.category-wrapper {
  display: flex;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  white-space: nowrap;
}

.category-wrapper::-webkit-scrollbar {
  height: 3px;
}

.category-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.category-wrapper::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: 1.5px;
}

.category-btn {
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-speed);
  border-radius: 999px;
  white-space: nowrap;
}

.category-btn:hover {
  color: var(--text-primary);
  background: var(--surface-glass);
}

.category-btn.active {
  background: var(--surface-glass);
  color: var(--accent-primary);
  font-weight: 600;
}

/* Personas Container */
/* Personas Container */
.personas-container {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  height: 100%; /* Ensure it takes full available height */
}

.personas-grid-new {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.25rem;
  animation: fadeIn 0.5s ease;
}

/* New Persona Card Design */
.persona-card-new {
  background: var(--card-bg);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.persona-card-new:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

.persona-image-new {
  position: relative;
  height: 220px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.persona-image-new img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.persona-card-new:hover .persona-image-new img {
  transform: scale(1.05);
}

.chat-count-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pro-badge {
    position: absolute!important;
    top: 10px!important;
    left: 10px!important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%)!important;
    color: white!important;
    padding: 4px 8px!important;
    border-radius: 4px!important;
    font-size: 11px!important;
    font-weight: 600!important;
}

.persona-info {
  padding: 1rem;
}

.persona-info .persona-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.persona-info .persona-tagline {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

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

.persona-info .tag {
  padding: 0.25rem 0.5rem;
  background: var(--surface-glass);
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

/* Responsive Updates */
@media (max-width: 1400px) {
  .personas-grid-new {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (max-width: 1200px) {
  .personas-grid-new {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (max-width: 867px) {
  .studio-sidebar {
    position: fixed;
    left: -240px;
    transition: left 0.3s ease;
    z-index: 50;
    top: 64px; /* Keep this consistent */
  }
  
  .studio-sidebar.mobile-open {
    left: 0;
  }
  
  .studio-content {
    margin-left: 0; /* Remove left margin on mobile */
  }
  
  .category-bar {
    top: 0;
  }
  
  .personas-grid-new {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
  }
  
  .persona-image-new {
    height: 180px;
  }
}

@media (max-width: 480px) {
  .personas-grid-new {
    grid-template-columns: repeat(1, 1fr);
    gap: 0.75rem;
  }
  
  .personas-container {
    padding: 1rem;
  }
}

/* ==========================================================================
   17. CHAT HEADER ACTIONS & HISTORY MODAL
   ========================================================================== */

/* Chat Header Actions */
.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-action-btn {
  padding: 0.5rem 0.75rem;
  background: var(--surface-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all var(--transition-speed);
  font-size: 0.9rem;
}

.chat-action-btn:hover {
  background: var(--surface-glass-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

.chat-action-btn i {
  font-size: 1rem;
}

.chat-action-btn .btn-label {
  display: inline-block;
}

/* History Modal */
.history-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 1100;
  animation: fadeIn 0.3s ease;
}

.history-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.history-container {
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-2xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

.history-header {
  padding: 1.5rem 2rem;
  background: var(--glass-background);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-header h3 {
  margin: 0;
  color: var(--text-headings);
  font-size: 1.25rem;
}

.close-history {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.close-history:hover {
  background: var(--surface-glass-hover);
  border-color: var(--danger-color);
  color: var(--danger-color);
  transform: scale(1.05);
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.history-item {
  background: var(--glass-background);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.history-item:hover {
  background: var(--surface-glass-hover);
  border-color: var(--accent-primary);
  transform: translateX(4px);
}

.history-item-date {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-bottom: 0.5rem;
}

.history-item-preview {
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

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

.no-history {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.no-history i {
  font-size: 3rem;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
  display: block;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .chat-header {
    padding: 1rem 1.25rem;
  }
  
  .chat-header-actions {
    gap: 0.25rem;
  }
  
  .chat-action-btn {
    padding: 0.5rem;
  }
  
  .chat-action-btn .btn-label {
    display: none;
  }
  
  .chat-action-btn i {
    font-size: 1.1rem;
  }
  
  .history-container {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .history-header {
    padding: 1rem 1.25rem;
  }
}

@media (max-width: 480px) {
  .close-chat {
    width: 40px;
    height: 40px;
  }
  
  .chat-action-btn {
    padding: 0.4rem;
    font-size: 0.85rem;
  }
  
  .history-list {
    padding: 0.75rem;
  }
  
  .history-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
  }
}

/* ==========================================================================
   CREATE PERSONA MODAL
   ========================================================================== */
.create-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 2000;
  overflow-y: auto;
  padding: 2rem;
}

.create-modal.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.create-container {
  width: 100%;
  max-width: 900px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-2xl);
  margin: 2rem auto;
  animation: slideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

.create-header {
  padding: 2rem;
  background: var(--glass-background);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.create-header h2 {
  margin: 0;
  color: var(--text-headings);
  font-size: 1.5rem;
  font-weight: 600;
}

.close-create {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.close-create:hover {
  background: var(--surface-glass-hover);
  border-color: var(--danger-color);
  color: var(--danger-color);
}

.create-form {
  padding: 2rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-section.full-width {
  grid-column: span 2;
}

.form-section h3 {
  color: var(--text-headings);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-glass);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--surface-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 0.875rem 1rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all var(--transition-speed);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.1);
  background: var(--surface-glass-hover);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
  line-height: 1.5;
}

.form-group small {
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

/* Tag System */
.tag-suggestions {
  display: none;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: var(--surface-glass);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.tag-suggestions.active {
  display: flex;
}

.tag-suggestion {
  padding: 0.35rem 0.75rem;
  background: var(--surface-glass-hover);
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.tag-suggestion:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.selected-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  background: var(--primary-gradient);
  border-radius: 999px;
  color: white;
  font-size: 0.85rem;
}

.selected-tag .remove-tag {
  cursor: pointer;
  opacity: 0.8;
  transition: opacity var(--transition-speed);
}

.selected-tag .remove-tag:hover {
  opacity: 1;
}

/* Submission Options */
.submission-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.radio-option {
  position: relative;
  cursor: pointer;
}

.radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
}

.radio-content {
  padding: 1.25rem;
  background: var(--surface-glass);
  border: 2px solid var(--border-glass);
  border-radius: var(--radius-lg);
  transition: all var(--transition-speed);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.radio-option input[type="radio"]:checked + .radio-content {
  background: var(--surface-glass-hover);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.1);
}

.radio-title {
  color: var(--text-primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.radio-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.quota-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--surface-glass);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  margin-top: 1rem;
}

.upgrade-prompt {
  text-align: center;
  padding: 1.5rem;
  background: var(--surface-glass);
  border-radius: var(--radius-lg);
  border: 1px solid var(--accent-primary);
  margin-top: 1rem;
}

.upgrade-prompt i {
  color: var(--accent-primary);
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.upgrade-prompt p {
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.upgrade-prompt .upgrade-link {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 600;
}

/* Form Actions */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-glass);
}

.btn-cancel,
.btn-submit {
  padding: 0.875rem 1.5rem;
  border-radius: var(--radius-lg);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-speed);
  border: none;
  font-size: 0.95rem;
}

.btn-cancel {
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
}

.btn-cancel:hover {
  background: var(--surface-glass-hover);
  color: var(--text-primary);
}

.btn-submit {
  background: var(--primary-gradient);
  color: white;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Responsive */
@media (max-width: 768px) {
  .create-container {
    margin: 1rem;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .form-section.full-width {
    grid-column: 1;
  }
  
  .submission-options {
    grid-template-columns: 1fr;
  }
  
  .create-form {
    padding: 1.5rem;
  }
}

/* Auth Required Modal */
.auth-required-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2100;
  padding: 1rem;
}

.auth-required-modal.active {
  display: flex;
}

.auth-required-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-2xl);
  padding: 2.5rem;
  max-width: 450px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

.auth-required-content i {
  font-size: 3rem;
  color: var(--accent-primary);
  margin-bottom: 1rem;
}

.auth-required-content h3 {
  color: var(--text-headings);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.auth-required-content p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.auth-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.auth-actions a,
.auth-actions button {
  padding: 0.875rem 1.5rem;
  border-radius: var(--radius-lg);
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-speed);
  cursor: pointer;
}

.btn-signin {
  background: var(--primary-gradient);
  color: white !important;
  border: none;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.btn-signin:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

.private-badge {
    position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    backdrop-filter: blur(10px);
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* --- Persona description reveal (desktop hover, mobile toggle) --- */
.persona-info .persona-desc {
  margin: 0.5rem 0 0.75rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  position: relative;
  max-height: calc(1.5em * 3);
  transition: all var(--transition-speed);
}

/* subtle gradient fade at the bottom when clamped */
.persona-info .persona-desc::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2.2rem;
  background: linear-gradient(to bottom, rgba(0,0,0,0), var(--bg-primary));
  pointer-events: none;
  opacity: 1;
  transition: opacity var(--transition-speed);
}

/* Desktop: expand on hover/focus */
@media (hover: hover) and (pointer: fine) {
  .persona-card-new:hover .persona-desc,
  .persona-card-new:focus-within .persona-desc {
    -webkit-line-clamp: unset;
    max-height: none;
    color: var(--text-primary);
  }
  .persona-card-new:hover .persona-desc::after,
  .persona-card-new:focus-within .persona-desc::after {
    opacity: 0;
  }
}

/* Mobile/touch: expand when card has .desc-open */
.persona-card-new.desc-open .persona-desc {
  -webkit-line-clamp: unset;
  max-height: none;
  color: var(--text-primary);
}
.persona-card-new.desc-open .persona-desc::after {
  opacity: 0;
}

/* The small toggle button (shown on touch + when keyboard-focused) */
.desc-toggle {
  margin-top: 0.25rem;
  background: transparent;
  border: 0;
  color: var(--accent-primary);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  display: none; /* hidden by default (desktop hover doesn’t need it) */
}

/* show toggle on touch devices */
@media (hover: none), (pointer: coarse) {
  .desc-toggle { display: inline-flex; }
}

/* also show when the card is keyboard-focused */
.persona-card-new:focus-within .desc-toggle {
  display: inline-flex;
}
/* Conversation Starters */
.starters-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#startersInputs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.starter-input {
    background: var(--surface-glass, rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #ffffff);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.starter-input:focus {
    border-color: var(--primary-color, #667eea);
    background: rgba(255, 255, 255, 0.08);
}

.btn-add-starter {
    align-self: flex-start;
    background: transparent;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-add-starter:hover {
    border-color: var(--primary-color, #667eea);
    color: var(--primary-color, #667eea);
}

/* Chat Starter Bubbles */
.chat-starters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    animation: fadeInUp 0.5s ease;
}

.starter-bubble {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: var(--text-primary, #ffffff);
    padding: 0.6rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    max-width: 250px;
    text-align: center;
}

.starter-bubble:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.25), rgba(118, 75, 162, 0.25));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.starter-bubble i {
    margin-right: 0.5rem;
    opacity: 0.7;
}

.starters-intro {
    width: 100%;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    opacity: 0.8;
}
/* ==========================================================================
   CODE BLOCK STYLING
   ========================================================================== */
.code-block {
  margin: 1rem 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--surface-glass);
  border-bottom: 1px solid var(--border-glass);
}

.code-language {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
}

.copy-code-btn {
  padding: 0.25rem 0.75rem;
  background: var(--surface-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-speed);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.copy-code-btn:hover {
  background: var(--surface-glass-hover);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.code-block pre {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  background: rgba(0, 0, 0, 0.2);
}

.code-block code {
  font-family: 'Cascadia Code', 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-primary);
  display: block;
  white-space: pre;
}

.inline-code {
  padding: 0.125rem 0.375rem;
  background: var(--surface-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  font-family: 'Cascadia Code', 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.875em;
  color: var(--accent-primary);
}

/* Scrollbar for code blocks */
.code-block pre::-webkit-scrollbar {
  height: 6px;
}

.code-block pre::-webkit-scrollbar-track {
  background: transparent;
}

.code-block pre::-webkit-scrollbar-thumb {
  background: var(--border-glass-hover);
  border-radius: 3px;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: 12px;
    right: 5px!important;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Announcements Modal */
.announcements-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.announcements-modal.active {
    opacity: 1;
    pointer-events: all;
}

.announcements-container {
    background: #0D0C1D;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

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

.announcements-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.announcements-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mark-all-read {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.mark-all-read:hover {
    color: var(--text-primary);
}

.close-announcements {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.2s;
}

.close-announcements:hover {
    color: var(--text-primary);
}

.announcements-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.announcement-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: #1A1A2E;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    transition: all 0.3s;
    position: relative;
}

.announcement-item:hover {
    transform: translateX(5px);
}

.announcement-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.announcement-item.approved .announcement-icon {
    background: rgba(76, 217, 100, 0.1);
    color: #4CD964;
}

.announcement-item.rejected .announcement-icon {
    background: rgba(255, 59, 48, 0.1);
    color: #FF3B30;
}

.announcement-content {
    flex: 1;
}

.announcement-content h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.announcement-content p {
    margin: 0 0 0.5rem 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

.announcement-date {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.dismiss-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.2s;
}

.dismiss-btn:hover {
    color: var(--text-primary);
    background: var(--surface-primary);
    border-radius: 8px;
}

.no-announcements {
    text-align: center;
    padding: 3rem;
}

.no-announcements i {
    font-size: 3rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

.no-announcements h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
}

.no-announcements p {
    color: var(--text-secondary);
    margin: 0 0 1.5rem 0;
}

.no-announcements .btn-signin {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    text-decoration: none;
    transition: transform 0.2s;
}

.no-announcements .btn-signin:hover {
    transform: scale(1.05);
}

/* Submission Success Modal */
.submission-success-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.submission-success-modal.active {
    opacity: 1;
    pointer-events: all;
}

.submission-success-content {
    background: var(--surface-primary);
    border-radius: 20px;
    padding: 2.5rem;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: bounceIn 0.5s ease-out;
}

@keyframes bounceIn {
    0% { transform: scale(0.9); opacity: 0; }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

.success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.success-icon i {
    font-size: 2.5rem;
    color: white;
}

.submission-success-content h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

.submission-success-content p {
    color: var(--text-secondary);
    margin: 0 0 1rem 0;
    line-height: 1.5;
}

.success-note {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    background: var(--surface-secondary);
    padding: 0.75rem;
    border-radius: 10px;
    margin: 1rem 0 1.5rem 0 !important;
}

.btn-got-it {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-got-it:hover {
    transform: scale(1.05);
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(-20px); }
}
/* ==========================================================================
   MY PERSONAS MODAL
   ========================================================================== */
.my-personas-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 2000;
    overflow-y: auto;
    padding: 2rem;
}

.my-personas-modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.my-personas-container {
    width: 100%;
    max-width: 1200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-2xl);
    margin: 2rem auto;
    animation: slideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

.my-personas-header {
    padding: 2rem;
    background: var(--glass-background);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.my-personas-header h2 {
    margin: 0;
    color: var(--text-headings);
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.close-my-personas {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.close-my-personas:hover {
    background: var(--surface-glass-hover);
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.my-personas-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-glass);
    overflow-x: auto;
}

.tab-btn {
    padding: 0.625rem 1.25rem;
    background: transparent;
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed);
    white-space: nowrap;
}

.tab-btn:hover {
    background: var(--surface-glass);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
}

.my-personas-content {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

.my-personas-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.my-persona-item {
    background: var(--card-bg);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-speed);
    position: relative;
}

.my-persona-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.my-persona-image {
    height: 150px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    position: relative;
    overflow: hidden;
}

.my-persona-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.persona-status-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.status-private {
    background: rgba(102, 126, 234, 0.9);
    color: white;
}

.status-pending {
    background: rgba(245, 158, 11, 0.9);
    color: white;
}

.status-approved {
    background: rgba(16, 185, 129, 0.9);
    color: white;
}

.status-rejected {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

.my-persona-info {
    padding: 1rem;
}

.my-persona-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.my-persona-tagline {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.my-persona-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.my-persona-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    flex: 1;
    padding: 0.5rem;
    background: var(--surface-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-speed);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.action-btn:hover {
    background: var(--surface-glass-hover);
    color: var(--text-primary);
}

.action-btn.edit:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.action-btn.delete:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Delete Confirmation Modal */
.delete-confirm-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.delete-confirm-modal.active {
    display: flex;
}

.delete-confirm-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 450px;
    text-align: center;
}

.delete-confirm-content i {
    font-size: 2rem;
    color: var(--danger-color);
    
}
.fa-trash:before {
    color: white!important;
}
.delete-confirm-content h3 {
    color: var(--text-headings);
    margin-bottom: 0.5rem;
}

.delete-confirm-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.delete-warning {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    color: var(--danger-color);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.delete-confirm-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

@media (max-width: 768px) {
    .my-personas-container {
        margin: 0;
        border-radius: 0;
        height: 100vh;
    }
    
    .my-personas-list {
        grid-template-columns: 1fr;
    }
    
    .my-personas-tabs {
        padding: 1rem;
        gap: 0.35rem;
    }
    
    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
}

/* ---- Delete Confirmation Modal ---- */
.delete-confirm-modal {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  z-index: 1000;
  animation: dc-fade-in .18s ease-out;
}

.delete-confirm-content {
  width: min(560px, calc(100% - 2rem));
  background:
    linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015)),
    var(--surface, #0f1121);
  color: var(--text-primary, #e9e9ef);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 20px;
  padding: 26px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
  transform: translateY(6px) scale(.98);
  animation: dc-pop .18s ease-out forwards;
}

.delete-confirm-content .modal-head {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}

.delete-confirm-content .warn-icon {
  width: 56px; height: 56px; border-radius: 14px;
  display: grid; place-items: center; font-size: 24px;
  background: linear-gradient(135deg, rgba(255,86,86,.15), rgba(255,0,0,.08));
  color: var(--danger-color, #ff5c5c);
  border: 1px solid rgba(255,86,86,.35);
}

.delete-confirm-content h3 {
  margin: 0;
  font-size: 1.5rem; line-height: 1.2; letter-spacing: .2px;
}

.delete-confirm-content .sub {
  color: var(--text-secondary, #b7b7c9);
  margin: 2px 0 0;
}

.delete-warning {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  margin: 16px 0 8px;
  border-radius: 14px;
  background: rgba(255,86,86,.10);
  border: 1px solid rgba(255,86,86,.25);
  color: var(--text-secondary, #c9c9d6);
}

.delete-warning i { color: var(--danger-color, #ff5c5c); margin-top: 2px; }

.delete-confirm-actions {
  display: flex; gap: 12px; justify-content: flex-end;
  margin-top: 18px; flex-wrap: wrap;
}

/* Buttons */
.btn { 
  appearance: none; border: 0; cursor: pointer;
  height: 44px; padding: 0 18px;
  border-radius: 999px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 10px;
  transition: transform .06s ease, box-shadow .12s ease, background .12s ease, opacity .12s ease;
}

.btn:active { transform: translateY(1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-primary, #e9e9ef);
  border: 1px solid rgba(255,255,255,.16);
}
.btn-ghost:hover { background: rgba(255,255,255,.06); }
.btn-ghost:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255,255,255,.18); }

.btn-danger {
  background: linear-gradient(135deg, var(--danger-color, #ff5c5c), #d7263d);
  color: #fff;
  box-shadow: 0 10px 24px rgba(215,38,61,.35);
}
.btn-danger:hover { filter: brightness(1.06); }
.btn-danger:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(215,38,61,.45); }

/* Mobile: stack buttons and stretch */
@media (max-width: 520px) {
  .delete-confirm-actions { flex-direction: column-reverse; }
  .delete-confirm-actions .btn { width: 100%; justify-content: center; }
}

/* Animations */
@keyframes dc-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes dc-pop { to { transform: translateY(0) scale(1); } }


/* layer scale */
:root{
  --z-dropdown: 1000;
  --z-modal: 2000;      /* myPersonasModal */
  --z-topmodal: 4000;   /* delete confirm */
}

/* ensure personas modal is a stacking context */
.my-personas-modal {
  position: fixed;      /* or absolute -> fixed is better for overlays */
  inset: 0;
  z-index: var(--z-modal);
}

/* confirm delete overlay on TOP of everything else */
.delete-confirm-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-topmodal);
}
/* reset any legacy decorations on the delete button */
.btn-delete::before,
.btn-delete::after { content: none !important; }

.btn-danger i { position: static; margin-right: 8px; }


.delete-confirm-content { padding: 28px 28px 22px; border-radius: 22px; }
.delete-confirm-content h3 { font-size: 28px; margin-bottom: 6px; }
.delete-confirm-content .sub { font-size: 16px; opacity: .9; }

.delete-warning {
  font-size: 15px; line-height: 1.55;
  background: rgba(255,86,86,.12);
  border: 1px solid rgba(255,86,86,.28);
  color: #d9d9e6;
}

.delete-confirm-actions { margin-top: 22px; }

.btn-ghost {
  height: 46px; padding: 0 22px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
}

.btn-danger {
  height: 52px; padding: 0 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--danger-color,#ff5c5c), #d7263d);
  box-shadow: 0 12px 28px rgba(215,38,61,.35);
}


/* NEW: Align categories left and toggle right */
.category-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 0 1rem;
}

/* NEW: Pro-only toggle pill */
.pro-toggle {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .9rem;
  border-radius: 999px;
  border: 1px solid var(--border-glass);
  background: var(--surface-glass);
  color: #fbbf24;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: all var(--transition-speed);
}

.pro-toggle i { font-size: 0.95rem; opacity: .85; }
.pro-toggle:hover { background: var(--surface-glass-hover); color: var(--text-primary); }

.pro-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Active state (toggled on by JS for broad support) */
.pro-toggle.active {
  background: var(--primary-gradient);
  border-color: transparent;
  color: #fff;
}
.pro-toggle.active i { opacity: 1; }

/* Mobile: keep it tidy */
@media (max-width: 867px) {
  .category-inner { flex-wrap: wrap; gap: .5rem; padding: .5rem 1rem; }
}

/* ==========================================================================
   LEADERBOARD MODAL
   ========================================================================== */
.leaderboard-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 2000;
    overflow-y: auto;
    padding: 2rem;
}

.leaderboard-modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.leaderboard-container {
    width: 100%;
    max-width: 900px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-2xl);
    margin: 2rem auto;
    animation: slideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

.leaderboard-header {
    padding: 2rem;
    background: var(--glass-background);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.leaderboard-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
}

.leaderboard-header h2 {
    margin: 0;
    color: var(--text-headings);
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.leaderboard-header h2 i {
    color: #FFD700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.close-leaderboard {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.close-leaderboard:hover {
    background: var(--surface-glass-hover);
    border-color: var(--danger-color);
    color: var(--danger-color);
}

/* Stats Section */
.leaderboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-glass);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--glass-background);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    transition: all var(--transition-speed);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary);
}

.stat-card i {
    font-size: 2rem;
    color: var(--accent-primary);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-headings);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Leaderboard List */
.leaderboard-list {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    margin-bottom: 1rem;
    transition: all var(--transition-speed);
    cursor: pointer;
    position: relative;
}

.leaderboard-item:hover {
    transform: translateX(5px);
    background: var(--surface-glass-hover);
    border-color: var(--accent-primary);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* Rank Badge */
.rank-badge {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.25rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.rank-badge.gold {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.rank-badge.silver {
    background: linear-gradient(135deg, #C0C0C0, #B8B8B8);
    color: #000;
    box-shadow: 0 0 20px rgba(192, 192, 192, 0.5);
}

.rank-badge.bronze {
    background: linear-gradient(135deg, #CD7F32, #B87333);
    color: #FFF;
    box-shadow: 0 0 20px rgba(205, 127, 50, 0.5);
}

.rank-badge.regular {
    background: var(--surface-glass);
    border: 2px solid var(--border-glass);
    color: var(--text-secondary);
}

/* Leaderboard Avatar */
.leaderboard-avatar {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    flex-shrink: 0;
}

.leaderboard-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Leaderboard Info */
.leaderboard-info {
    flex: 1;
    min-width: 0;
}

.leaderboard-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-headings);
    margin-bottom: 0.25rem;
}

.leaderboard-tagline {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.leaderboard-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.leaderboard-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Leaderboard Score */
.leaderboard-score {
    text-align: center;
    padding: 0 1rem;
}

.score-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    display: block;
}

.score-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Pro Badge in Leaderboard */
.leaderboard-item .pro-badge-mini {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Loading State */
.loading-skeleton {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

/* Empty State */
.leaderboard-empty {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.leaderboard-empty i {
    font-size: 3rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .leaderboard-container {
        margin: 0;
        border-radius: 0;
        height: 100vh;
    }
    
    .leaderboard-item {
        flex-direction: column;
        text-align: center;
        padding: 1.25rem;
    }
    
    .rank-badge {
        margin-bottom: 0.5rem;
    }
    
    .leaderboard-meta {
        justify-content: center;
    }
    
    .leaderboard-score {
        margin-top: 0.75rem;
    }
}

/* Chat: keep messages centered even with long code/markdown */
.message,
.message-content {
  min-width: 0;               /* critical for flex items */
}

.message-content {
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;    /* break super-long tokens/URLs */
}

/* Code & Markdown inside bubbles */
.message-content pre,
.message-content code,
.message-content kbd,
.message-content samp {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.message-content pre {
  display: block;
  margin: 0.5rem 0;
  padding: 0.75rem 1rem;
  background: var(--surface-glass);
  border: 1px solid var(--border-glass);
  border-radius: 0.75rem;
  box-sizing: border-box;

  /* keep newlines, but wrap long lines/tokens */
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;

  /* last-resort safety so nothing widens the layout */
  max-width: 100%;
  overflow-x: auto;
}

/* Tables/images from markdown shouldn’t widen the bubble */
.message-content table { display: block; max-width: 100%; overflow-x: auto; }
.message-content img, .message-content video { max-width: 100%; height: auto; }


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

/* ==========================================================================
   SEO FOOTER SECTION - About AI Persona Studio
   ========================================================================== */
.seo-footer-section {
    position: relative;
    padding: 5rem 0;
    margin-top: 4rem;
    background: linear-gradient(180deg, 
        var(--bg-primary) 0%, 
        rgba(26, 26, 46, 0.5) 50%, 
        var(--bg-primary) 100%);
    border-top: 1px solid var(--border-glass);
    overflow: hidden;
}

.seo-footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
}

/* Decorative glow effects */
.seo-footer-glow-1,
.seo-footer-glow-2 {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    pointer-events: none;
}

.seo-footer-glow-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-color) 0%, transparent 70%);
    top: -300px;
    left: -200px;
    animation: float 20s infinite alternate;
}

.seo-footer-glow-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--secondary-color) 0%, transparent 70%);
    bottom: -250px;
    right: -150px;
    animation: float 15s infinite alternate-reverse;
}

.seo-footer-content {
    background: var(--glass-background);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-2xl);
    padding: 3rem;
    position: relative;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
}

/* Header section */
.seo-footer-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.seo-footer-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, 
        rgba(167, 139, 250, 0.1), 
        rgba(79, 70, 229, 0.1));
    border: 1px solid var(--accent-primary);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.seo-footer-badge i {
    font-size: 1rem;
    animation: sparkle 2s infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.seo-footer-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-headings);
    margin: 0;
    line-height: 1.2;
}

.gradient-text {
    background: linear-gradient(135deg, #A78BFA 0%, #FFFFFF 50%, #A78BFA 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Text content */
.seo-footer-text {
    max-width: 900px;
    margin: 0 auto 3rem;
    text-align: center;
}

.seo-footer-paragraph {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.seo-footer-paragraph:last-child {
    margin-bottom: 0;
}

.seo-footer-paragraph strong {
    color: var(--text-primary);
    font-weight: 600;
}

.seo-footer-paragraph em {
    color: var(--accent-primary);
    font-style: normal;
}

/* Stats section */
.seo-footer-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item {
    text-align: center;
    position: relative;
}

.stat-item i {
    font-size: 2rem;
    color: var(--accent-primary);
    margin-bottom: 0.75rem;
    display: block;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* CTA Button */
.seo-footer-cta {
    text-align: center;
    margin-top: 2.5rem;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: var(--primary-gradient);
    color: white;
    text-decoration: none;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1.05rem;
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
    transition: all var(--transition-speed);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(79, 70, 229, 0.5);
    color: white;
}

.cta-button i {
    font-size: 1.2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .seo-footer-section {
        padding: 3rem 0;
    }
    
    .seo-footer-content {
        padding: 2rem 1.5rem;
    }
    
    .seo-footer-title {
        font-size: 2rem;
    }
    
    .seo-footer-paragraph {
        font-size: 1rem;
    }
    
    .seo-footer-stats {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem;
    }
    
    .stat-item {
        padding: 1rem;
        background: var(--surface-glass);
        border-radius: var(--radius-lg);
        border: 1px solid var(--border-glass);
    }
}

@media (max-width: 480px) {
    .seo-footer-container {
        padding: 0 1rem;
    }
    
    .seo-footer-title {
        font-size: 1.75rem;
    }
    
    .seo-footer-badge {
        font-size: 0.75rem;
    }
}