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

:root {
  --teal: #00BFA5;
  --teal-dark: #00897B;
  --bg: #FAFAFA;
  --card-bg: #FFFFFF;
  --light-teal: #F0FAF8;
  --light-gray: #F5F5F5;
  --text-primary: #333333;
  --text-secondary: #999999;
  --text-hint: #AAAAAA;
  --text-placeholder: #BBBBBB;
  --divider: #F0F0F0;
  --red: #FF3B30;
  --card-radius: 16px;
  --btn-radius: 14px;
  --input-radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1A1A1A;
    --card-bg: #2C2C2C;
    --text-primary: #FFFFFF;
    --text-secondary: #AAAAAA;
    --divider: #3C3C3C;
    --light-teal: #1A2E2A;
    --light-gray: #3C3C3C;
  }
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI',
    Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 30px 16px 60px;
}

.container {
  width: 100%;
  max-width: 500px;
  direction: rtl;
}

/* ── Profile section ──────────────────────────────────────────────────────── */

.profile-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 20px;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 12px;
}

#display-name {
  font-size: 20px;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.profile-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Message form ────────────────────────────────────────────────────────── */

.form-section {
  margin-bottom: 16px;
}

.textarea-wrapper {
  background: var(--card-bg);
  border-radius: var(--input-radius);
  border: 2px solid var(--divider);
  transition: border-color 0.15s ease;
  overflow: hidden;
}

.textarea-wrapper:focus-within {
  border-color: var(--teal);
}

textarea {
  width: 100%;
  padding: 14px 16px;
  min-height: 120px;
  border: none;
  outline: none;
  font-size: 15px;
  resize: none;
  font-family: inherit;
  direction: rtl;
  background: transparent;
  color: var(--text-primary);
  line-height: 1.6;
}

textarea::placeholder {
  color: var(--text-placeholder);
}

.textarea-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px;
  margin-top: 6px;
  margin-bottom: 16px;
}

.anonymous-label {
  font-size: 11px;
  color: #CCCCCC;
}

#char-count {
  font-size: 11px;
  color: #CCCCCC;
  direction: ltr;
}

/* ── Send button ─────────────────────────────────────────────────────────── */

.btn-send {
  display: block;
  width: 100%;
  padding: 16px;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: var(--btn-radius);
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn-send:hover {
  background: var(--teal-dark);
}

.btn-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Status message ─────────────────────────────────────────────────────── */

#status-message {
  display: none;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  text-align: center;
  animation: fadeIn 0.3s ease;
}

#status-message.success {
  background: #E8F5E9;
  color: #2E7D32;
}

#status-message.error {
  background: #FFEBEE;
  color: #C62828;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Divider "أو" ────────────────────────────────────────────────────────── */

.divider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0;
}

.divider-row::before,
.divider-row::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--divider);
}

.divider-text {
  font-size: 12px;
  color: #CCCCCC;
  white-space: nowrap;
}

/* ── Download CTA card ───────────────────────────────────────────────────── */

.download-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  border: 1px solid var(--divider);
  padding: 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  margin-bottom: 24px;
}

.download-icon {
  width: 48px;
  height: 48px;
  background: var(--light-teal);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.download-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--teal);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.download-card h3 {
  font-size: 15px;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.download-card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.store-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-store {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #000;
  color: #fff;
  border-radius: 10px;
  font-size: 12px;
  font-weight: bold;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s ease;
}

.btn-store:hover {
  opacity: 0.85;
}

.btn-store svg {
  width: 16px;
  height: 16px;
  fill: #fff;
  flex-shrink: 0;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */

.footer {
  font-size: 11px;
  color: #DDDDDD;
  text-align: center;
}

/* ── Not found / loading states ─────────────────────────────────────────── */

#loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: 15px;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--divider);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

#not-found {
  text-align: center;
  padding: 60px 20px;
}

#not-found h2 {
  font-size: 20px;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 8px;
}

#not-found p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.btn-home {
  display: inline-block;
  padding: 12px 24px;
  background: var(--teal);
  color: #fff;
  border-radius: var(--btn-radius);
  font-size: 14px;
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
}

/* ── Success state ───────────────────────────────────────────────────────── */

.success-state {
  text-align: center;
  padding: 32px 0;
  animation: fadeIn 0.3s ease;
}

.success-checkmark {
  font-size: 48px;
  margin-bottom: 12px;
}

.success-state h3 {
  font-size: 18px;
  font-weight: bold;
  color: #2E7D32;
  margin-bottom: 8px;
}

.success-state p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.btn-again {
  display: inline-block;
  padding: 12px 28px;
  background: var(--teal);
  color: #fff;
  border-radius: var(--btn-radius);
  font-size: 14px;
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 400px) {
  body { padding: 20px 12px 40px; }
}
