/* ============================================================================
   CREATE YOINK MODAL (Phase 4)
   Mobile-first quick yoink creation
   ============================================================================ */

.create-yoink-modal-content {
  max-width: 500px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
}

/* Disable decorative inner border on scrollable create panel */
.create-yoink-modal-content::before {
  display: none;
}

.create-yoink-body {
  padding: 24px;
}

.create-yoink-body h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 24px 0;
  text-align: center;
}

.create-yoink-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Required asterisk */
.create-yoink-form .required {
  color: var(--error);
}

/* Optional label */
.optional-label {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 13px;
}

/* ============================================
   Photo Upload Section
   ============================================ */

.photo-upload-section label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.photo-upload-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Add Photo Button */
.photo-upload-add {
  width: 72px;
  height: 72px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

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

.photo-upload-add:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.photo-add-icon {
  font-size: 24px;
}

.photo-add-text {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Photo Preview Thumbnails */
.photo-preview-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--bg-secondary);
}

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

.photo-preview-thumb.is-hero {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

/* Hero badge on first photo */
.photo-hero-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: var(--primary);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

/* Remove photo button */
.photo-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.photo-preview-thumb:hover .photo-remove-btn {
  opacity: 1;
}

.photo-remove-btn:hover {
  background: var(--error);
  transform: scale(1.1);
}

/* Always show remove on touch devices */
@media (pointer: coarse) {
  .photo-remove-btn {
    opacity: 1;
  }
}

/* ============================================
   Location Input with GPS Detection
   ============================================ */

.location-input-wrapper {
  position: relative;
}

/* Detecting state */
.location-detecting {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 14px;
}

.detecting-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Location display (after GPS detection) */
.location-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--success-light);
  border: 1px solid var(--success);
  border-radius: 8px;
  font-size: 14px;
}

.location-display .location-icon {
  font-size: 16px;
}

.location-display .location-name {
  flex: 1;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.location-display-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.location-action-divider {
  color: var(--text-secondary);
  font-size: 12px;
}

/* Nearby places list */
.location-nearby-list {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.nearby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.nearby-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nearby-places {
  max-height: 280px;
  overflow-y: auto;
}

.nearby-place-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s ease;
}

.nearby-place-item:last-child {
  border-bottom: none;
}

.nearby-place-item:hover {
  background: var(--bg);
}

.nearby-place-item.selected {
  background: var(--success-light);
  border-left: 3px solid var(--success);
}

.nearby-place-radio {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease;
}

.nearby-place-item.selected .nearby-place-radio {
  border-color: var(--success);
}

.nearby-place-radio::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.nearby-place-item.selected .nearby-place-radio::after {
  opacity: 1;
}

.nearby-place-info {
  flex: 1;
  min-width: 0;
}

.nearby-place-name {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nearby-place-address {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.nearby-hint {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg);
  border-top: 1px solid var(--border);
  margin: 0;
  text-align: center;
}

/* Location search wrapper */
.location-search-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.location-help {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

#back-to-nearby-btn {
  align-self: flex-start;
  margin-top: 4px;
}

/* GPS status hint */
.gps-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gps-status.gps-success {
  color: var(--success);
}

.gps-status.gps-error {
  color: var(--error);
}

/* Location search input */
#create-yoink-location {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px; /* Prevents iOS zoom */
  transition: border-color 0.2s, box-shadow 0.2s;
}

#create-yoink-location:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Location autocomplete results (reuse existing styles) */
#create-location-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px var(--shadow);
  margin-top: 4px;
}

#create-location-results:empty {
  display: none;
}

/* ============================================
   Category Dropdown
   ============================================ */

#create-yoink-category {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px; /* Prevents iOS zoom */
  background: white;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

#create-yoink-category:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

#create-yoink-category option {
  padding: 8px;
}

/* Category hint with manage link */
#category-hint a {
  color: var(--primary);
  text-decoration: none;
}

#category-hint a:hover {
  text-decoration: underline;
}

/* ============================================
   Collapsible Description
   ============================================ */

.description-group {
  margin-top: 4px;
}

.description-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.description-toggle:hover {
  background: var(--border);
  color: var(--text);
}

.description-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.description-toggle[aria-expanded="true"] {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}

