/* petition-creation-drawer.css - Petition Creation Drawer Styling */
/* Follows WeeBro Style Guide - Drawer Layout Pattern */

/* ===================================== */
/* PETITION DRAWER OVERLAY (Full-screen) */
/* ===================================== */
.petition-creation-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #FFFFFF; /* White page background */
  display: none; /* Hidden by default, shown via JS */
  flex-direction: column;
  overflow: hidden;
  z-index: 10002;
}

/* ===================================== */
/* CLOSE BUTTON (Fixed, doesn't scroll) */
/* ===================================== */
.petition-creation-drawer .close-button {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: #DCDCDC; /* Gainsboro */
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms ease-in-out;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10003;
  font-size: 24px;
  color: #696969; /* DimGray */
  font-weight: 700;
  line-height: 1;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  user-select: none;
}

.petition-creation-drawer .close-button:hover {
  background: #D3D3D3; /* LightGray */
}

/* ===================================== */
/* SCROLLABLE CONTENT AREA */
/* ===================================== */
.petition-creation-drawer .drawer-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: #FFFFFF; /* White page background */
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 16px 10px 0 10px; /* 10px breathing room */
  position: relative;
}

/* Wallpaper background pattern */
.petition-creation-drawer .drawer-content::before {
  content: '';
  position: fixed; /* Fixed to viewport - doesn't scroll away */
  inset: 0;
  background-image: url('/assets/patterns/hero-wallpaper.svg');
  background-repeat: repeat;
  background-size: 600px 600px;
  opacity: 0.10;
  pointer-events: none;
  z-index: 0;
}

/* ===================================== */
/* MASCOT IMAGE */
/* ===================================== */
.petition-creation-drawer .drawer-header-image {
  width: 100%;
  max-width: 588px; /* 490px x 1.2 = 588px (total 68% bigger than original) */
  height: 176px; /* 147px x 1.2 = 176px */
  margin: 0 auto -10px; /* Negative margin to pull tagline closer */
  object-fit: contain;
  display: block;
  position: relative;
  z-index: 1;
}

/* ===================================== */
/* INTRO QUESTION */
/* ===================================== */
.petition-creation-drawer .drawer-intro-question {
  font-size: 22px;
  font-weight: 800;
  color: #708090; /* SlateGray */
  margin: 0 0 30px;
  text-align: center;
  letter-spacing: -0.5px;
  padding: 0 16px;
  position: relative;
  z-index: 1;
}

/* ===================================== */
/* DRAWER SECTION (Grey container) */
/* ===================================== */
.petition-creation-drawer .drawer-section {
  background: #F5F5F5; /* Grey container */
  margin: 24px 20px; /* 20px for white space */
  border-radius: 12px;
  padding: 32px 28px;
  border: 1px solid #D3D3D3; /* LightGray */
  box-shadow: -4px 4px 0px 0px #808080; /* Grey shadow for petitions */
  position: relative;
  z-index: 1;
}

/* ===================================== */
/* SECTION TITLE */
/* ===================================== */
.petition-creation-drawer .drawer-section-title {
  font-size: 20px;
  font-weight: 800;
  color: #1f2937; /* Dark grey for readability */
  margin: 0 0 24px;
  text-align: center;
  letter-spacing: -0.5px;
}

/* ===================================== */
/* FORM STYLING */
/* ===================================== */
.petition-creation-drawer .form-group {
  margin-bottom: 20px;
}

.petition-creation-drawer .drawer-form-label {
  display: block;
  font-weight: 700;
  font-size: 0.875rem;
  color: #1f2937; /* Dark color for readability */
  margin-bottom: 8px;
  text-align: left;
}

