/* ============================================================================
   MOMENTS MVP - Mobile-First Stylesheet
   ============================================================================ */

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

:root {
  --primary: #FF6B8A;
  --primary-dark: #E5507A;
  --primary-light: #FFB6C9;
  --secondary: #FFD3DC;
  --accent: #FFA8BB;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --gray-50: #FFF5F7;
  --gray-100: #FFE8ED;
  --gray-200: #FDD5DD;
  --gray-300: #FDB8C7;
  --gray-600: #6B5563;
  --gray-800: #3F2937;
  --gray-900: #211827;
  --white: #ffffff;
  --shadow: 0 2px 8px rgba(255, 107, 138, 0.15);
  --shadow-lg: 0 10px 30px rgba(255, 107, 138, 0.25);
  --gradient-primary: linear-gradient(135deg, #FF6B8A 0%, #FFB6C9 100%);
  --gradient-secondary: linear-gradient(135deg, #FFD3DC 0%, #FFA8BB 100%);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  position: fixed;
  width: 100%;
  height: 100%;
}

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================================================================
   Header
   ============================================================================ */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--gradient-primary);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  min-height: 60px;
  flex-wrap: wrap;
}

.logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--white);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

/* Search Container */
.search-container {
  position: relative;
  flex: 1;
  max-width: 400px;
  min-width: 200px;
}

.search-input {
  width: 100%;
  padding: 8px 36px 8px 12px;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--gray-900);
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.search-input::placeholder {
  color: var(--gray-600);
}

.clear-search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  color: var(--gray-600);
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.clear-search-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--gray-900);
}

.clear-search-btn.hidden {
  display: none;
}

.chat-header-info {
  flex: 1;
  text-align: center;
}

.chat-header-info h2 {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 2px;
  color: var(--white);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.participant-badge {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
}

/* ============================================================================
   Buttons
   ============================================================================ */

button {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--white);
  color: var(--primary);
  padding: 11px 24px;
  border-radius: 25px;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 4px 12px rgba(255, 107, 138, 0.3);
  letter-spacing: 0.3px;
}

.btn-primary:active {
  background: var(--gray-50);
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(255, 107, 138, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary);
  padding: 8px 14px;
  border-radius: 20px;
  border: none;
  font-weight: 600;
  font-size: 13px;
  margin-right: 8px;
  box-shadow: 0 2px 8px rgba(255, 107, 138, 0.15);
}

.btn-secondary:active {
  background: rgba(255, 107, 138, 0.1);
  transform: scale(0.96);
}

.btn-back {
  background: transparent;
  color: var(--white);
  padding: 8px 12px;
  font-weight: 700;
  font-size: 16px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-flag, .btn-icon {
  background: rgba(255, 255, 255, 0.2);
  font-size: 18px;
  padding: 8px 12px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.btn-flag:active, .btn-icon:active {
  background: rgba(255, 255, 255, 0.3);
}

.btn-send {
  background: var(--gradient-primary);
  color: var(--white);
  padding: 11px 20px;
  border-radius: 20px;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(255, 107, 138, 0.3);
}

.btn-send:active {
  transform: scale(0.96);
  box-shadow: 0 2px 6px rgba(255, 107, 138, 0.4);
}

.close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--gray-50);
  font-size: 26px;
  color: var(--primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-btn:hover,
.close-btn:active {
  background: var(--primary-light);
  transform: rotate(90deg);
}

/* ============================================================================
   Map
   ============================================================================ */

#map {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
}

.mapboxgl-popup-content {
  padding: 16px;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--primary-light);
}

.mapboxgl-popup-content h3 {
  font-size: 17px;
  margin-bottom: 10px;
  color: var(--primary);
  font-weight: 800;
}

.mapboxgl-popup-content p {
  font-size: 14px;
  color: var(--gray-700);
  margin-bottom: 10px;
  font-weight: 500;
}

.mapboxgl-popup-content .btn-primary {
  width: 100%;
  padding: 10px;
  font-size: 14px;
  margin-top: 4px;
}

.mapboxgl-popup-close-button {
  color: var(--primary);
  font-size: 20px;
  font-weight: 700;
}

/* ============================================================================
   Modals
   ============================================================================ */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--white);
  border-radius: 20px;
  padding: 28px;
  max-width: 400px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-content h2 {
  font-size: 24px;
  margin-bottom: 18px;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: -0.5px;
}

