* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background-color: #f4f5f7;
  color: #222;
}

.site-header {
  background-color: #0c5da5;
  color: #fff;
  padding: 1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.site-header h1 {
  margin: 0;
  font-size: 1.4rem;
}

.nav {
  display: flex;
  gap: 0.75rem;
}

.nav-link {
  color: #e0ecff;
  text-decoration: none;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.9rem;
}

.nav-link-active,
.nav-link:hover {
  background-color: #ffffff33;
  color: #fff;
}

.container {
  max-width: 960px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
}

.layout-main {
  /* display: flex; gap: 1rem; align-items: flex-start;  <-- Removed Flex */
  display: block;
  position: relative;
}

.main-column {
  /* Fixed Sidebar Style */
  position: fixed;
  top: 5rem;
  left: 1rem;
  bottom: 1rem;
  width: 300px;
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 1rem;
  z-index: 900;
  display: flex;
  flex-direction: column;
}

.side-column {
  /* Push content to the right */
  margin-left: 320px;
  width: auto;
}

section + section {
  margin-top: 1.5rem;
}

h2 {
  margin-top: 0;
  font-size: 1.2rem;
  border-left: 4px solid #0c5da5;
  padding-left: 0.5rem;
}

/* Remove card-list fixed height and border, let it fill the sidebar */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  flex: 1; /* Fill remaining height */
  height: auto; /* Override fixed height */
  overflow-y: auto;
  border: none;
  border-radius: 0;
  padding: 0.5rem 0; /* Adjust padding */
  background-color: transparent;
}

.card {
  background-color: #fff;
  border-radius: 0.5rem;
  padding: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  font-size: 0.95rem;
  cursor: grab;
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out,
    opacity 0.12s ease-out;
  overflow: hidden;
  flex-shrink: 0;
}

.card.card-note .card-header {
  padding-top: 0.35rem;
  padding-bottom: 0.1rem;
}

.note-text {
  cursor: grab;
}

.note-text-inner {
  cursor: text;
  white-space: pre-wrap;
  display: inline-block;
}

.note-placeholder {
  color: #b0b4bd;
}

.card-header {
  padding: 0.5rem 0.75rem 0.25rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
}

.card-header-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding-left: 1.4rem;
}

.card-toggle-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: background-color 0.2s, transform 0.3s;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.card-toggle-btn:hover {
  background-color: #f0f0f0;
}

.card-toggle-btn::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-right: 2px solid #666;
  border-bottom: 2px solid #666;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.card.collapsed .card-toggle-btn {
  transform: rotate(-90deg);
}

.card-actions {
  padding: 0 0.75rem 0.25rem;
  margin-top: 0;
  display: flex;
  gap: 0;
  flex-wrap: wrap;
}

.card-details {
  padding: 0 0.75rem 0;
  max-height: 1000px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.25s ease-out, padding 0.35s ease;
}

.card.collapsed .card-details {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  display: none;
}

.card.collapsed .card-actions {
  display: flex;
}

.card h3 {
  margin: 0 0 0.15rem;
  font-size: 1rem;
  line-height: 1.2;
}

.card-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 0.35rem;
  font-size: 0.75rem;
  color: #fff;
  flex-shrink: 0;
  position: absolute;
  top: 0.45rem;
  left: 0.75rem;
}

.card-type-badge svg {
  width: 0.9rem;
  height: 0.9rem;
}

.card-type-food {
  background-color: #e67e22;
}

.card-type-place {
  background-color: #27ae60;
}

.card-type-stay {
  background-color: #8e44ad;
}

.card-type-transport {
  background-color: #2980b9;
}

.card p {
  margin: 0 0 0.1rem;
  line-height: 1.3;
}

.note-drag-spacer {
  height: 6px;
  cursor: grab;
}

/* .card-actions was moved up */
.card-actions .btn {
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
}

.card.card-note .card-actions {
  padding-top: 0.1rem;
  padding-bottom: 0.1rem;
}

.card.card-note .card-actions .btn {
  font-size: 0.8rem;
  padding: 0.2rem 0.45rem;
}

.plan-list {
  min-height: 120px;
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px dashed #c5c9d3;
  background-color: #f9fafb;
  position: relative;
  overflow: hidden;
  transition: height 0.3s ease;
}

.plan-list-content {
  width: 100%;
  min-height: 100px;
}

.plan-days {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  -webkit-overflow-scrolling: touch;
}

.plan-day-btn,
.plan-day-add-btn,
.plan-day-remove-btn {
  border-radius: 999px;
  border: 1px solid #c5c9d3;
  background-color: #fff;
  padding: 0.15rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: #333;
  white-space: nowrap;
  flex-shrink: 0;
}

.plan-day-btn.active {
  background-color: #0c5da5;
  color: #fff;
  border-color: #0c5da5;
}

.plan-day-add-btn {
  border-style: dashed;
  color: #0c5da5;
  background-color: #f0f6ff;
}

.plan-day-remove-btn {
  border-color: #e06666;
  color: #d32f2f;
  background-color: #fff5f5;
}

.plan-item {
  border-radius: 0.35rem;
  background-color: #fff;
  border: 1px solid #e0e4ea;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
  cursor: grab;
  transition: transform 0.25s ease-out, box-shadow 0.25s ease-out,
    opacity 0.25s ease-out;
}

.plan-item:last-child {
  margin-bottom: 0;
}

.plan-hint {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: #555;
}

.plan-list-dragover {
  border-color: #0c5da5;
  background-color: #f0f6ff;
}