.petition-creation-drawer .wb-form-input {
  width: 100%;
  min-height: 40px;
  padding: 0.5rem 0.75rem;
  background: #FFFFFF;
  border: 1.5px solid #D3D3D3;
  border-radius: 8px;
  font-size: 1rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  color: #1f2937; /* Dark grey for input text - distinct from placeholder */
  transition: border-color 150ms ease-in-out;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.petition-creation-drawer .wb-form-input::placeholder {
  color: #9ca3af; /* Light grey for placeholder - clearly different */
  opacity: 1;
}

.petition-creation-drawer .wb-form-input:focus {
  outline: none;
  border-color: #1E90FF; /* DodgerBlue */
  box-shadow: 0 0 0 3px rgba(30, 144, 255, 0.1);
}

/* iOS/Android Autofill Fix */
.petition-creation-drawer .wb-form-input:-webkit-autofill,
.petition-creation-drawer .wb-form-input:-webkit-autofill:hover,
.petition-creation-drawer .wb-form-input:-webkit-autofill:focus,
.petition-creation-drawer .wb-form-input:-webkit-autofill:active {
  -webkit-text-fill-color: #1f2937 !important;
  -webkit-box-shadow: 0 0 0 1000px #FFFFFF inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

.petition-creation-drawer textarea.wb-form-input {
  resize: vertical;
  min-height: 120px;
}

.petition-creation-drawer select.wb-form-input {
  cursor: pointer;
}

.petition-creation-drawer .form-group small {
  display: block;
  color: #6b7280;
  font-size: 12px;
  margin-top: 4px;
}

.petition-creation-drawer .char-count {
  text-align: right;
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

/* ===================================== */
/* LOCATION INPUT - DEVICE BUTTON */
/* ===================================== */
.petition-creation-drawer .device-location-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #5F9EA0 0%, #4A8082 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 150ms ease-in-out;
  box-shadow: 0 2px 4px rgba(95, 158, 160, 0.2);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.petition-creation-drawer .device-location-btn:active {
  transform: translateY(0);
  background: #4A8082;
}

.petition-creation-drawer .device-location-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.petition-creation-drawer .device-location-btn.success {
  background: linear-gradient(135deg, #4A8082 0%, #3A6567 100%);
}

/* ===================================== */
/* LOCATION INPUT - POSTCODE */
/* ===================================== */
.petition-creation-drawer .postcode-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.petition-creation-drawer .postcode-input-wrapper input {
  flex: 1;
  padding-right: 40px;
}

.petition-creation-drawer .postcode-status {
  position: absolute;
  right: 12px;
  font-size: 16px;
  pointer-events: none;
}

.petition-creation-drawer .postcode-status.validating {
  color: #667eea;
}

.petition-creation-drawer .postcode-status.valid {
  color: #10b981;
  animation: checkPop 0.3s ease;
}

.petition-creation-drawer .postcode-status.invalid {
  color: #ef4444;
  animation: shake 0.3s ease;
}

.petition-creation-drawer .postcode-status.error {
  color: #f59e0b;
}

@keyframes checkPop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.petition-creation-drawer .postcode-hint {
  display: block;
  color: #6b7280;
  font-size: 12px;
  margin-top: 6px;
}

.petition-creation-drawer .postcode-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  background: #e0e7ff;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  color: #4338ca;
  font-size: 14px;
  font-weight: 500;
  animation: slideDown 0.3s ease;
}

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

.petition-creation-drawer .postcode-preview i {
  color: #667eea;
  font-size: 16px;
}

/* ===================================== */
/* ACTION BUTTON (Submit) */
/* ===================================== */
.petition-creation-drawer .drawer-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  min-height: 40px;
  border: 2px solid #4682B4; /* SteelBlue */
  border-radius: 12px;
  background: #FFFFFF;
  color: #4682B4;
  font-size: 1rem;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  cursor: pointer;
  transition: all 150ms ease-in-out;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.petition-creation-drawer .drawer-action-btn:active {
  background: #4682B4;
  color: #FFFFFF;
}

.petition-creation-drawer .drawer-action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===================================== */
/* CELEBRATION SCREEN */
/* ===================================== */
.petition-creation-drawer .celebration-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #FFFFFF;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10005;
  padding: 40px 20px;
}

.petition-creation-drawer .celebration-screen.active {
  display: flex;
  animation: celebrationFadeIn 300ms ease-out;
}

.petition-creation-drawer .celebration-screen.exiting {
  animation: celebrationFadeOut 300ms ease-in;
}

@keyframes celebrationFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes celebrationFadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(1.05);
  }
}

.petition-creation-drawer .celebration-mascot {
  width: 90%;
  max-width: 675px;
  height: auto;
  margin-bottom: 30px;
}

.petition-creation-drawer .celebration-message {
  text-align: center;
  line-height: 1.4;
  max-width: 500px;
  padding: 0 20px;
}