#createModal {
  background: rgba(0, 0, 0, 0.3);
  pointer-events: none;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  padding-top: 80px;
}

#createModal .modal-content {
  pointer-events: auto;
  max-height: 50vh;
  border-radius: 20px;
  margin: 0;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-content p {
  color: var(--gray-600);
  margin-bottom: 16px;
}

/* ============================================================================
   Forms
   ============================================================================ */

form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 107, 138, 0.1);
  transform: translateY(-1px);
}

label {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 4px;
}

.help-text {
  font-size: 14px;
  color: var(--primary);
  margin: -4px 0 8px;
  font-weight: 600;
  text-align: center;
  background: var(--gray-50);
  padding: 8px;
  border-radius: 8px;
}

.location-display {
  padding: 14px 16px;
  background: var(--gray-50);
  border-radius: 12px;
  font-size: 14px;
  color: var(--gray-800);
  border: 2px dashed var(--gray-200);
  font-weight: 500;
  text-align: center;
  transition: all 0.3s ease;
}

.location-display.selected {
  background: var(--primary-light);
  border-color: var(--primary);
  border-style: solid;
  color: var(--primary-dark);
  font-weight: 700;
}

#map.selection-mode {
  cursor: crosshair;
}

#map.selection-mode::after {
  content: '📍 Tap anywhere on the map';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 107, 138, 0.95);
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  animation: pulse 2s infinite;
  z-index: 1;
}

.checkbox-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
  background: var(--gray-50);
  border-radius: 12px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 14px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.checkbox-group label:hover {
  background: var(--white);
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.language-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Photo Upload */
.photo-upload-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.photo-upload-container {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto;
  cursor: pointer;
  border-radius: 50%;
  overflow: hidden;
  border: 3px dashed var(--gray-200);
  transition: all 0.3s ease;
}

.photo-upload-container:hover {
  border-color: var(--primary);
  transform: scale(1.02);
}

.photo-upload-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: var(--gray-50);
  color: var(--gray-600);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.photo-upload-container:hover .photo-upload-prompt {
  background: var(--primary-light);
  color: var(--primary);
}

.upload-icon {
  font-size: 32px;
  margin-bottom: 4px;
}

.photo-preview {
  width: 100%;
  height: 100%;
  position: relative;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-preview.hidden {
  display: none;
}

.upload-help-text {
  font-size: 12px;
  color: var(--gray-600);
  text-align: center;
  margin: 4px 0 0 0;
}

/* Moment Preview Photo */
.moment-preview-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.moment-photo-container {
  width: 100%;
  max-width: 300px;
  height: 200px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  border: 2px dashed var(--gray-200);
  cursor: pointer;
  transition: all 0.3s ease;
}

.moment-photo-container:hover {
  border-color: var(--primary);
}

.moment-photo-preview {
  width: 100%;
  height: 100%;
}

.moment-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.moment-photo-preview.hidden {
  display: none;
}

.moment-photo-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: var(--gray-50);
  color: var(--gray-600);
}

/* Avatar with photo support */
.message-avatar img,
.participant-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Capacity slider */
.capacity-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.capacity-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
}

.capacity-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

.capacity-slider {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--primary-light), var(--primary));
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.capacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  background: var(--primary);
  border: 3px solid var(--white);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 107, 138, 0.4);
  transition: all 0.2s ease;
}

.capacity-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(255, 107, 138, 0.6);
}

.capacity-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: var(--primary);
  border: 3px solid var(--white);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 107, 138, 0.4);
  transition: all 0.2s ease;
}

.capacity-slider::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(255, 107, 138, 0.6);
}

.capacity-indicator {
  text-align: center;
  font-size: 13px;
  color: var(--gray-600);
  margin-top: 4px;
}

.capacity-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 12px;
  margin-left: 8px;
}

.capacity-badge.small {
  background: var(--success);
  color: var(--white);
}

.capacity-badge.medium {
  background: var(--warning);
  color: var(--white);
}

.capacity-badge.large {
  background: var(--danger);
  color: var(--white);
}

.auth-message {
  font-size: 14px;
  text-align: center;
  color: var(--success);
  padding: 10px;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 10px;
  font-weight: 600;
  margin-top: 8px;
}

.otp-instruction {
  text-align: center;
  color: var(--text);
  margin-bottom: 16px;
  font-size: 14px;
}

