/* ============================================
   Submit Page — March 8 Wish Form
   Romantic/elegant theme for International Women's Day
   ============================================ */

/* --- Design Tokens (shared) --- */
:root {
  --color-pink-primary: #ec407a;
  --color-pink-dark: #c2185b;
  --color-pink-darker: #880e4f;
  --color-pink-light: #f48fb1;
  --color-pink-lighter: #f8bbd0;
  --color-pink-bg: #fce4ec;
  --color-text-dark: #4a1942;
  --color-text-accent: #ad1457;
  --font-display: 'Great Vibes', cursive;
  --font-body: 'Dancing Script', cursive, sans-serif;
}

/* --- Reset & Base --- */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, var(--color-pink-bg) 0%, var(--color-pink-lighter) 40%, var(--color-pink-light) 100%);
  font-family: var(--font-body);
  color: var(--color-text-dark);
  padding: 1rem;
}

/* --- Container --- */
.container {
  width: 100%;
  max-width: 680px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  box-shadow: 0 8px 32px rgba(233, 30, 99, 0.15);
}

/* --- Title & Subtitle --- */
.page-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  text-align: center;
  color: var(--color-pink-dark);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.page-subtitle {
  text-align: center;
  font-size: 1.05rem;
  color: var(--color-text-accent);
  margin-bottom: 2rem;
  opacity: 0.85;
}

/* --- Form --- */
#wish-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

label {
  font-size: 1.1rem;
  font-weight: 700;
  color: #880e4f;
}

/* --- Inputs, Textarea & ContentEditable --- */
input[type="text"],
textarea,
.content-editable-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: 'Dancing Script', cursive, sans-serif;
  font-size: 1rem;
  color: #4a1942;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #f8bbd0;
  border-radius: 12px;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

input[type="text"]:focus,
textarea:focus,
.content-editable-input:focus {
  border-color: #ec407a;
  box-shadow: 0 0 0 3px rgba(236, 64, 122, 0.18);
}

input[type="text"]::placeholder,
textarea::placeholder {
  color: #e091b5;
}

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

/* Content Editable styling */
.content-editable-input {
  min-height: 120px;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.content-editable-input:empty:before {
  content: attr(data-placeholder);
  color: #e091b5;
  pointer-events: none;
  display: block;
  /* Ensures consistent height */
}

.content-editable-input svg {
  display: inline-block;
  vertical-align: middle;
  width: 1.25em;
  height: 1.25em;
  margin: 0 2px;
  fill: currentColor;
}

/* --- Message wrapper (textarea + emoji toggle) --- */
.message-wrapper {
  position: relative;
}

.message-wrapper textarea,
.message-wrapper .content-editable-input {
  padding-right: 3rem;
}

/* --- Emoji toggle --- */
.emoji-toggle {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 2.2rem;
  height: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.emoji-toggle:hover {
  background: rgba(236, 64, 122, 0.1);
  transform: scale(1.15);
}

.emoji-toggle.active {
  background: rgba(236, 64, 122, 0.2);
  color: #c2185b;
  border-radius: 8px;
}

/* --- SVG Picker container --- */
.svg-picker-container {
  margin-top: 0.5rem;
  padding: 0.5rem;
  border-radius: 12px;
  background: white;
  border: 1px solid #f8bbd0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.svg-picker-container[hidden] {
  display: none;
}

.svg-icon-btn {
  background: none;
  border: none;
  padding: 0.4rem;
  cursor: pointer;
  border-radius: 8px;
  color: #ec407a;
  transition: background 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}

.svg-icon-btn:hover {
  background: rgba(236, 64, 122, 0.1);
  transform: scale(1.1);
}

.svg-icon-btn svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* --- Field error --- */
.field-error {
  font-size: 0.85rem;
  color: #d32f2f;
  min-height: 1.1em;
  transition: opacity 0.2s ease;
}

/* --- Character count --- */
.message-meta {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.2rem;
}
.char-count {
  font-size: 0.8rem;
  color: #ad1457;
  opacity: 0.6;
}

/* --- Send another button --- */
.send-another-btn {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.5rem 1.2rem;
  font-family: 'Dancing Script', cursive, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #2e7d32;
  background: rgba(255,255,255,0.8);
  border: 2px solid #a5d6a7;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.send-another-btn:hover {
  background: rgba(200,230,201,0.9);
  transform: translateY(-1px);
}

/* --- Submit button --- */
.submit-btn {
  width: 100%;
  padding: 0.85rem;
  font-family: 'Dancing Script', cursive, sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #ec407a, #c2185b);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.25s ease;
  box-shadow: 0 4px 14px rgba(194, 24, 91, 0.3);
  margin-top: 0.5rem;
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(194, 24, 91, 0.4);
}

.submit-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(194, 24, 91, 0.25);
}

/* Loading / disabled state */
.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 2px 8px rgba(194, 24, 91, 0.15);
}

/* --- Notification messages --- */
.message {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  font-size: 1rem;
  text-align: center;
  animation: fadeSlideIn 0.35s ease;
}

.message[hidden] {
  display: none;
}

.success-message {
  background: rgba(200, 230, 201, 0.9);
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.error-message {
  background: rgba(255, 205, 210, 0.9);
  color: #c62828;
  border: 1px solid #ef9a9a;
}

/* --- Animations --- */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Responsive: 320px+ --- */
@media (max-width: 520px) {
  .container {
    padding: 1.75rem 1.25rem;
    border-radius: 16px;
  }

  .page-title {
    font-size: 2rem;
  }

  .page-subtitle {
    font-size: 0.95rem;
  }
}

@media (max-width: 360px) {
  body {
    padding: 0.5rem;
  }

  .container {
    padding: 1.5rem 1rem;
  }

  .page-title {
    font-size: 1.75rem;
  }
}

/* --- Wish Preview --- */
.wish-preview {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 12px;
  background: rgba(136,14,79,0.08);
  border: 1px dashed #f48fb1;
}
.wish-preview[hidden] { display: none; }
.wish-preview-label {
  font-size: 0.8rem;
  color: #ad1457;
  opacity: 0.7;
  margin-bottom: 0.4rem;
}
.wish-preview-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.wish-preview-sender {
  font-family: 'Great Vibes', cursive;
  font-size: 1.3rem;
  color: #c2185b;
}
.wish-preview-message {
  font-family: 'Dancing Script', cursive;
  font-size: 0.95rem;
  color: #4a1942;
  line-height: 1.4;
}
.wish-preview-message svg {
  display: inline-block;
  vertical-align: middle;
  width: 1.1em;
  height: 1.1em;
  fill: #ec407a;
}

/* Hide form when success shown */
#wish-form[hidden] { display: none; }
