:root {
  --bg-primary: #121418;
  --bg-secondary: #1a1d24;
  --bg-card: #222630;
  --bg-card-hover: #2b303c;
  --text-main: #f0f3f8;
  --text-muted: #8e99a8;
  --text-sub: #adb5bd;
  --accent-ride: #ff6b35;
  --accent-kakao: #fee500;
  --accent-google: #4285f4;
  --accent-green: #00e676;
  --accent-daeun: #ff758f;
  --border-color: rgba(255, 255, 255, 0.08);
  --sidebar-width: 420px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* Sidebar (PC) */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 20;
  box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  padding: 16px 20px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #ff6b35, #ff3d00);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(255,107,53,0.3);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  background: rgba(255,107,53,0.2);
  color: var(--accent-ride);
  border-radius: 4px;
  font-weight: 600;
}

/* Date Selector & Stats Section */
.timeline-control-panel {
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.date-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.date-select {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.date-select:focus {
  border-color: var(--accent-ride);
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-ride);
}

/* Stats Summary Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
  border: 1px solid var(--border-color);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.stat-value small {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 2px;
}

/* Timeline Feed List */
.timeline-feed {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-feed::-webkit-scrollbar {
  width: 6px;
}

.timeline-feed::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
}

.timeline-item {
  position: relative;
  display: flex;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.timeline-item:hover {
  transform: translateX(4px);
}

.item-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 28px;
  flex-shrink: 0;
}

.item-node {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.item-node.ride {
  background: linear-gradient(135deg, #ff6b35, #ff3d00);
  color: white;
}

.item-node.visit {
  background: #3a86ff;
  color: white;
}

.item-node.home {
  background: #8338ec;
  color: white;
}

.item-line {
  flex: 1;
  width: 2px;
  background: rgba(255,255,255,0.12);
  margin-top: 4px;
  min-height: 24px;
}

.item-card {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 14px;
  transition: background 0.2s, border-color 0.2s;
}

.timeline-item.active .item-card {
  border-color: var(--accent-ride);
  background: var(--bg-card-hover);
}

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

.card-time {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.card-type-tag {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.tag-ride {
  background: rgba(255,107,53,0.15);
  color: #ff8c5a;
}

.tag-visit {
  background: rgba(58,134,255,0.15);
  color: #70a5ff;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.card-subtext {
  font-size: 0.8rem;
  color: var(--text-sub);
}

/* Map Area */
.map-container {
  flex: 1;
  height: 100vh;
  position: relative;
  background: #0f1115;
  overflow: hidden;
}

#map-view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Floating Controls on Map */
.map-floating-bar {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 15;
  display: flex;
  gap: 10px;
  align-items: center;
}

.engine-switch {
  display: flex;
  background: rgba(26, 29, 36, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.btn-engine {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-engine.active {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.btn-engine.active[data-engine="kakao"] {
  color: #111;
  background: var(--accent-kakao);
}

.btn-engine.active[data-engine="google"] {
  color: white;
  background: var(--accent-google);
}

.btn-share {
  background: linear-gradient(135deg, #ff758f, #ff4d6d);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 16px rgba(255, 77, 109, 0.35);
  transition: transform 0.2s;
}

.btn-share:hover {
  transform: translateY(-2px);
}

/* Share Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 90%;
  max-width: 480px;
  padding: 24px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
}

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

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.form-input {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.share-link-box {
  background: var(--bg-primary);
  border: 1px dashed var(--accent-daeun);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.share-link-text {
  font-size: 0.85rem;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile Bottom Sheet */
.mobile-bottom-sheet {
  display: none;
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    display: none; /* 모바일에서는 바텀 시트로 대체 */
  }

  .map-container {
    height: 100vh;
    width: 100vw;
  }

  .map-floating-bar {
    top: 12px;
    right: 12px;
    left: 12px;
    justify-content: space-between;
  }

  .mobile-bottom-sheet {
    display: flex;
    flex-direction: column;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 380px;
    max-height: 85vh;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    z-index: 30;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.5);
    transform: translateY(calc(100% - 72px));
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .mobile-bottom-sheet.expanded {
    transform: translateY(0);
  }

  .sheet-handle-bar {
    width: 100%;
    padding: 12px 0 6px 0;
    display: flex;
    justify-content: center;
    cursor: pointer;
  }

  .sheet-handle {
    width: 44px;
    height: 5px;
    background: rgba(255,255,255,0.25);
    border-radius: 3px;
  }

  .sheet-header-summary {
    padding: 0 18px 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .sheet-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px 18px;
  }
}

/* Edit Guide Banner & Toast */
.edit-guide-banner {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26, 29, 36, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--accent-ride);
  border-radius: 30px;
  padding: 8px 18px;
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: #fff;
  z-index: 25;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: fadeInDown 0.3s ease;
}

.edit-guide-banner.show {
  display: flex;
}

.edit-guide-banner .guide-icon {
  font-size: 1.1rem;
  animation: pulse 1.5s infinite;
}

.btn-close-banner {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 6px;
  border-radius: 50%;
}
.btn-close-banner:hover {
  color: #fff;
}

.toast-popup {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(18, 20, 24, 0.95);
  border: 1px solid var(--accent-green);
  border-radius: 12px;
  padding: 12px 24px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-popup.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Active Editing Item Card Highlight */
.timeline-item.active-editing .item-card {
  border-color: var(--accent-ride);
  background: rgba(255, 107, 53, 0.08);
  box-shadow: 0 0 16px rgba(255, 107, 53, 0.25);
}

.timeline-item.active-editing .item-node {
  box-shadow: 0 0 12px var(--accent-ride);
  transform: scale(1.15);
}

.card-action-bar {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.btn-card-action {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background 0.2s, border-color 0.2s;
}

.btn-card-action:hover {
  background: rgba(255,107,53,0.15);
  border-color: var(--accent-ride);
  color: var(--accent-ride);
}

.btn-card-action.active {
  background: var(--accent-ride);
  color: #fff;
  border-color: var(--accent-ride);
}

/* Search Modal Results */
.search-results-list {
  max-height: 280px;
  overflow-y: auto;
  margin-top: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-card);
}

.search-result-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.2s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: var(--bg-card-hover);
}

.search-result-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-kakao);
  margin-bottom: 2px;
}

.search-result-addr {
  font-size: 0.75rem;
  color: var(--text-muted);
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