.petition-creation-drawer .celebration-title {
  font-size: 29px;
  font-weight: 800;
  color: #000000;
  line-height: 1.2;
  margin-bottom: 16px;
}

.petition-creation-drawer .celebration-subtitle {
  font-size: 20px;
  font-weight: 800;
  color: #000000;
  line-height: 1.4;
}

/* ===================================== */
/* HELP BUTTON (Fixed top-right) */
/* ===================================== */
.petition-creation-drawer .help-button {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: #DCDCDC; /* Gainsboro */
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms ease-in-out;
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10003;
  font-size: 20px;
  color: #696969; /* DimGray */
  font-weight: 700;
  line-height: 1;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  user-select: none;
}

.petition-creation-drawer .help-button:hover {
  background: #D3D3D3; /* LightGray */
}

/* ===================================== */
/* FIELD HELP ICONS & TOASTS */
/* ===================================== */
.petition-creation-drawer .field-help-icon {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 20px;
  cursor: help;
  padding: 2px 4px;
  margin-left: 2px;
  transition: all 0.2s ease;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  position: relative;
  top: -1px;
}

.petition-creation-drawer .field-help-icon:hover {
  color: #667eea;
  background: rgba(102, 126, 234, 0.1);
  transform: scale(1.1);
}

.petition-creation-drawer .field-help-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: white;
  border: 1px solid #D3D3D3;
  border-radius: 12px;
  box-shadow: 0 0 0 4px #5F9EA0; /* CadetBlue border highlight wrapping full toast */
  width: calc((100% - 40px) * 0.8); /* 80% of container width */
  max-width: 528px; /* 80% of 660px */
  z-index: 10006; /* Above celebration screen */
  opacity: 0;
  transition: all 0.3s ease;
}

.petition-creation-drawer .field-help-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.petition-creation-drawer .field-help-toast-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: none;
}

.petition-creation-drawer .field-help-icon-emoji {
  font-size: 24px;
  flex-shrink: 0;
}

.petition-creation-drawer .field-help-toast-header strong {
  flex: 1;
  color: #111827;
  font-size: 16px;
}

.petition-creation-drawer .field-help-toast-body {
  padding: 0 16px 16px 16px;
  color: #374151;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;
}

/* Mobile responsive for field help */
@media (max-width: 768px) {
  .petition-creation-drawer .field-help-toast {
    width: calc((100% - 20px) * 0.8);
  }
}

/* ===================================== */
/* HELP MODAL */
/* ===================================== */
.petition-creation-drawer .help-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10004;
  padding: 20px;
}

.petition-creation-drawer .help-modal.open {
  display: flex;
}

.petition-creation-drawer .help-modal-content {
  background: #FFFFFF;
  border-radius: 12px;
  max-width: 320px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  border: 1px solid #D3D3D3;
  box-shadow: -4px 4px 0px 0px #5F9EA0, 0 20px 60px rgba(0, 0, 0, 0.3); /* Green shadow for nested */
  position: relative;
  padding: 32px;
}

.petition-creation-drawer .help-modal-title {
  font-size: 20px;
  font-weight: 800;
  color: #708090; /* Slate grey */
  margin: 0 0 20px 0;
  text-align: center;
}

.petition-creation-drawer .help-modal-body p {
  font-size: 15px;
  line-height: 1.6;
  color: #374151;
  margin: 0 0 16px 0;
}

.petition-creation-drawer .help-modal-body p:last-child {
  margin-bottom: 0;
}

.petition-creation-drawer .help-modal-body p strong {
  color: #1f2937;
  display: block;
  margin-bottom: 4px;
}

/* ===================================== */
/* RESPONSIVE - TABLET */
/* ===================================== */
@media (min-width: 768px) {
  .petition-creation-drawer {
    max-width: 600px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.3);
  }

  /* Allow text selection on desktop for better UX */
  .petition-creation-drawer .drawer-intro-question,
  .petition-creation-drawer .drawer-section-title,
  .petition-creation-drawer .drawer-form-label,
  .petition-creation-drawer .help-modal-body p {
    user-select: text;
    -webkit-user-select: text;
  }
}

/* ===================================== */
/* RESPONSIVE - DESKTOP */
/* ===================================== */
@media (min-width: 1024px) {
  .petition-creation-drawer {
    max-width: 700px;
  }
}
