/* css/ask.css — shared styles for /ask creator and /q/:slug respondent */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }

/* Admin bar */
#admin-bar {
  background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  padding: 5px 12px; display: flex; gap: 14px; z-index: 100;
}
#admin-bar a {
  color: #fff; text-decoration: none; font-size: 0.8rem; font-weight: 600; opacity: 0.85;
}
#admin-bar a:hover { opacity: 1; text-decoration: underline; }

/* Header */
.ask-header { padding: 10px 16px; background: #fff; border-bottom: 1px solid #e2e8f0; z-index: 10; }
.ask-header .question { font-size: 1.15rem; font-weight: 700; color: #1e293b; line-height: 1.3; }
.ask-header .meta { font-size: 0.8rem; color: #94a3b8; margin-top: 2px; }
.ask-header input { width: 100%; border: none; border-bottom: 1px dashed #cbd5e1; font-size: 1.15rem; font-weight: 700; color: #1e293b; padding: 4px 0; outline: none; }
.ask-header input:focus { border-bottom-color: #3b82f6; border-bottom-style: solid; }
.ask-header input::placeholder { color: #94a3b8; font-weight: 400; }

/* Map */
#map { flex: 1; position: relative; }
#map canvas, #map .mapboxgl-canvas { cursor: crosshair !important; }

/* Bottom form — max 50% of viewport, scrollable */
.ask-form {
  padding: 12px 16px; background: #fff; border-top: 1px solid #e2e8f0;
  z-index: 10; display: none;
  max-height: 50vh; overflow-y: auto;
}
.ask-form.show { display: block; }
.ask-form input[type="text"], .ask-form textarea { width: 100%; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 12px; font-size: 0.95rem; margin-bottom: 8px; font-family: inherit; resize: none; }
.ask-form .actions { display: flex; gap: 8px; }
.ask-form .actions button { flex: 1; padding: 10px; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 0.85rem; }
.ask-form .btn-submit { background: #3b82f6; color: #fff; }
.ask-form .btn-cancel { background: #f1f5f9; color: #64748b; }
.ask-form .btn-photo { background: #f1f5f9; color: #64748b; }
.ask-form .photo-preview { max-height: 80px; border-radius: 6px; margin-bottom: 8px; }

/* Toast — positioned inside the map container */
.ask-toast {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(30,42,56,0.9); color: #fff; padding: 8px 16px;
  border-radius: 8px; font-size: 0.82rem; font-weight: 500;
  box-shadow: 0 2px 8px rgba(0,0,0,.2); z-index: 15;
  pointer-events: none; opacity: 1; transition: opacity 0.5s;
}

/* Share overlay */
.share-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 100; display: none; align-items: center; justify-content: center; }
.share-overlay.show { display: flex; }
.share-modal { background: #fff; border-radius: 16px; padding: 24px; width: 90%; max-width: 400px; text-align: center; }
.share-modal h3 { margin-bottom: 12px; color: #1e293b; }
.share-modal .share-url { width: 100%; background: #f8fafc; border: 1px solid #e2e8f0; color: #1e293b; border-radius: 8px; padding: 10px 12px; font-size: 0.85rem; font-family: monospace; margin-bottom: 8px; text-align: center; }
.share-modal .embed-code { width: 100%; background: #f8fafc; border: 1px solid #e2e8f0; color: #64748b; border-radius: 8px; padding: 8px 10px; font-size: 0.75rem; font-family: monospace; margin-bottom: 12px; text-align: left; resize: none; height: 50px; }
.share-modal .share-buttons { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.share-modal .share-buttons button { width: 44px; height: 44px; border-radius: 50%; border: none; font-size: 1.1rem; cursor: pointer; color: #fff; }
.share-modal .btn-copy { background: #3b82f6; width: 100%; padding: 10px; border: none; border-radius: 8px; color: #fff; font-weight: 600; cursor: pointer; font-size: 0.9rem; }
.share-modal .btn-close-share { background: none; border: none; color: #94a3b8; margin-top: 8px; cursor: pointer; font-size: 0.85rem; }

/* Footer */
.ask-footer { padding: 6px 16px; background: #f8fafc; border-top: 1px solid #e2e8f0; text-align: center; font-size: 0.75rem; color: #94a3b8; }
.ask-footer a { color: #3b82f6; text-decoration: none; }

/* Popup close button — white circle with × */
.mapboxgl-popup-close-button {
  width: 28px !important; height: 28px !important;
  background: #fff !important; border: 1px solid #dee2e6 !important;
  border-radius: 50% !important; display: flex !important;
  align-items: center !important; justify-content: center !important;
  font-size: 1rem !important; color: #666 !important; line-height: 1 !important;
  position: absolute !important; top: -10px !important; right: -10px !important;
  box-shadow: 0 1px 4px rgba(0,0,0,.15) !important;
  cursor: pointer !important; padding: 0 !important;
}

/* Suggestion chips */
.ask-suggestions {
  padding: 6px 16px; background: #fff; border-bottom: 1px solid #e2e8f0;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; z-index: 10;
}
.ask-suggest-label { font-size: 0.75rem; color: #94a3b8; font-weight: 500; }
.ask-chip {
  background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 16px;
  padding: 4px 12px; font-size: 0.78rem; color: #475569; cursor: pointer;
  white-space: nowrap; transition: all 0.15s;
}
.ask-chip:hover { background: #e0e7ff; border-color: #93c5fd; color: #1e40af; }

/* Welcome overlay */
.wm-welcome { position: fixed; inset: 0; background: rgba(15,23,42,0.92); z-index: 100; display: flex; align-items: center; justify-content: center; }
.wm-welcome-card { background: #fff; border-radius: 20px; padding: 36px 32px; max-width: 360px; width: 90%; text-align: center; box-shadow: 0 8px 40px rgba(0,0,0,.2); }
.wm-welcome-logo { height: 48px; margin-bottom: 16px; }
.wm-welcome-card h2 { font-size: 1.4rem; margin-bottom: 8px; color: #1e293b; }
.wm-welcome-card p { color: #64748b; font-size: 0.9rem; line-height: 1.5; margin-bottom: 20px; }
.wm-welcome-card p strong { color: #334155; }
.wm-welcome-options { display: flex; flex-direction: column; gap: 8px; }
.wm-opt {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border: 2px solid #e2e8f0; border-radius: 10px; background: #f8fafc;
  cursor: pointer; text-decoration: none; color: #334155; text-align: left;
  transition: all 0.15s; font-family: inherit;
}
.wm-opt:hover { border-color: #93c5fd; background: #eff6ff; }
.wm-opt.primary { border-color: #3b82f6; background: #3b82f6; color: #fff; }
.wm-opt.primary:hover { background: #2563eb; }
.wm-opt i { font-size: 1.2rem; width: 24px; text-align: center; flex-shrink: 0; }
.wm-opt.primary i { color: #fff; }
.wm-opt:not(.primary) i { color: #3b82f6; }
.wm-opt-title { font-size: 0.92rem; font-weight: 700; display: block; }
.wm-opt-desc { font-size: 0.75rem; display: block; opacity: 0.7; }

/* Category bar (persistent, above map) */
.cat-bar {
  padding: 8px 12px; background: #fff; border-bottom: 1px solid #e2e8f0;
  display: flex; gap: 6px; z-index: 10; align-items: center;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat-bar-hint { font-size: 0.78rem; color: #94a3b8; font-weight: 500; margin-right: 2px; }

/* Category selector (in form or bar) */
.cat-selector { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cat-sel-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px; border: 1px solid #e2e8f0; border-radius: 20px;
  background: #fff; font-size: 0.82rem; font-weight: 500;
  cursor: pointer; color: #475569; transition: all 0.15s;
  white-space: nowrap; flex-shrink: 0;
}
.cat-sel-btn:hover { background: #f1f5f9; }
.cat-sel-btn.active { background: #1e293b; color: #fff; border-color: #1e293b; }
.cat-sel-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cat-sel-btn svg { flex-shrink: 0; }

/* Survey fields in respond form */
.survey-field { margin-bottom: 10px; }
.field-label { display: block; font-size: 0.78rem; font-weight: 600; color: #64748b; margin-bottom: 3px; }
.survey-input { width: 100%; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 12px; font-size: 0.95rem; font-family: inherit; }
select.survey-input { appearance: auto; }
textarea.survey-input { resize: none; }

.photo-field { display: flex; align-items: center; gap: 8px; }
.btn-photo-field { background: #f1f5f9; color: #64748b; border: 1px dashed #cbd5e1; border-radius: 8px; padding: 8px 14px; font-size: 0.85rem; cursor: pointer; white-space: nowrap; }
.btn-photo-field:hover { background: #e2e8f0; }
.photo-field .photo-preview { max-height: 60px; border-radius: 6px; }

.star-rating { display: flex; gap: 4px; }
.star-rating .star { font-size: 1.4rem; color: #cbd5e1; cursor: pointer; transition: color 0.1s; }
.star-rating .star:hover, .star-rating .star.active { color: #f59e0b; }

.check-radio-group {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px;
}
/* "Other" option spans full width */
.check-radio-group .other-option { grid-column: 1 / -1; }
/* Single column on very small screens */
@media (max-width: 360px) { .check-radio-group { grid-template-columns: 1fr; } }
.check-radio-option {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.88rem; color: #334155; cursor: pointer; padding: 4px 0;
}
.check-radio-option input[type="checkbox"],
.check-radio-option input[type="radio"] { margin: 0; accent-color: #3b82f6; }
.other-text-input {
  border: 1px solid #e2e8f0; border-radius: 6px; padding: 4px 8px;
  font-size: 0.85rem; width: 140px; margin-left: 2px;
}

/* Line drawing */
.line-vertex {
  width: 10px; height: 10px; border-radius: 50%;
  background: #22c55e; border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.cat-sel-dot {
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}

/* Desktop: form as a floating card instead of full-width bottom bar */
@media (min-width: 768px) {
  .ask-form {
    position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
    width: 500px; max-width: 90vw;
    border-radius: 12px; border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    max-height: 60vh;
  }
  .cat-bar {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
    z-index: 20; background: rgba(255,255,255,0.95); border-radius: 20px;
    padding: 6px 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    border: none;
  }
}

/* Thank you celebration */
.thank-you-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.4);
  animation: ty-fade-in 0.2s ease;
}
@keyframes ty-fade-in { from { opacity: 0; } to { opacity: 1; } }

.thank-you-card {
  background: #fff; border-radius: 16px; padding: 28px 32px;
  text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.15);
  animation: ty-pop 0.3s ease;
  max-width: 300px; width: 85%;
}
@keyframes ty-pop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.thank-you-check { font-size: 2.2rem; margin-bottom: 8px; }
.thank-you-title { font-size: 1.2rem; font-weight: 700; color: #1e293b; margin-bottom: 4px; }
.thank-you-number { font-size: 1rem; font-weight: 600; color: #3b82f6; margin-bottom: 6px; }
.thank-you-milestone { font-size: 0.85rem; color: #22c55e; font-weight: 600; margin-bottom: 4px; }
.thank-you-history { font-size: 0.78rem; color: #94a3b8; margin-top: 8px; }

/* Language switcher */
.lang-switcher {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  display: flex; gap: 2px;
}
.lang-btn {
  background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 4px;
  padding: 2px 8px; font-size: 0.72rem; font-weight: 700; cursor: pointer;
  color: #64748b;
}
.lang-btn.active { background: #1e293b; color: #fff; border-color: #1e293b; }
.lang-btn:hover:not(.active) { background: #e2e8f0; }

/* Make header relative for the language switcher positioning */
.ask-header { position: relative; }

/* Embed mode */
body.embed .ask-header { display: none; }
body.embed .ask-footer { display: none; }
