/* Base styles */
@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('../assets/fonts/plus-jakarta-sans-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #e9eaec;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.site-header {
  background: #ffffff;
  border-bottom: 1px solid #eceff3;
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header-inner {
  max-width: 1352px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-logo {
  width: 36px;
  height: 36px;
  display: block;
}

.brand-text {
  font-size: 1.14rem;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  font-weight: 700;
}

.brand-clean {
  color: #101828;
}

.brand-gpx {
  color: #1eccbf;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-nav-link {
  text-decoration: none;
  color: #475467;
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 7px 12px;
  transition: all 0.25s ease;
}

.site-nav-link:hover {
  color: #1eccbf;
  border-color: rgba(30, 204, 191, 0.4);
  background: rgba(30, 204, 191, 0.08);
}

.site-nav-link.is-active {
  background: rgba(30, 204, 191, 0.15);
  color: #0d9488;
}

.page-shell {
  min-height: calc(100vh - 65px);
  padding: 34px 16px 20px;
  background-color: #f4f4f4;
}

.tool-layout {
  max-width: 980px;
  margin: 0 auto;
}

/* Main card */
.main-card {
  background: white;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 14px 34px rgba(16, 24, 40, 0.08);
  margin-bottom: 20px;
  border: 1px solid #e8ebf0;
  position: relative;
}

.card-guide-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #535ff9;
  border-radius: 999px;
  background: #535ff9;
  color: #ffffff;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 11px;
  transition: all 0.2s ease;
}

.card-guide-btn:hover {
  background: #1eccbf;
  border-color: #1eccbf;
  color: #ffffff;
}

.card-guide-icon {
  width: 15px;
  height: 15px;
  filter: brightness(0) invert(1);
}

.tool-header {
  margin-bottom: 18px;
}

.tool-header h1 {
  font-size: 1.45rem;
  line-height: 1.2;
  color: #101828;
  margin-bottom: 0;
}

.tool-header p {
  margin: 0;
  color: #667085;
  font-size: 0.98rem;
}

/* Form elements */
.form-group {
  margin-bottom: 30px;
}

.form-group label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #2c3e50;
  font-size: 1.1rem;
}

.file-input-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-cta-btn {
  width: min(440px, 100%);
  border: none;
  border-radius: 999px;
  background: #1eccbf;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 14px 18px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.file-cta-btn:hover {
  background: #535ff9;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(83, 95, 249, 0.25);
}

.file-cta-icon {
  width: 18px;
  height: 18px;
  display: block;
  filter: brightness(0) invert(1);
}

.processing-options {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  background: #fafbfc;
}

.option-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.95rem;
  color: #2c3e50;
  margin-bottom: 6px;
}

.option-check input {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: #535ff9;
}

.option-note {
  margin: 0;
  padding-left: 26px;
  font-size: 0.83rem;
  color: #6c757d;
  line-height: 1.4;
}

/* Status message */
.status-message {
  padding: 15px;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.3s ease;
  display: none;
  margin-bottom: 20px;
  position: relative;
  padding-left: 44px;
}

.status-message::before {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
}

.status-message.info {
  background-color: #e3f2fd;
  color: #0969da;
  border: 1px solid #0969da;
}

.status-message.info::before {
  content: "i";
  font-weight: 700;
}

.status-message.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status-message.success::before {
  content: "\2713";
  font-weight: 700;
}

.status-message.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.status-message.error::before {
  content: "!";
  font-weight: 700;
}

.status-message.loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(9, 105, 218, 0.3);
  border-top-color: #0969da;
  animation: status-spin 0.8s linear infinite;
}

@keyframes status-spin {
  from {
    transform: translateY(-50%) rotate(0deg);
  }

  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

#stats-grid,
#download-section,
#preview-modal {
  display: none;
}

.stat-item {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  border: 1px solid #e9ecef;
  transition: transform 0.3s ease;
}

.stat-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(83, 95, 249, 0.1);
}

.stat-icon {
  font-size: 2rem;
  margin-bottom: 10px;
  display: block;
}

.stat-label {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 5px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #535ff9;
}

.preview-btn {
  background: #535ff9;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  margin-top: 5px;
}

.preview-btn:hover {
  background: #1eccbf;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(30, 204, 191, 0.3);
}

/* Map preview */
.map-preview {
  margin-bottom: 30px;
}

.map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.map-header h3 {
  font-size: 1.3rem;
  color: #2c3e50;
  margin: 0;
}

.map-controls {
  display: flex;
  gap: 10px;
}

.close-btn {
  background: #ff4444;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: white;
  padding: 6px 10px;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  font-weight: bold;
}

.close-btn:hover {
  background: #cc0000;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(255, 68, 68, 0.3);
}