.otp-input {
  font-size: 28px;
  text-align: center;
  letter-spacing: 8px;
  font-weight: 700;
  padding: 16px;
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
}

.otp-input::placeholder {
  letter-spacing: 8px;
  color: var(--text-light);
  opacity: 0.5;
}

#otpStep .btn-secondary {
  margin-top: 8px;
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

#otpStep .btn-secondary:hover {
  background: rgba(255, 107, 138, 0.1);
}

/* ============================================================================
   Moment Detail Page
   ============================================================================ */

.moment-detail {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.preview-photos-section {
  margin-bottom: 20px;
}

.preview-photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.preview-photo-item {
  position: relative;
  width: 100%;
  height: 200px;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.preview-photo-item:hover {
  transform: scale(1.02);
}

.preview-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-photos-section.hidden {
  display: none;
}

.moment-header {
  margin-bottom: 20px;
}

.moment-header h2 {
  font-size: 26px;
  margin-bottom: 14px;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.3;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-block;
  padding: 6px 14px;
  background: var(--secondary);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(255, 107, 138, 0.15);
}

.badge.international {
  background: linear-gradient(135deg, #FFD3DC 0%, #FFA8BB 100%);
  color: var(--primary-dark);
}

.badge.english {
  background: linear-gradient(135deg, #FFB6C9 0%, #FF6B8A 100%);
  color: var(--white);
}

.moment-info {
  background: var(--white);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 12px rgba(255, 107, 138, 0.08);
  border: 1px solid var(--gray-100);
}

.info-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  font-size: 15px;
  color: var(--gray-800);
  font-weight: 500;
}

.info-row .icon {
  font-size: 20px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
  border-radius: 10px;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

/* SOS Button */
.sos-button {
  width: 100%;
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  color: var(--white);
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
  transition: all 0.3s ease;
  user-select: none;
  -webkit-user-select: none;
}

.sos-button:active {
  transform: scale(0.95);
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.5);
}

.sos-button.pressing {
  animation: sosPressed 2s ease;
  background: linear-gradient(135deg, #991b1b 0%, #7f1d1d 100%);
}

@keyframes sosPressed {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); box-shadow: 0 8px 24px rgba(220, 38, 38, 0.6); }
}

.sos-icon {
  font-size: 28px;
  animation: sosPulse 1.5s ease-in-out infinite;
}

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

.sos-text {
  font-size: 16px;
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  color: var(--white);
  font-weight: 700;
}

.participants-section h3 {
  font-size: 19px;
  margin-bottom: 14px;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: -0.3px;
}

.participants-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.participant-item {
  background: var(--white);
  padding: 14px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 2px 8px rgba(255, 107, 138, 0.08);
  border: 1px solid var(--gray-100);
  transition: transform 0.2s ease;
}

.participant-item:active {
  transform: scale(0.98);
}

.participant-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  box-shadow: 0 3px 8px rgba(255, 107, 138, 0.25);
}

.participant-info {
  flex: 1;
}

.participant-name {
  font-weight: 600;
  color: var(--gray-900);
  font-size: 14px;
}

.participant-type {
  font-size: 12px;
  color: var(--gray-600);
}

/* ============================================================================
   Chat Page
   ============================================================================ */

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--gray-50);
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 16px;
}

.message {
  display: flex;
  gap: 8px;
  max-width: 80%;
}

.message.own {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-secondary);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(255, 107, 138, 0.2);
}

.message.own .message-avatar {
  background: var(--gradient-primary);
  color: var(--white);
}

.message-content {
  flex: 1;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.message-sender {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
}

.message-time {
  font-size: 11px;
  color: var(--gray-500);
}

.message-bubble {
  background: var(--gray-50);
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 15px;
  color: var(--gray-900);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  position: relative;
  line-height: 1.5;
}

.message.own .message-bubble {
  background: var(--gradient-primary);
  color: var(--white);
  box-shadow: 0 3px 10px rgba(255, 107, 138, 0.25);
}

.image-message {
  padding: 8px !important;
  background: transparent !important;
  box-shadow: none !important;
}

.message.own .image-message {
  background: transparent !important;
}

.ephemeral-timer {
  font-size: 11px;
  color: var(--warning);
  font-weight: 600;
  margin-top: 4px;
  text-align: center;
  background: rgba(255, 193, 7, 0.1);
  padding: 4px 8px;
  border-radius: 8px;
}

.expired-image {
  color: var(--gray-500);
  font-style: italic;
  text-align: center;
}

.message-actions {
  margin-top: 4px;
}

.message-flag-btn {
  background: transparent;
  color: var(--gray-500);
  font-size: 11px;
  padding: 2px 4px;
}

.chat-footer {
  padding: 14px 18px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--white);
  border-top: 2px solid var(--gray-100);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 100;
}

