:root {
  /* Default: Light Theme */
  --bg: #f3f6f9;
  --bg-gradient: radial-gradient(circle at top left, #ffffff, #eef2f6);
  --panel: rgba(255, 255, 255, 0.7);
  --panel-light: rgba(255, 255, 255, 0.9);
  --panel-border: rgba(255, 255, 255, 0.5);
  
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  
  --accent-gold: #f59e0b;
  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-purple: #8b5cf6;
  --accent-green: #10b981;
  --linked-in: #0a66c2;
  
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
  
  --font: 'Outfit', sans-serif;
  --shadow-sm: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
}

[data-theme="dark"] {
  --bg: #0b0f16;
  --bg-gradient: radial-gradient(circle at 15% 15%, #182030, #0b0f16 70%);
  --panel: rgba(20, 26, 35, 0.6);
  --panel-light: rgba(30, 38, 50, 0.8);
  --panel-border: rgba(255, 255, 255, 0.08);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #475569;
  
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

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

body {
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
  padding: 5vh 5vw;
  transition: all 0.4s ease;
  overflow-x: hidden;
}

/* Glassmorphism base */
.glass {
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-glass);
}

.shell {
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */
.app-header {
  margin-bottom: 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.brand h1 {
  /* Responsive typography */
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-top: 0.3rem;
}

.brand h1 span {
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

/* Theme Toggle */
.theme-btn {
  background: var(--panel-light);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 0.6rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-btn:hover {
  transform: rotate(30deg) scale(1.1);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.badge {
  padding: 0.4rem 1rem;
  border-radius: 99px;
  font-size: clamp(0.6rem, 1.5vw, 0.75rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid transparent;
}

.neon-blue { color: var(--accent-blue); border-color: rgba(59, 130, 246, 0.3); background: rgba(59, 130, 246, 0.05); }
.neon-gold { color: var(--accent-gold); border-color: rgba(245, 158, 11, 0.3); background: rgba(245, 158, 11, 0.05); }

/* Control Strip */
.control-strip {
  border-radius: var(--radius-xl);
  padding: 1.5rem 2rem;
  margin-bottom: 2.5rem;
}

.control-group {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
}

.compact-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 180px;
}

.compact-field span {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.compact-field select {
  background: var(--panel-light);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.8rem 1rem;
  width: 100%;
  transition: all 0.2s ease;
  appearance: none;
}

.compact-field select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Workspace Grid */
.workspace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

.panel {
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--accent-blue), transparent);
  opacity: 0.3;
}

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

.eyebrow {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent-blue);
}

.panel-header h2 {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

/* Composer Area */
#sourceText {
  width: 100%;
  min-height: 180px;
  background: var(--panel-light);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  color: var(--text-main);
  padding: 1.5rem;
  font-family: inherit;
  /* Responsive font for inputs */
  font-size: clamp(1rem, 2vw, 1.1rem);
  line-height: 1.6;
  resize: vertical;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

#sourceText:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.template-chip {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: 99px;
  font-size: clamp(0.75rem, 1.5vw, 0.85rem);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.template-chip:hover {
  background: var(--panel-light);
  border-color: var(--text-main);
  color: var(--text-main);
  transform: translateY(-2px);
}

.templates-row { margin-bottom: 2rem; }
.small-label { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 0.8rem; font-weight: 600; }
.example-list { display: flex; gap: 0.8rem; flex-wrap: wrap; }

.cta-button {
  width: 100%;
  padding: 1.2rem;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: #fff;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  margin-top: auto;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5);
  filter: brightness(1.1);
}

/* Preview Area */
.header-controls { display: flex; gap: 0.8rem; flex-wrap: wrap;}

.ghost-btn {
  background: var(--panel-light);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 0.5rem 1rem;
  border-radius: 99px;
  font-size: clamp(0.75rem, 1.5vw, 0.8rem);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.ghost-btn:hover {
  background: var(--text-main);
  color: var(--bg);
  border-color: var(--text-main);
}

.ghost-btn svg { width: 14px; height: 14px; }

.linkedin-card {
  background: #ffffff; /* LinkedIn posts are white */
  color: #000000;
  border-radius: var(--radius-md);
  padding: 2rem;
  min-height: 350px;
  /* Responsive font for the output */
  font-size: clamp(0.95rem, 1.8vw, 1.05rem);
  line-height: 1.6;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  position: relative;
}

[data-theme="dark"] .linkedin-card {
  background: rgba(255,255,255,0.02);
  color: #f1f5f9;
  border: 1px solid var(--panel-border);
}

.post-content {
  white-space: pre-wrap;
  word-break: break-word;
}

.logic-footer {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--panel-border);
}

.logic-copy {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: monospace;
}

/* Personas Section */
.persona-section {
  padding: 3rem 2rem;
  border-radius: var(--radius-xl);
  text-align: center;
  margin-bottom: 2rem;
}

.section-title {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-weight: 800;
  margin-bottom: 2.5rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-main), var(--text-muted));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.5rem;
}

.persona-card {
  background: var(--panel-light);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.persona-card::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.persona-card:hover { 
  transform: translateY(-5px); 
  border-color: var(--accent-blue);
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.15);
}

.persona-card:hover::after { opacity: 1; }

.persona-card.active { 
  border-color: var(--accent-blue); 
  background: rgba(59, 130, 246, 0.05); 
  box-shadow: 0 0 0 2px var(--accent-blue); 
}

.persona-icon { color: var(--accent-blue); margin-bottom: 1rem; display: flex; justify-content: center; }
.persona-icon svg { width: 32px; height: 32px; }

.persona-name { font-size: clamp(0.85rem, 2vw, 0.95rem); font-weight: 700; display: block; margin-bottom: 0.5rem; color: var(--text-main); }
.persona-desc { font-size: clamp(0.7rem, 1.5vw, 0.8rem); color: var(--text-muted); line-height: 1.4; }

/* Typing Animation */
@keyframes cursor { 50% { border-color: transparent } }
.typing::after {
  content: '|';
  border-right: 2px solid var(--accent-blue);
  animation: cursor .5s step-end infinite;
}

/* Responsiveness refinement */
@media (max-width: 768px) {
  .shell { padding: 0; }
  .workspace-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .panel { padding: 1.5rem; border-radius: var(--radius-lg); }
  .control-strip { padding: 1.5rem; }
  .compact-field { flex: 1 1 100%; }
  
  .header-actions { justify-content: space-between; width: 100%; }
  .app-header { flex-direction: column; align-items: flex-start; }
  
  .persona-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 1rem; }
  .persona-card { padding: 1.2rem 0.8rem; }
}

@media (max-width: 480px) {
  body { padding: 1rem; }
  .brand h1 { font-size: 1.5rem; }
  .panel-header h2 { font-size: 1.1rem; }
}