.map-btn {
  background: #535ff9;
  color: white;
  border: none;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.map-btn:hover {
  background: #1eccbf;
  transform: scale(1.1);
}

.map-container {
  height: 400px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #e9ecef;
}

/* Profile preview */
.profile-preview {
  margin-bottom: 30px;
}

.profile-header h3 {
  font-size: 1.3rem;
  color: #2c3e50;
  margin-bottom: 15px;
}

.profile-chart {
  height: 300px;
  background: white;
  border-radius: 10px;
  padding: 10px;
  border: 1px solid #e9ecef;
}

/* Download section */
.download-section {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 10px;
  border: 1px solid #e9ecef;
}

.download-header h3 {
  font-size: 1.3rem;
  color: #2c3e50;
  margin-bottom: 20px;
}

.download-input-group {
  display: flex;
  gap: 15px;
  align-items: center;
}

/* Modern Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #535ff9;
}

.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 1px #535ff9;
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(26px);
}

.toggle-profile-btn {
  background: #535ff9;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.toggle-profile-btn:hover {
  background: #1eccbf;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(30, 204, 191, 0.3);
}

.toggle-profile-btn.active {
  background: #1eccbf;
}

.rename-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s ease;
  background-color: white;
}

.rename-input:focus {
  outline: none;
  border-color: #535ff9;
  box-shadow: 0 0 0 3px rgba(83, 95, 249, 0.1);
}

.btn-primary {
  background-color: #535ff9;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  min-width: 160px;
  justify-content: center;
}

.btn-primary:hover:not(:disabled) {
  background-color: #1eccbf;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(30, 204, 191, 0.3);
}

.btn-primary:disabled {
  background-color: #bdc3c7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: #ffffff;
  color: #2c3e50;
  border: 2px solid #d0d7de;
  padding: 10px 16px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  transition: all 0.25s ease;
  min-width: 120px;
}

.btn-secondary:hover {
  border-color: #535ff9;
  color: #535ff9;
  box-shadow: 0 3px 10px rgba(83, 95, 249, 0.15);
  transform: translateY(-1px);
}

.download-icon {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
}

.site-footer {
  text-align: center;
  padding: 22px 0 10px;
  color: #667085;
  font-size: 0.88rem;
}

.info-section {
  background: #ffffff;
  border: 1px solid #e8ebf0;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
}

.info-section h2 {
  margin-bottom: 8px;
  font-size: 1.25rem;
  color: #101828;
}

.info-section p {
  margin: 0;
  color: #667085;
  line-height: 1.6;
}

.article-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.article-card {
  text-decoration: none;
  border: 1px solid #e6eaf1;
  border-radius: 12px;
  padding: 14px;
  background: #fbfdff;
  transition: all 0.2s ease;
}

.article-card:hover {
  border-color: #1eccbf;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.08);
  transform: translateY(-1px);
}

.article-card h3 {
  color: #0f172a;
  font-size: 0.98rem;
  margin-bottom: 6px;
}

.article-card p {
  color: #64748b;
  font-size: 0.86rem;
  line-height: 1.5;
}

.site-footer-links {
  margin-top: 6px;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.footer-link-btn {
  background: transparent;
  border: none;
  color: #0d9488;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  padding: 0;
}

.footer-link-btn:hover {
  color: #535ff9;
}

.footer-link {
  color: #0d9488;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}

.footer-link:hover {
  color: #535ff9;
}

/* Responsive */
@media (max-width: 768px) {
  .site-header-inner {
    padding: 10px 12px;
  }

  .site-nav {
    gap: 4px;
  }

  .site-nav-link {
    padding: 6px 9px;
    font-size: 0.83rem;
  }

  .page-shell {
    padding: 16px 10px 12px;
  }
  
  .main-card {
    padding: 18px;
  }

  .card-guide-btn {
    position: static;
    margin-bottom: 10px;
  }

  .tool-header h1 {
    font-size: 1.3rem;
  }

  .tool-header p {
    font-size: 0.9rem;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  
  .download-input-group {
    flex-direction: column;
    gap: 10px;
  }

  .download-input-group .btn-primary,
  .download-input-group .btn-secondary,
  .download-input-group .rename-input {
    width: 100%;
  }

  .file-cta-btn {
    width: 100%;
    font-size: 0.95rem;
  }

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

  .processing-options {
    padding: 10px 12px;
  }

  .option-check {
    font-size: 0.9rem;
  }

  .option-note {
    padding-left: 24px;
    font-size: 0.8rem;
  }
  
  .map-container {
    height: 300px;
  }
  
  .profile-chart {
    height: 250px;
  }
}

@media (max-width: 480px) {
  .brand-logo {
    width: 28px;
    height: 28px;
  }

  .brand-text {
    font-size: 0.95rem;
  }

  .site-nav {
    display: none;
  }

  .tool-header h1 {
    font-size: 1.2rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .map-header {
    flex-direction: column;
    gap: 10px;
  }
}

/* Modal Styles */
.preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  border-radius: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-body {
  flex: 1;
  padding: 0;
  overflow: hidden;
}

.preview-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

.map-section {
  flex: 0.66; /* 66% height */
  border-bottom: 1px solid #e9ecef;
  display: flex;
  flex-direction: column;
  position: relative;
}

.profile-section {
  flex: 0.34; /* 34% height */
  display: flex;
  flex-direction: column;
  position: relative;
  max-height: 34vh;
  overflow: hidden;
}

.section-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.95);
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(4px);
}

.section-overlay h3 {
  margin: 0;
  color: #2c3e50;
  font-size: 0.9rem;
  font-weight: 600;
}

.modal-map {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
}

.modal-profile-chart {
  width: 100% !important;
  height: 100% !important;
  padding: 15px;
  box-sizing: border-box !important;
  display: block !important;
  overflow: hidden !important;
}

/* Responsive Modal */
@media (max-width: 768px) {
  .preview-layout {
    flex-direction: column;
  }
  
  .map-section {
    flex: 1;
    border-bottom: 1px solid #e9ecef;
  }
  
  .profile-section {
    flex: 1;
    max-height: none;
  }

  .profile-section .section-overlay {
    display: none;
  }
  
  .modal-content {
    width: 98%;
    height: 90vh;
  }
}

.route-marker {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}

.route-marker-start {
  background: #1eccbf;
  color: #ffffff;
}

.route-marker-end {
  background: #ffffff;
  color: #2c3e50;
  border: 2px solid #2c3e50;
}

.route-marker-icon {
  width: 14px;
  height: 14px;
  display: block;
}

.start-marker,
.end-marker {
  background: transparent !important;
  border: none !important;
}
