* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f7;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
  color: #1f2933;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 40%, rgba(255, 255, 255, 0.7) 0%, transparent 55%),
    radial-gradient(circle at 80% 60%, rgba(210, 214, 220, 0.6) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.container {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  max-width: 800px;
  width: 100%;
  padding: 56px;
  border-radius: 32px;
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1 {
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  margin-bottom: 48px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* Upload Area */
.upload-area {
  border: 2px dashed #cbd5e0;
  border-radius: 20px;
  padding: 80px 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.upload-area::before {
  content: '📸';
  font-size: 72px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.05;
  pointer-events: none;
}

.upload-area:hover {
  border-color: #6366f1;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(99, 102, 241, 0.2);
}

.upload-area.dragover {
  border-color: #6366f1;
  background: linear-gradient(135deg, #eef2ff 0%, #ddd6fe 100%);
  transform: scale(1.02);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.upload-text {
  color: #1e293b;
  font-size: 18px;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.upload-text small {
  display: block;
  margin-top: 16px;
  font-size: 14px;
  color: #64748b;
  font-weight: 400;
}

#fileInput {
  display: none;
}

body.modal-open {
  overflow: hidden;
}

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

.modal-backdrop.visible {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 210;
  opacity: 0;
  visibility: hidden;
  transform: translateY(24px) scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.modal.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.modal-content {
  background: #ffffff;
  width: min(520px, 100%);
  border-radius: 28px;
  padding: 40px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(15, 23, 42, 0.05);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.modal-header {
  padding-right: 32px;
}

.modal-header h2 {
  margin: 0 0 12px;
  font-size: 1.875rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}

.modal-header p {
  margin: 0;
  color: #475569;
  font-size: 1rem;
  line-height: 1.6;
}

.modal-close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  background: #f1f5f9;
  color: #475569;
  transform: rotate(90deg);
}

.modal-close:focus {
  outline: none;
  background: #e2e8f0;
  color: #334155;
}

.modal-close:active {
  transform: rotate(90deg) scale(0.95);
}

.modal-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: #0f172a;
  margin-bottom: 8px;
  display: block;
  letter-spacing: 0.01em;
}

.modal-content input[type="email"],
.modal-content textarea {
  width: 100%;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  padding: 14px 16px;
  font-size: 1rem;
  color: #0f172a;
  background: #ffffff;
  transition: all 0.2s ease;
  font-family: inherit;
}

.modal-content input[type="email"]:hover,
.modal-content textarea:hover {
  border-color: #cbd5e0;
}

.modal-content input[type="email"]:focus,
.modal-content textarea:focus {
  outline: none;
  border-color: #6366f1;
  background: #fefefe;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.modal-content textarea {
  resize: vertical;
  min-height: 120px;
}

.modal-note {
  font-size: 0.875rem;
  color: #64748b;
  margin: -4px 0 4px;
  font-style: italic;
}

.modal-feedback {
  display: none;
  font-size: 0.9375rem;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 500;
}

.modal-feedback.visible {
  display: block;
}

.modal-feedback.error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.modal-feedback.success {
  background: #f0fdf4;
  color: #047857;
  border: 1px solid #bbf7d0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.modal-btn {
  border: none;
  border-radius: 12px;
  padding: 13px 24px;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
}

.modal-btn.secondary {
  background: #f1f5f9;
  color: #475569;
  border: 2px solid transparent;
}

.modal-btn.secondary:hover {
  background: #e2e8f0;
  color: #334155;
}

.modal-btn.secondary:active {
  transform: scale(0.98);
}

.modal-btn.primary {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #ffffff;
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
}

.modal-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 35px rgba(99, 102, 241, 0.4);
}

.modal-btn.primary:active {
  transform: translateY(0);
}

.modal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

@media (max-width: 640px) {
  .modal-content {
    padding: 32px 24px;
    gap: 20px;
  }

  .modal-header h2 {
    font-size: 1.5rem;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-btn {
    width: 100%;
  }
}

/* File List */
.file-list {
  margin: 24px 0;
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e0 #f1f5f9;
}

.file-list::-webkit-scrollbar {
  width: 8px;
}

.file-list::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}

.file-list::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 10px;
}

.file-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-radius: 14px;
  margin-bottom: 10px;
  background: white;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.file-item:hover {
  background: #fafafa;
  border-color: #cbd5e0;
  transform: translateX(4px);
}

.file-item.success {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border-color: #34d399;
}

.file-item span {
  color: #334155;
  font-size: 14px;
  font-weight: 500;
}

.file-item button {
  background: #ef4444;
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 8px;
  min-width: auto;
  flex: none;
}

.file-item button:hover {
  background: #dc2626;
}

/* Buttons */
.buttons {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  margin: 32px 0 0 0;
}

button {
  background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

button:hover::before {
  width: 300px;
  height: 300px;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  background: linear-gradient(135deg, #cbd5e0 0%, #94a3b8 100%);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  opacity: 0.6;
}

.clear-btn {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.clear-btn:hover {
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
}

.view-map-btn {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.view-map-btn:hover {
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

.share-route-btn {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
}

.share-route-btn:hover {
  box-shadow: 0 10px 28px rgba(59, 130, 246, 0.4);
}

/* Secondary Buttons */
.secondary-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid #e2e8f0;
}

#show-photos-btn,
.share-route-btn,
#delete-photos-btn {
  background: white;
  color: #475569;
  border: 2px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  min-width: 150px;
  flex: 1;
  max-width: 220px;
}

#show-photos-btn::before,
#delete-photos-btn::before {
  background: rgba(0, 0, 0, 0.03);
}

.share-route-btn {
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.share-route-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e40af;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

#show-photos-btn:hover,
#delete-photos-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e0;
  color: #1e293b;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#delete-photos-btn {
  color: #dc2626;
  border-color: #fecaca;
}

#delete-photos-btn:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}

/* Preview Container */
.preview-container {
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 20px;
  padding: 28px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 20px;
  border: 1px solid #e2e8f0;
}

.preview-container:empty {
  display: none;
}

.thumbnail {
  position: relative;
  text-align: center;
  animation: scaleIn 0.4s ease-out;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.thumbnail img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid white;
}

.thumbnail img:hover {
  transform: scale(1.08) rotate(2deg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.thumbnail .filename {
  display: block;
  margin-top: 10px;
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
}

.thumbnail .remove-icon {
  position: absolute;
  top: -10px;
  right: -10px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: white;
  font-weight: bold;
  font-size: 20px;
  line-height: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
  border: 2px solid white;
}

.thumbnail .remove-icon:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: scale(1.15) rotate(90deg);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 40px 28px;
  }

  h1 {
    font-size: 28px;
    margin-bottom: 36px;
  }

  .upload-area {
    padding: 60px 24px;
  }

  .buttons {
    grid-template-columns: 1fr;
  }

  .secondary-buttons {
    flex-direction: column;
  }

  #show-photos-btn,
  #delete-photos-btn {
    max-width: none;
  }

  .preview-container {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 16px;
    padding: 20px;
  }

  .thumbnail img {
    height: 100px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 12px;
  }

  .container {
    padding: 32px 20px;
    border-radius: 24px;
  }

  h1 {
    font-size: 24px;
  }

  .upload-area {
    padding: 48px 20px;
  }

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

  button {
    padding: 14px 24px;
    font-size: 14px;
  }
}