.message-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.message-form input[type="text"] {
  flex: 1;
  margin: 0;
}

.btn-upload-image {
  font-size: 24px;
  padding: 8px 12px;
  background: var(--gray-100);
  color: var(--gray-700);
  border-radius: 8px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-upload-image:hover {
  background: var(--primary);
  color: var(--white);
  transform: scale(1.05);
}

.image-preview-container {
  position: relative;
  margin-top: 8px;
  padding: 8px;
  background: var(--gray-50);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.image-preview {
  max-width: 80px;
  max-height: 80px;
  border-radius: 4px;
  object-fit: cover;
}

.btn-remove-image {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.ephemeral-badge {
  font-size: 11px;
  background: var(--warning);
  color: var(--white);
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px;
  align-items: center;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--gray-400);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-8px);
  }
}

/* ============================================================================
   Welcome Screen
   ============================================================================ */

.welcome-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.5s ease;
}

.welcome-content {
  text-align: center;
  padding: 40px;
  max-width: 400px;
}

.welcome-icon {
  font-size: 80px;
  margin-bottom: 20px;
  animation: bounce 2s infinite;
}

.welcome-title {
  font-size: 48px;
  font-weight: 900;
  color: var(--white);
  margin-bottom: 12px;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  letter-spacing: -1px;
}

.welcome-subtitle {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 40px;
  font-weight: 500;
  line-height: 1.6;
}

.btn-large {
  padding: 16px 40px;
  font-size: 18px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* ============================================================================
   Error Screen
   ============================================================================ */

.error-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.error-content {
  text-align: center;
  max-width: 400px;
  background: var(--white);
  padding: 40px;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}

.error-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.error-content h2 {
  font-size: 24px;
  color: var(--primary);
  margin-bottom: 16px;
  font-weight: 800;
}

.error-content p {
  font-size: 16px;
  color: var(--gray-700);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ============================================================================
   Loading Enhancements
   ============================================================================ */

.loading-text {
  margin-top: 20px;
  color: var(--primary);
  font-size: 16px;
  font-weight: 600;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ============================================================================
   Utility Classes
   ============================================================================ */

.hidden {
  display: none !important;
}

.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--gray-100);
  border-top-color: var(--primary);
  border-right-color: var(--primary-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.error-state {
  text-align: center;
  padding: 40px 20px;
}

.error-state p {
  color: var(--danger);
  margin-bottom: 20px;
  font-size: 16px;
}

/* ============================================================================
   My Moments Modal
   ============================================================================ */

.my-moments-section {
  margin-bottom: 24px;
}

.my-moments-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--gray-800);
  font-weight: 700;
}

.moments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.moment-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--gray-50);
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  transition: all 0.2s ease;
}

.moment-list-item:hover {
  background: var(--gray-100);
  border-color: var(--primary);
}

.moment-list-item-content {
  flex: 1;
}

.moment-list-item h4 {
  margin: 0 0 4px 0;
  font-size: 15px;
  color: var(--gray-900);
  font-weight: 600;
}

