/* IYP Styles */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #0ea5e9;
  --accent: #f59e0b;
  --success: #10b981;
  --error: #ef4444;
  
  --bg-dark: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-input: #252542;
  --bg-hover: #2a2a4a;
  
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  --border: #2e2e4a;
  --border-light: #3e3e5a;
  
  --radius: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* Screen Management */
.screen {
  display: none;
  min-height: 100vh;
  padding-top: 50px; /* Smaller auth header space */
}

.screen.active {
  display: block;
}

/* Chat screen needs special handling */
#chat-screen.active {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding-top: 50px;
}

#chat-screen .chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 50px);
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding: 0 1rem;
}

/* Auth header smaller */
.auth-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(15, 15, 26, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1rem;
  z-index: 1000;
  height: 50px;
}

/* Landing Screen */
.landing-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  background: 
    radial-gradient(ellipse at top, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(14, 165, 233, 0.1) 0%, transparent 50%),
    var(--bg-dark);
}

.landing-content {
  text-align: center;
  max-width: 600px;
}

.logo-mark {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 2rem;
  letter-spacing: -0.02em;
}

h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  letter-spacing: -0.03em;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 3rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.url-input-container {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.url-input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 1rem;
  transition: all 0.2s ease;
}

.url-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.url-icon {
  font-size: 1.25rem;
  margin-right: 0.75rem;
}

.url-input-wrapper input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  padding: 1rem 0;
  outline: none;
}

.url-input-wrapper input::placeholder {
  color: var(--text-muted);
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 120px;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.secondary-btn {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 1rem 2rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.danger-btn {
  background: #ef4444;
  color: white;
  border: none;
  padding: 0.625rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.danger-btn:hover {
  background: #dc2626;
}

.hint {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.landing-features {
  display: flex;
  gap: 2rem;
  margin-top: 4rem;
  flex-wrap: wrap;
  justify-content: center;
}

.feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.feature-icon {
  font-size: 1.5rem;
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.large {
  width: 48px;
  height: 48px;
  border-width: 4px;
  border-color: rgba(99,102,241,0.3);
  border-top-color: var(--primary);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Analyzing Screen */
.analyzing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  padding: 2rem;
}

.analyzing-spinner {
  margin-bottom: 2rem;
}

.analyzing-container h2 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.analyzing-url-display {
  color: var(--primary);
  font-family: monospace;
  word-break: break-all;
  max-width: 400px;
  margin-bottom: 1rem;
}

.analyzing-hint {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Chat Screen */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px); /* Account for auth header */
  max-width: 800px;
  margin: 0 auto;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  min-height: 60px;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.logo-small {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

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

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

.session-code {
  font-family: 'Space Grotesk', monospace;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}

.analyzing-url {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  max-width: 85%;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  animation: messageIn 0.3s ease;
}

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

.message.assistant {
  background: var(--bg-card);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.message.user {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.message-content {
  font-size: 0.95rem;
  line-height: 1.7;
}

.message-content strong {
  font-weight: 600;
  color: var(--primary-light);
}

.message.user .message-content strong {
  color: white;
}

.message-content p {
  margin-bottom: 0.75rem;
}

.message-content p:last-child {
  margin-bottom: 0;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: fit-content;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

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

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Chat Input */
.chat-input-area {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.upload-preview {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--primary);
}

.upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-upload {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  background: var(--error);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.5rem 0.75rem;
  transition: all 0.2s ease;
}

.chat-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.chat-input-wrapper input,
.chat-input-wrapper textarea {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  padding: 0.5rem;
  outline: none;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 150px;
  line-height: 1.5;
  overflow-y: auto;
}

.chat-input-wrapper input::placeholder,
.chat-input-wrapper textarea::placeholder {
  color: var(--text-muted);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.mic-btn.listening {
  background: var(--error);
  color: white;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

.send-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

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

.speech-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--primary);
}

.listening-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  color: var(--primary-light);
  font-weight: 500;
}

.pulse-dot {
  width: 12px;
  height: 12px;
  background: var(--error);
  border-radius: 50%;
  animation: pulse 1s infinite;
}

.speech-preview {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-style: italic;
  max-width: 100%;
  text-align: center;
  word-break: break-word;
}

.speech-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.speech-indicator {
  width: 10px;
  height: 10px;
  background: var(--error);
  border-radius: 50%;
  animation: pulse 1s infinite;
}

/* Complete Screen */
.complete-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  text-align: center;
}

.complete-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
}

.complete-container h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  margin-bottom: 1rem;
}

.session-code-display {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.session-code-display strong {
  color: var(--accent);
  font-family: 'Space Grotesk', monospace;
}

.spec-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: left;
  max-width: 500px;
  width: 100%;
  margin-bottom: 2rem;
}

.spec-summary h3 {
  font-size: 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}

.spec-summary h3:first-child {
  margin-top: 0;
}

.spec-summary p {
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.spec-summary .price-total {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--success);
  margin-top: 1rem;
}

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

.generation-result {
  margin-top: 2rem;
  padding: 2rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
  border: 1px solid var(--success);
  border-radius: var(--radius-lg);
  text-align: center;
}

.generation-result h3 {
  color: var(--success);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.generation-result a {
  color: var(--secondary);
  word-break: break-all;
}

.generation-result p {
  margin-bottom: 0.5rem;
}

/* Approval buttons for interview mode */
.approval-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.approval-buttons button {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.approve-btn {
  background: var(--success);
  color: white;
}

.approve-btn:hover {
  background: #059669;
}

.rerecord-btn {
  background: var(--primary);
  color: white;
}

.rerecord-btn:hover {
  background: #6366f1;
}

.edit-btn {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border) !important;
}

.edit-btn:hover {
  background: var(--border);
}

/* TTS indicator */
.speaking-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--primary);
  font-size: 0.75rem;
  margin-left: 0.5rem;
}

.speaking-indicator span {
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
  animation: pulse 0.6s infinite alternate;
}

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

@keyframes pulse {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(1.5); opacity: 0.5; }
}

/* Responsive */
@media (max-width: 640px) {
  h1 {
    font-size: 2.5rem;
  }
  
  .subtitle {
    font-size: 1rem;
  }
  
  .url-input-container {
    flex-direction: column;
  }
  
  .landing-features {
    flex-direction: column;
    gap: 1rem;
  }
  
  .message {
    max-width: 95%;
  }
  
  .complete-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .complete-actions button {
    width: 100%;
  }
}

/* Markdown in messages */
.message-content ul, 
.message-content ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.message-content li {
  margin-bottom: 0.25rem;
}

.message-content code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
}

/* ========================================
   AUTH STYLES
   ======================================== */

.auth-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(15, 15, 26, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  z-index: 1000;
}

.auth-header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.auth-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.auth-nav a {
  color: var(--text-secondary);
  text-decoration: none;
}

.auth-nav a:hover {
  color: var(--primary);
}

.auth-greeting {
  color: var(--text-secondary);
}

.auth-greeting span {
  color: var(--text-primary);
}

.auth-btn-small {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
}

.auth-btn-small:hover {
  background: var(--surface);
  border-color: var(--primary);
}

.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  background: radial-gradient(ellipse at top, rgba(99, 102, 241, 0.15) 0%, transparent 50%), var(--bg);
}

.auth-form {
  background: var(--surface);
  padding: 2.5rem;
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border);
}

