
/* ===================================================================================
   📌 Message Generator Stylesheet
   Author: [Your Name]
   Description: Styles for the Message Generator web app, including input, output,
   WhatsApp integration, bot configuration, and debugging UI.
   =================================================================================== */

/* ------------------------------ Global Reset & Base Styles ------------------------------ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text);
  /* use --bg variable so dark mode can set true black */
  background: var(--bg);
  min-height: 100vh;
  padding: 20px;
  transition: background 300ms ease, color 300ms ease;
}

/* ------------------------------ Theme Variables ------------------------------ */
:root {
  --bg: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
  --panel: #ffffff;
  --muted: #718096;
  --text: #1f2937;
  --primary-start: #667eea;
  --primary-end: #764ba2;
  --success: #10b981;
  --danger: #ef4444;
  --border: rgba(16, 24, 40, 0.06);
  --card-bg: rgba(255, 255, 255, 0.02);
  --input-border: rgba(226, 232, 240, 0.9);
  --placeholder: #9aa4bf;
  --example-bg: #edf2f7;
  --example-hover-bg: #667eea;
  --footer-border: rgba(226, 232, 240, 0.6);
  --debug-bg: #111827;
  --primary-glow: rgba(102, 126, 234, 0.12);
}

body.dark {
  /* Use true black background for dark mode as requested */
  --bg: #000000;
  --panel: #071019; /* slightly lighter than pitch black for panels */
  --muted: #94a3b8;
  --text: #e6eef8;
  --primary-start: #4f46e5;
  --primary-end: #06b6d4;
  --success: #34d399;
  --danger: #f87171;
  --border: rgba(255, 255, 255, 0.06);
  --card-bg: rgba(255, 255, 255, 0.02);
  --input-border: rgba(255, 255, 255, 0.06);
  --placeholder: #6b7280;
  --example-bg: rgba(255, 255, 255, 0.02);
  --example-hover-bg: #334155;
  --footer-border: rgba(255, 255, 255, 0.06);
  --debug-bg: #0b1220;
  --primary-glow: rgba(79, 70, 229, 0.14);
}

/* ------------------------------ Main Container ------------------------------ */
.container {
  max-width: 720px;
  margin: 0 auto;
  background: var(--panel);
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  padding: 30px;
  animation: fadeIn 0.5s ease-in-out;
  transition: background 260ms ease, color 260ms ease, box-shadow 260ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------ Headings & Text ------------------------------ */
h1 {
  text-align: center;
  color: var(--text);
  font-size: 2.2rem;
  margin-bottom: 6px;
  transition: color 200ms ease;
}

.subtitle {
  margin-bottom: 20px !important;
  text-align: left;
  color: var(--muted);
  font-size: 0.98rem;
  margin-bottom: 18px;
}

/* ------------------------------ Header & Input Section ------------------------------ */
.input-section { margin-bottom: 30px; }

.header-row {
  display: flex;
  align-items: center;
  justify-content:space-between;
  position: relative;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.header-row h1 {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  position: static;
    transform: none;
    text-align: center;
}

.header-row p {
  margin-top: 4px;
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 180ms ease;
}

.theme-toggle:hover { transform: translateY(-2px); }

.prompt-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.prompt-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.04);
  animation: popIn 360ms ease both;
  transition: all 0.2s ease;
}

.prompt-card:focus-within {
  transform: translateY(-6px);
  box-shadow: 0 14px 36px var(--primary-glow);
}

.prompt-card input[type="text"] {
  flex: 1 1 auto;
  margin-bottom: 0;
  background: transparent;
  border: none;
  padding: 8px 10px;
  color: var(--text);
  font-size: 1rem;
}

.prompt-card input::placeholder { color: var(--placeholder); }

.prompt-card button {
  flex: 0 0 auto;
  padding: 10px 16px;
  border-radius: 10px;
}

/* ------------------------------ Buttons ------------------------------ */
button {
  background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.14);
  filter: saturate(1.05);
}

button:active { transform: translateY(0); }
button:focus { outline: 3px solid rgba(102, 126, 234, 0.18); outline-offset: 2px; }

#generate-btn[disabled],
.action-buttons button[disabled],
.config-btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Accent buttons */
#copy-btn { background: linear-gradient(135deg, #34d399 0%, #059669 100%); }
#regenerate-btn { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
#whatsapp-btn { background: linear-gradient(135deg, #25D366 0%, #128C7E 100%); }

#whatsapp-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ------------------------------ Input Fields ------------------------------ */
input[type="text"], input[type="tel"], textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--input-border);
  border-radius: 8px;
  font-size: 1em;
  background: transparent;
  color: var(--text);
  transition: all 0.22s ease;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-start);
  box-shadow: 0 0 0 6px var(--primary-glow);
}

/* ------------------------------ Output Section ------------------------------ */
.output-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 30px;
  border: 1px solid var(--border);
  animation: revealUp 300ms ease both;
}

.output-section h3 { color: var(--text); margin-bottom: 15px; }

.message-display {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  font-family: 'Courier New', monospace;
  color: var(--text);
  white-space: pre-wrap;
}

/* ------------------------------ WhatsApp Section ------------------------------ */
.whatsapp-section {
  margin: 20px 0;
  padding: 15px;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.04), rgba(16, 185, 129, 0.02));
  border: 1px solid rgba(16, 185, 129, 0.12);
  border-radius: 8px;
}

.whatsapp-section label {
  color: #166534;
  margin-bottom: 8px;
  font-weight: 600;
}

.number-help {
  color: var(--muted);
  font-size: 0.85em;
  font-style: italic;
  display: block;
}

/* ------------------------------ Example Prompts ------------------------------ */
.examples-section h3 {
  color: var(--text);
  margin-bottom: 15px;
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.example-tag {
  background: var(--example-bg);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 220ms ease;
  box-shadow: 0 4px 12px rgba(16, 24, 40, 0.04);
  animation: float 6s ease-in-out infinite;
}

.example-tag:hover {
  background: var(--example-hover-bg);
  color: white;
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.12);
}

@keyframes float {
  0% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

/* ------------------------------ Footer ------------------------------ */
.footer {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding-top: 20px;
  border-top: 1px solid var(--footer-border);
}

/* ------------------------------ Debug Panel ------------------------------ */
.debug-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
}

.debug-output {
  margin-top: 15px;
  background: var(--debug-bg);
  border-radius: 6px;
  padding: 15px;
  max-height: 300px;
  overflow-y: auto;
}

/* ------------------------------ Animations ------------------------------ */
@keyframes popIn {
  from { opacity: 0; transform: translateY(8px) scale(0.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes revealUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.copied {
  background: #48bb78 !important;
  animation: pulse 0.6s ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* ------------------------------ Responsive Design ------------------------------ */
@media (max-width: 768px) {
  .container { padding: 20px; margin: 10px; }
  .action-buttons { flex-direction: column; }
  .config-btn { min-width: auto; }
}