.moment-time {
  margin: 0 0 6px 0;
  font-size: 13px;
  color: var(--gray-600);
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.live {
  background: #fee;
  color: #c00;
}

.status-badge.upcoming {
  background: #eff6ff;
  color: #1e40af;
}

.empty-state {
  text-align: center;
  color: var(--gray-600);
  padding: 20px;
  font-style: italic;
  font-size: 14px;
}

.btn-small {
  padding: 8px 14px;
  font-size: 13px;
}

/* ============================================================================
   Responsive Adjustments
   ============================================================================ */

@media (min-width: 768px) {
  .modal-content {
    max-width: 500px;
  }

  .moment-detail {
    max-width: 600px;
    margin: 0 auto;
  }

  .chat-container {
    max-width: 700px;
    margin: 0 auto;
  }
}

/* ============================================================================
   Mobile-Specific Optimizations (Small Screens)
   ============================================================================ */

/* Small phones (320px - 375px) */
@media (max-width: 375px) {
  .modal-content {
    padding: 18px;
    max-width: calc(100vw - 32px);
  }
  
  .modal-content h2 {
    font-size: 20px;
    margin-bottom: 14px;
  }
  
  input[type="text"],
  input[type="email"],
  input[type="number"],
  input[type="datetime-local"],
  select,
  textarea {
    padding: 11px 13px;
    font-size: 14px;
  }
  
  .btn-primary, .btn-secondary {
    padding: 10px 20px;
    font-size: 14px;
  }
  
  .header {
    padding: 12px 16px;
    min-height: 54px;
  }
  
  .logo {
    font-size: 18px;
  }
  
  .welcome-title {
    font-size: 36px;
  }
  
  .welcome-subtitle {
    font-size: 15px;
  }
  
  .welcome-icon {
    font-size: 60px;
  }
  
  .welcome-content {
    padding: 24px 20px;
  }
  
  .btn-large {
    padding: 14px 32px;
    font-size: 16px;
  }
  
  .moment-header h2 {
    font-size: 22px;
  }
  
  .moment-info {
    padding: 16px;
  }
  
  .info-row {
    font-size: 14px;
  }
  
  .message-bubble {
    padding: 10px 14px;
    font-size: 14px;
  }
  
  .chat-footer {
    padding: 12px 14px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  
  .chat-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }
  
  .message-form input[type="text"] {
    min-width: 0;
    flex: 1;
  }
  
  .btn-send {
    padding: 10px 14px;
    font-size: 14px;
    white-space: nowrap;
  }
  
  .btn-upload-image {
    padding: 8px 10px;
    font-size: 20px;
  }
  
  .checkbox-group {
    grid-template-columns: 1fr;
    max-height: 180px;
  }
  
  .participant-item {
    padding: 12px;
    gap: 12px;
  }
  
  .participant-avatar {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  
  .mapboxgl-popup-content {
    padding: 12px;
    max-width: calc(100vw - 60px);
  }
  
  .mapboxgl-popup-content h3 {
    font-size: 15px;
  }
  
  .mapboxgl-popup-content p {
    font-size: 13px;
  }
  
  .otp-input {
    font-size: 24px;
    letter-spacing: 6px;
    padding: 14px;
  }
}

/* Very small screens (below 320px) */
@media (max-width: 320px) {
  .modal-content {
    padding: 16px;
  }
  
  .modal-content h2 {
    font-size: 18px;
  }
  
  input, select, textarea {
    font-size: 13px;
    padding: 10px 12px;
  }
  
  .btn-primary, .btn-secondary {
    padding: 9px 18px;
    font-size: 13px;
  }
  
  .welcome-title {
    font-size: 32px;
  }
  
  .welcome-icon {
    font-size: 50px;
  }
  
  .otp-input {
    font-size: 20px;
    letter-spacing: 4px;
    padding: 12px;
  }
}

/* Landscape mode fixes */
@media (max-height: 500px) and (orientation: landscape) {
  .modal-content {
    max-height: 85vh;
    padding: 16px;
  }
  
  .welcome-content {
    padding: 20px;
  }
  
  .welcome-icon {
    font-size: 48px;
    margin-bottom: 12px;
  }
  
  .welcome-title {
    font-size: 32px;
    margin-bottom: 8px;
  }
  
  .welcome-subtitle {
    font-size: 14px;
    margin-bottom: 20px;
  }
}

/* Touch target minimum sizes (44px for accessibility) */
.btn-primary,
.btn-secondary,
.btn-send,
.btn-back,
.btn-danger,
.btn-small,
.btn-upload-image {
  min-height: 44px;
}

.close-btn,
.clear-search-btn {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon,
.btn-flag,
.message-flag-btn {
  min-width: 44px;
  min-height: 44px;
}

.mapboxgl-popup-close-button {
  min-width: 44px;
  min-height: 44px;
  font-size: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Header text overflow fix */
.chat-header-info h2 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

#myMomentsBtn {
  white-space: nowrap;
  font-size: 13px;
  padding: 8px 12px;
}

@media (max-width: 400px) {
  #myMomentsBtn {
    font-size: 12px;
    padding: 6px 10px;
  }
  
  #createMomentBtn {
    font-size: 12px;
    padding: 6px 10px;
  }
  
  .search-input {
    font-size: 13px;
    padding: 8px 12px;
  }
}