.auth-form h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  text-align: center;
}

.auth-subtitle {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 2rem;
}

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

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.form-control {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
}

.form-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 0.75rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.full-width {
  width: 100%;
}

.auth-switch {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-secondary);
}

.auth-switch a {
  color: var(--primary);
  text-decoration: none;
}

/* ========================================
   MY SITES STYLES
   ======================================== */

.my-sites-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 5rem 2rem 2rem;
}

.my-sites-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.my-sites-header h1 {
  font-family: 'Space Grotesk', sans-serif;
}

.sites-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.site-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.site-card:hover {
  border-color: var(--primary);
}

.site-card-info h3 {
  margin-bottom: 0.5rem;
}

.site-card-meta {
  display: flex;
  gap: 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  flex-wrap: wrap;
  align-items: center;
}

.site-card-actions {
  display: flex;
  gap: 0.5rem;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-live { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-maintenance { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.badge-disabled { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.badge-draft { background: rgba(100, 100, 100, 0.2); color: #9ca3af; }

.cms-status { font-size: 0.75rem; }
.cms-status.active { color: #34d399; }
.cms-status.expired { color: #f87171; }

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--surface);
  border-radius: 16px;
  border: 1px dashed var(--border);
}

.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { margin-bottom: 0.5rem; }
.empty-state p { color: var(--text-secondary); margin-bottom: 1.5rem; }

/* Complete Screen Updates */
.site-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.site-links a.large {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

.cms-note {
  color: #fbbf24;
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

.spec-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.spec-item:last-child { border-bottom: none; }

/* Responsive Auth */
@media (max-width: 640px) {
  .auth-form { padding: 1.5rem; }
  .my-sites-header { flex-direction: column; gap: 1rem; }
  .site-card { flex-direction: column; align-items: flex-start; }
  .site-card-actions { width: 100%; }
  .site-card-actions a { flex: 1; text-align: center; }
  .auth-nav { gap: 1rem; font-size: 0.875rem; }
  .site-links { flex-direction: column; }
  .site-links a.large { width: 100%; text-align: center; }
}

/* Client Select (Admin) */
.client-select-container {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.client-select-container label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.client-select-container select {
  width: 100%;
  max-width: 300px;
}

/* TTS Toggle */
.chat-header-right {
  display: flex;
  align-items: center;
}

.tts-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.tts-toggle-label:hover {
  border-color: var(--primary);
}

.tts-toggle-label input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.tts-toggle-label input:checked + span {
  color: var(--primary);
}

/* TTS Toggle Button */
.tts-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 1.25rem;
  transition: all 0.2s;
}

.tts-toggle:hover {
  background: var(--border);
}

.tts-toggle.active {
  background: var(--primary);
  border-color: var(--primary);
}

/* User Select Container */
.user-select-container {
  margin-bottom: 1.5rem;
  text-align: left;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.user-select-container label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.user-select-container select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #1a1a2e;
  font-size: 1rem;
  cursor: pointer;
}

.user-select-container select option {
  background: #ffffff;
  color: #1a1a2e;
  padding: 0.5rem;
}

.user-select-container select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Chat header right section */
.chat-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Preview Screen */
.preview-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 3rem 2rem;
  text-align: center;
}

.preview-container h2 {
  font-family: 'Space Grotesk', sans-serif;
  margin-bottom: 2rem;
}

.preview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.preview-screenshot-wrapper {
  position: relative;
  background: #1a1a2e;
  min-height: 200px;
  max-height: 350px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-screenshot-wrapper img {
  width: 100%;
  height: auto;
  max-height: 350px;
  object-fit: cover;
  object-position: top;
}

.preview-info {
  padding: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
}

.preview-detail {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.preview-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.preview-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.preview-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.preview-actions .primary-btn.large {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

.preview-hint {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin: 0.5rem 0;
}

@media (max-width: 640px) {
  .preview-actions {
    flex-direction: column;
  }
  .preview-actions button {
    width: 100%;
  }
}

/* Fix chat header visibility */
#chat-screen .chat-container {
  padding-top: 0;
}

#chat-screen .chat-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  min-height: 60px;
}

/* Ensure TTS toggle is visible */
.tts-toggle {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.25rem;
  transition: all 0.2s;
}

.tts-toggle:hover {
  background: var(--border);
}

.tts-toggle.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Chat header layout fix */
.chat-header {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--surface);
}

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

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Generating Screen */
.generating-container {
  max-width: 500px;
  margin: 0 auto;
  padding: 3rem 2rem;
  text-align: center;
}

.generating-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 2rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.generating-container h2 {
  font-family: 'Space Grotesk', sans-serif;
  margin-bottom: 0.5rem;
}

.generating-message {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.generating-timer {
  font-size: 2.5rem;
  font-family: 'Space Grotesk', monospace;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 2rem;
}

.generating-steps {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.generating-steps .step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.generating-steps .step:last-child {
  border-bottom: none;
}

.generating-steps .step.active {
  color: var(--text-primary);
}

.generating-steps .step.done .step-icon {
  color: #22c55e;
}

.generating-steps .step.active .step-icon {
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.generating-warning {
  color: var(--warning, #f59e0b);
  font-size: 0.875rem;
  font-weight: 500;
}

/* Thinking indicator */
.thinking-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.thinking-text {
  font-weight: 500;
}

.thinking-dots span {
  animation: thinkingDot 1.4s infinite;
  opacity: 0;
}

.thinking-dots span:nth-child(1) { animation-delay: 0s; }
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinkingDot {
  0%, 60%, 100% { opacity: 0; }
  30% { opacity: 1; }
}

.thinking-time {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-left: 0.5rem;
}

/* Chat messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Essentials Screen */
.essentials-container {
  max-width: 500px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.essentials-container h2 {
  font-family: 'Space Grotesk', sans-serif;
  text-align: center;
  margin-bottom: 0.5rem;
}

.essentials-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

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

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

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

.form-group input {
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.full-width {
  width: 100%;
}

.primary-btn.large.full-width {
  margin-top: 1rem;
  padding: 1rem;
}

/* Page Builder Screen */
.page-builder-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem;
}

.page-builder-container h2 {
  font-family: 'Space Grotesk', sans-serif;
  text-align: center;
  margin-bottom: 0.5rem;
}

.builder-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.pages-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
  max-height: 50vh;
  overflow-y: auto;
}

.page-builder-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.5rem;
  background: var(--bg-darker);
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

/* Layout Options Grid */
.layout-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  padding: 0.25rem;
}

.layout-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.layout-option:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.layout-option.selected {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

.layout-icon {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-darker);
  border-radius: 8px;
}

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

.layout-info strong {
  display: block;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.layout-source {
  display: block;
  font-size: 0.75rem;
  color: var(--primary);
}

.layout-desc {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.layout-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* Pages Table */
.pages-table-container {
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.pages-table {
  width: 100%;
  border-collapse: collapse;
}

.pages-table th {
  background: var(--bg-darker);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  position: sticky;
  top: 0;
}

.pages-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.pages-table tr:last-child td {
  border-bottom: none;
}

.pages-table tr:hover {
  background: rgba(99, 102, 241, 0.05);
}

.pages-table input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
}

.page-name-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-name-cell.is-submenu {
  padding-left: 1.5rem;
}

.page-name-cell .submenu-indicator {
  color: var(--text-muted);
  font-family: monospace;
}

.page-badge {
  margin-left: 0.5rem;
  font-size: 0.9rem;
  cursor: help;
}

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

.page-actions button {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.page-actions button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.page-actions button.delete-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.add-page-row {
  margin-bottom: 1rem;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-box {
  background: #ffffff;
  padding: 1.5rem;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  color: #333333;
}

.modal-box h3 {
  margin-bottom: 1rem;
  color: #1f2937;
}

.modal-box label {
  color: #374151;
  font-weight: 500;
}

.modal-box input,
.modal-box select,
.modal-box textarea {
  background: #f9fafb;
  border: 1px solid #d1d5db;
  color: #1f2937;
  width: 100%;
  padding: 0.75rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
}

.modal-box input:focus,
.modal-box select:focus,
.modal-box textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.modal-box textarea {
  resize: vertical;
  min-height: 100px;
}

.modal-box .field-hint {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}

.modal-box .form-group {
  margin-bottom: 1rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.page-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  transition: all 0.2s;
}

.page-item.disabled {
  opacity: 0.5;
  background: var(--bg-darker);
}

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

.page-item-header input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
}

.page-item-name {
  flex: 1;
  font-weight: 600;
  font-size: 1rem;
}

.page-item-name input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  width: 100%;
}

.page-item-actions {
  display: flex;
  gap: 0.5rem;
}

.page-item-actions button {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
}

.page-item-actions button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.page-item-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: 2rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.layout-badge {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.submenu-badge {
  background: var(--border);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
}

.renamed-badge {
  background: #fef3c7;
  color: #92400e;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
}

/* Submenu grouping */
.submenu-group {
  margin-left: 1.5rem;
  border-left: 2px solid var(--border);
  padding-left: 0.5rem;
}

.page-item.is-child {
  border-left: none;
}

.page-item.is-child .page-item-header {
  padding-left: 0;
}

.indent {
  color: var(--text-muted);
  margin-right: 0.5rem;
  font-family: monospace;
}

.page-item-about {
  margin-top: 0.75rem;
  margin-left: 2rem;
}

.page-item-about textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.9rem;
  resize: vertical;
  min-height: 60px;
}

.page-item-about textarea::placeholder {
  color: var(--text-muted);
}

/* Page Item Options Row */
.page-item-options {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
  padding-left: 2.5rem;
}

.parent-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.parent-selector label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.parent-selector select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
}

.parent-selector select:focus {
  border-color: var(--primary);
  outline: none;
}

/* Drag Handle */
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 0.25rem;
  user-select: none;
}

.drag-handle:hover {
  color: var(--primary);
}

.page-item.dragging {
  opacity: 0.5;
  border: 2px dashed var(--primary);
}

.page-item.drag-over {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

/* Move buttons */
.move-btn {
  padding: 0.2rem 0.4rem !important;
  font-size: 0.7rem !important;
  line-height: 1;
}

.remove-btn {
  color: #ef4444 !important;
}

.remove-btn:hover {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.1) !important;
}

/* Logo Upload Screen */
.logo-upload-container {
  max-width: 500px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  text-align: center;
}

.logo-subtitle {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.logo-upload-area {
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 3rem;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-card);
  margin-bottom: 1.5rem;
}

.logo-upload-area:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.logo-preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.logo-upload-icon {
  font-size: 3rem;
}

.logo-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.logo-preview-img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
}

.logo-change-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.logo-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.logo-note {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Add Page Section */
.add-page-section {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 1rem;
}

.add-page-section h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
}

.add-page-form {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 1rem;
}

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

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

.add-page-form label {
  font-size: 0.85rem;
  font-weight: 500;
}

.add-page-form input,
.add-page-form select,
.add-page-form textarea {
  padding: 0.625rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.add-page-form textarea {
  min-height: 80px;
  resize: vertical;
}

.builder-actions {
  margin-top: 1.5rem;
  text-align: center;
}

@media (max-width: 600px) {
  .add-page-form .form-row {
    grid-template-columns: 1fr;
  }
  
  .page-item-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}