.description-toggle .toggle-icon {
  font-size: 16px;
}

.description-toggle .toggle-text {
  flex: 1;
  text-align: left;
}

.description-toggle .toggle-arrow {
  font-size: 10px;
  transition: transform 0.2s;
}

.description-toggle[aria-expanded="true"] .toggle-arrow {
  transform: rotate(180deg);
}

.description-wrapper {
  padding: 12px 16px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
}

#create-yoink-description {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#create-yoink-description:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* ============================================
   Title Suggestion
   ============================================ */

#title-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

#title-suggestion {
  font-weight: 500;
  color: var(--text);
}

.btn-tiny {
  padding: 2px 8px;
  font-size: 12px;
  background: var(--primary-light);
  color: var(--primary);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

.btn-tiny:hover {
  background: var(--primary);
  color: white;
}

/* ============================================
   Error Display
   ============================================ */

#create-yoink-error {
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: var(--error);
  font-size: 14px;
  line-height: 1.5;
}

/* ============================================
   YOINK! Submit Button
   Big, satisfying, mobile-friendly
   ============================================ */

.btn-yoink {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  min-height: 56px; /* Big touch target */
}

.btn-yoink:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.btn-yoink:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.btn-yoink:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-yoink:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

.yoink-btn-icon {
  font-size: 22px;
}

.yoink-btn-text {
  letter-spacing: 1px;
}

/* Loading state for submit */
.btn-yoink.loading {
  pointer-events: none;
}

.btn-yoink.loading .yoink-btn-icon {
  animation: spin 0.8s linear infinite;
}

/* Success animation */
@keyframes yoinkSuccess {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.btn-yoink.success {
  background: var(--success);
  animation: yoinkSuccess 0.3s ease;
}

/* ============================================
   Save Progress Indicator
   ============================================ */

.save-progress {
  margin: 16px 0;
  padding: 12px 16px;
  background: rgba(79, 70, 229, 0.1);
  border-radius: 12px;
  border: 1px solid rgba(79, 70, 229, 0.2);
}

.save-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.save-progress-step {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.save-progress-detail {
  font-size: 12px;
  color: var(--text-muted);
}

.save-progress-bar-container {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.save-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, #818cf8 100%);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Pulsing animation for indeterminate progress */
.save-progress-bar.indeterminate {
  width: 30% !important;
  animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {
  0% { transform: translateX(-100%); opacity: 0.7; }
  50% { opacity: 1; }
  100% { transform: translateX(300%); opacity: 0.7; }
}

/* ============================================
   Mobile Optimizations
   ============================================ */

@media (max-width: 480px) {
  .create-yoink-modal-content {
    width: 100%;
    max-height: 100vh;
    border-radius: 16px 16px 0 0;
    margin-top: auto;
  }
  
  .create-yoink-body {
    padding: 20px 16px 32px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0));
  }
  
  .create-yoink-body h2 {
    font-size: 20px;
    margin-bottom: 20px;
  }
  
  .photo-upload-add,
  .photo-preview-thumb {
    width: 64px;
    height: 64px;
  }
  
  .btn-yoink {
    padding: 18px 24px;
    font-size: 17px;
    min-height: 60px;
    border-radius: 14px;
  }
}

/* Bottom sheet style on mobile */
@media (max-width: 480px) {
  #create-yoink-modal.active {
    align-items: flex-end;
  }
  
  #create-yoink-modal .modal-content {
    animation: slideUp 0.3s ease;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Larger touch targets for form elements on mobile */
@media (pointer: coarse) {
  #create-yoink-location,
  #create-yoink-category,
  #create-yoink-title-input {
    min-height: 48px;
  }
  
  .description-toggle {
    min-height: 48px;
  }
  
  .location-display {
    min-height: 48px;
  }
}

/* Category Search */
.category-search-wrapper {
  padding: 0 0 16px 0;
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 1;
}

.category-search-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  background: white;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.category-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.category-search-input::placeholder {
  color: var(--text-muted);
}

.category-search-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.search-highlight {
  background: rgba(255, 200, 0, 0.3);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

.category-search-input::placeholder {
  color: var(--text-muted);
}

.category-search-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.search-highlight {
  background: rgba(255, 200, 0, 0.3);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