.card.dragging,
.plan-item.dragging {
  opacity: 1;
  cursor: grabbing;
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
}

.drag-origin-hidden {
  opacity: 0 !important;
  box-shadow: none !important;
}

.dragging-item-ghost {
  position: fixed;
  color: #fff;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(12, 93, 165, 0.3);
  font-size: 1rem;
  font-weight: 500;
  z-index: 9999;
  pointer-events: none;
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translate(-50%, -50%) scale(1.05);
}

.dragging-item-ghost-food {
  background-color: #e67e22;
}

.dragging-item-ghost-place {
  background-color: #27ae60;
}

.dragging-item-ghost-stay {
  background-color: #8e44ad;
}

.dragging-item-ghost-transport {
  background-color: #2980b9;
}

.dragging-item-ghost-note {
  background-color: #7f8c8d;
  font-size: 0.95rem;
}

.drag-origin-collapsed {
  height: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-top-width: 0 !important;
  border-bottom-width: 0 !important;
}

.btn {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border-radius: 0.4rem;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  text-decoration: none;
}

.btn-primary {
  background-color: #0c5da5;
  color: #fff;
}

.btn-secondary {
  background-color: #e0e4ea;
  color: #222;
}

.btn-icon {
  padding: 0.15rem;
  background-color: transparent;
  color: #666;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background-color: #f0f0f0;
  color: #0c5da5;
}

.btn-icon svg {
  width: 0.8rem;
  height: 0.8rem;
}

.btn:hover {
  opacity: 0.9;
}

.time-input-group {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.short-input {
  width: 100px !important;
  flex: none !important;
}

.form {
  background-color: #fff;
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.form-group {
  margin-bottom: 0.9rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border-radius: 0.35rem;
  border: 1px solid #c5c9d3;
  font-size: 0.95rem;
}

.form-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

fieldset {
  border: 1px solid #c5c9d3;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem 0.75rem;
  margin-bottom: 0.9rem;
}

legend {
  padding: 0 0.25rem;
  font-size: 0.95rem;
}

.map-section {
  margin-top: 1.5rem;
}

#map-container {
  width: 100%;
  height: 320px;
  border-radius: 0.5rem;
  border: 1px solid #c5c9d3;
  overflow: hidden;
}

.map-hint {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: #555;
}

.input-with-suffix {
  display: flex;
  align-items: center;
}

.input-with-suffix input {
  flex: 1;
}

.input-with-suffix .playtime-input {
  flex: 0 0 5rem;
}

.form-group .rating-input {
  width: 6rem;
}

.form-group .place-category-select {
  width: 12rem;
}

.form-group .meal-type-select {
  width: 10rem;
}

.rating-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.rating-option {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.95rem;
}

.rating-option input {
  margin-right: 0.15rem;
}

.input-suffix {
  margin-left: 0.3rem;
  font-size: 0.95rem;
  color: #555;
}

.floating-add-wrapper {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1000;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 0.5rem;
}

.floating-add-buttons {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.add-menu {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  max-height: 0;
  opacity: 0;
  transform: translateY(8px);
  overflow: hidden;
  pointer-events: none;
  transition: max-height 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
    opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
    transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.add-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.2rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.85rem;
}

.add-menu-item .add-menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  border: 1px solid #ffffffcc;
  margin-right: 0.25rem;
  font-weight: 600;
  background-color: transparent;
  color: #fff;
}

.add-menu-type-label {
  flex: 1;
}

.add-menu-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 0.4rem;
  background-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.add-menu-type-icon svg {
  width: 0.9rem;
  height: 0.9rem;
}

.add-menu-item-food {
  background-color: #e67e22;
}

.add-menu-item-place {
  background-color: #27ae60;
}

.add-menu-item-stay {
  background-color: #8e44ad;
}

.add-menu-item-transport {
  background-color: #2980b9;
}

.add-menu.open {
  max-height: 200px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background-color: #323232;
  color: #fff;
  padding: 0.75rem 1.2rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: auto;
  text-align: center;
  min-width: 200px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background-color: #d32f2f;
}

.toast.success {
  background-color: #2e7d32;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: #888;
  text-align: center;
  background-color: #fff;
  border-radius: 0.5rem;
  border: 1px dashed #c5c9d3;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state p {
  margin: 0;
  font-size: 1rem;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e0e4ea;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
  color: #0c5da5;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #888;
  padding: 0;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e0e4ea;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.transport-gap-item {
  margin-bottom: 1.5rem;
  border: 1px solid #e0e4ea;
  border-radius: 0.5rem;
  padding: 1rem;
  background-color: #f9fafb;
}

.transport-gap-title {
  font-weight: 600;
  margin-bottom: 0.8rem;
  color: #333;
}

.transport-option-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.transport-option-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem;
  border-radius: 0.3rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.transport-option-item:hover {
  background-color: #e0e4ea;
}

.transport-option-item input[type="radio"] {
  width: 1.1rem;
  height: 1.1rem;
}

.transport-option-details {
  display: flex;
  flex-direction: column;
}

.transport-option-name {
  font-weight: 500;
  font-size: 0.95rem;
}

.transport-option-meta {
  font-size: 0.85rem;
  color: #666;
}

.transport-gap-actions {
  margin-top: 1rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #c5c9d3;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  color: #555;
}

@media (max-width: 600px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .layout-main {
    flex-direction: column;
  }

  .card-list {
    grid-template-columns: 1fr;
  }

  .main-column {
    position: static;
    width: auto;
  }

  .side-column {
    margin-left: 0;
  }
}
