/* Itinerary Page Styles */

:root {
  --charcoal: #2E2E2E;
  --warm-white: #FAF9F6;
  --mist: #F5F3EF;
  --latte: #B89B7A;
  --muted: #7A7A7A;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --serif: 'Fraunces', Georgia, serif;
  --t: 0.2s;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--sans);
  background: var(--mist);
  color: var(--charcoal);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  background: var(--warm-white);
  border-bottom: 1px solid rgba(46,46,46,.08);
}

.brand {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--charcoal);
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.brand span {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: .05em;
  text-transform: uppercase;
}

.back-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(46,46,46,.14);
  transition: all var(--t) var(--ease);
  white-space: nowrap;
}

.back-link:hover {
  color: var(--charcoal);
  border-color: var(--charcoal);
}

.container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

aside {
  width: 320px;
  padding: 1.1rem;
  background: var(--warm-white);
  overflow-y: auto;
  border-right: 1px solid rgba(46,46,46,.08);
}

#map {
  flex: 1;
  min-width: 0;
  background: #aad3df;
}

label {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.7rem;
}

input, button, select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  margin: 0.25rem 0;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--charcoal);
  border: 1px solid rgba(46,46,46,.14);
  border-radius: 8px;
  background: #fff;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--latte);
  box-shadow: 0 0 0 3px rgba(184,155,122,.12);
}

.search-wrapper {
  position: relative;
  margin: 0.25rem 0 0.75rem;
}

.search-wrapper input {
  margin: 0;
  padding-right: 2.2rem;
}

.clear-search {
  display: none;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  padding: 0;
  align-items: center;
  justify-content: center;
  background: var(--mist);
  color: var(--muted);
  border-radius: 50%;
  font-size: 0.85rem;
  line-height: 1;
  transition: none;
}

.clear-search:hover {
  background: var(--latte);
  color: #fff;
  transform: translateY(-50%);
}

button {
  background: var(--charcoal);
  color: var(--warm-white);
  border: none;
  cursor: pointer;
  font-weight: 500;
  letter-spacing: .04em;
  transition: all var(--t) var(--ease);
}

button:hover {
  background: #1f1f1f;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--charcoal);
  border: 1px solid rgba(46,46,46,.14);
}

.btn-outline:hover {
  background: var(--mist);
  transform: translateY(-1px);
}

.btn-save {
  background: #6A8F5F;
  color: white;
}

.btn-save:hover {
  background: #5a7a50;
}

.danger {
  background: #C85A54;
  color: white;
}

.danger:hover {
  background: #b04a44;
}

.actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

h3 {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 500;
  color: var(--charcoal);
  margin: 1.2rem 0 0.5rem 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(46,46,46,.08);
}

#list {
  margin-top: 0.5rem;
}

.checkpoint {
  background: white;
  padding: 0.8rem;
  padding-right: 2rem;
  margin: 0.5rem 0;
  border-radius: 8px;
  border: 1px solid rgba(46,46,46,.08);
  position: relative;
  transition: all var(--t) var(--ease);
  cursor: pointer;
}

.checkpoint:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  border-color: rgba(184,155,122,.3);
}

.checkpoint-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--charcoal);
  margin-bottom: 0.4rem;
  line-height: 1.3;
}

.checkpoint-location {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
  line-height: 1.4;
}

.checkpoint-info {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
  line-height: 1.4;
}

.checkpoint-info a {
  color: var(--latte);
  text-decoration: none;
  transition: color var(--t) var(--ease);
}

.checkpoint-info a:hover {
  color: var(--charcoal);
  text-decoration: underline;
}

.checkpoint-category {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.checkpoint-category.Place {
  background: rgba(184,155,122,.15);
  color: #8B7355;
}

.checkpoint-category.Accommodation {
  background: rgba(46,46,46,.1);
  color: var(--charcoal);
}

.checkpoint-category.Food {
  background: rgba(106,143,95,.15);
  color: #4a6a3f;
}

.checkpoint-delete {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  background: rgba(200,90,84,0.1);
  color: #C85A54;
  border: none;
  padding: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.75rem;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--t) var(--ease);
  font-weight: 600;
}

.checkpoint-delete:hover {
  background: #C85A54;
  color: white;
  transform: scale(1.1);
}

.leaflet-popup-content-wrapper {
  border-radius: 10px;
  font-family: var(--sans);
}

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

.modal-content {
  background: var(--warm-white);
  padding: 2rem;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

/* Filename Modal Specific Styles */
#filenameInput:focus {
  outline: none;
  border-color: var(--charcoal);
  box-shadow: 0 0 0 3px rgba(46,46,46,0.1);
}

#confirmFilename:hover {
  background: #1a1a1a;
  transform: translateY(-1px);
}

#cancelFilename:hover {
  background: var(--mist);
  border-color: var(--charcoal);
}

.modal-content h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--charcoal);
}

.modal-content input {
  margin: 1rem 0;
}

.share-edit-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--charcoal);
}

.share-edit-label input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.modal-content .actions {
  margin-top: 1.5rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }
  
  aside {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(46,46,46,.08);
    max-height: 45vh;
  }
  
  #map {
    min-height: 55vh;
  }
  
  header .brand span {
    display: none;
  }
  
  .modal-content {
    padding: 1.5rem;
  }
}

/* Print Styles */
@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  header, aside, .actions, .back-link {
    display: none !important;
  }
  
  body {
    background: white;
    display: block;
    height: auto;
    margin: 0;
    padding: 1cm;
  }
  
  .container {
    display: block !important;
    height: auto;
  }
  
  #map {
    width: 100% !important;
    height: 12cm !important;
    page-break-after: always;
    margin-bottom: 0;
    border: 1px solid #ddd;
  }
  
  /* Print checkpoint list */
  #printCheckpointList {
    display: block !important;
    page-break-before: always;
    padding-top: 1cm;
  }
  
  #printCheckpointList h2 {
    font-family: var(--serif);
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
    color: #2E2E2E;
    border-bottom: 2px solid #2E2E2E;
    padding-bottom: 0.3rem;
  }
  
  #printCheckpointList .print-checkpoint {
    margin-bottom: 0.8rem;
    page-break-inside: avoid;
    padding: 0.5rem;
    border-left: 3px solid #B89B7A;
    padding-left: 0.8rem;
  }
  
  #printCheckpointList .print-checkpoint-number {
    font-weight: 600;
    font-size: 1rem;
    color: #2E2E2E;
    margin-bottom: 0.2rem;
  }
  
  #printCheckpointList .print-checkpoint-category {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.15rem;
  }
  
  #printCheckpointList .print-checkpoint-coords {
    font-size: 0.8rem;
    color: #888;
    font-family: 'Courier New', monospace;
  }
  
  /* Footer */
  #printCheckpointList::after {
    content: "Created with allaydzqe world itinerary";
    display: block;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
    font-size: 0.75rem;
    color: #999;
    text-align: center;
  }
}

