/* Reset & Base */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #ffffff;
  --bg-card: #f8f8fa;
  --bg-card-hover: #f0f0f5;
  --bg-input: #f4f4f8;
  --border: #e0e0e8;
  --text: #1a1a2e;
  --text-dim: #666680;
  --text-muted: #999aaa;
  --accent: #f97316;
  --accent-hover: #ea6c0e;
  --accent-light: #fff7ed;
  --green: #16a34a;
  --red: #dc2626;
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* Header */
.header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
}

.header-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.avg-label {
  font-size: 12px;
  color: var(--text-dim);
}

.avg-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.avg-unit {
  font-size: 12px;
  color: var(--text-dim);
}

/* Search Section */
.search-section {
  padding: 24px 0 16px;
}

.search-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.search-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.tab {
  flex: 1;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}

.tab.active {
  background: var(--accent);
  color: #fff;
}

.search-panel {
  display: none;
}

.search-panel.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.select-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.select-group select {
  flex: 1;
  min-width: 120px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666680' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.select-group select:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-search {
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-search:hover {
  background: var(--accent-hover);
}

/* Average Prices */
.avg-section {
  padding: 8px 0 24px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.price-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.price-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  transition: all 0.2s;
}

.price-card:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.fuel-name {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.fuel-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.fuel-change {
  font-size: 12px;
  color: var(--text-muted);
}

.fuel-change.up {
  color: var(--red);
}

.fuel-change.down {
  color: var(--green);
}

.arrow-up, .arrow-down {
  font-size: 9px;
  vertical-align: middle;
  margin-right: 1px;
}

.arrow-up { color: var(--red); }
.arrow-down { color: var(--green); }

/* Results */
.results-section {
  padding: 0 0 40px;
}

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

.sort-group {
  display: flex;
  gap: 4px;
}

.sort-btn {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

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

.station-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.station-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.station-item:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.station-item:first-child {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.12);
}

.station-rank {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 28px;
  text-align: center;
}

.station-rank.top {
  color: var(--accent);
  font-size: 20px;
}

.station-info {
  flex: 1;
  min-width: 0;
}

.station-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-addr {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-brand {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-card);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

.station-price-area {
  text-align: right;
  min-width: 100px;
}

.station-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.station-price-unit {
  font-size: 11px;
  color: var(--text-dim);
}

.station-diff {
  font-size: 12px;
  margin-top: 2px;
}

.station-diff.cheap {
  color: var(--green);
}

.station-diff.expensive {
  color: var(--red);
}

/* Navigation Buttons (list) */
.station-navi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 52px;
}

.navi-btn {
  display: block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  color: #fff;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.navi-btn:hover {
  opacity: 0.85;
}

.navi-btn.kakao { background: #fee500; color: #1a1a1a; }
.navi-btn.naver { background: #03c75a; }
.navi-btn.copy {
  background: #e0e0e8;
  color: #1a1a2e;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.navi-btn.copy:hover { background: #d0d0d8; }
.navi-btn.copied { background: var(--accent); color: #fff; }
.navi-btn.share {
  background: #3b82f6;
  color: #fff;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.navi-btn.share:hover { background: #2563eb; }

/* Detail Navigation Group */
.detail-navi-group {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.detail-navi-group .btn-navi {
  flex: 1;
  text-align: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  transition: opacity 0.2s;
}

.detail-navi-group .btn-navi:hover {
  opacity: 0.85;
}

.kakao-bg { background: #fee500; color: #1a1a1a !important; }
.naver-bg { background: #03c75a; }
.copy-bg {
  background: #e0e0e8;
  color: #1a1a2e !important;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.copy-bg:hover { background: #d0d0d8; }
.copy-bg.copied { background: var(--accent); color: #fff !important; }

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 15px;
  margin-bottom: 16px;
}

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.chip {
  padding: 8px 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 480px;
  width: 100%;
  position: relative;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
}

/* Detail Modal */
.detail-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.detail-addr {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.detail-prices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.detail-price-item {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.detail-price-item .fuel-name {
  font-size: 12px;
  margin-bottom: 4px;
}

.detail-price-item .fuel-price {
  font-size: 18px;
}

.detail-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.detail-row .label {
  color: var(--text-dim);
}

.detail-row .value {
  font-weight: 500;
}

.detail-navi {
  margin-top: 20px;
  text-align: center;
}

.btn-navi {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s;
}

.btn-navi:hover {
  background: var(--accent-hover);
}

/* Loading */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.loading.hidden {
  display: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading p {
  font-size: 14px;
  color: var(--text-dim);
}

/* SR Only (accessibility) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Hero Section */
.hero {
  padding: 28px 0 20px;
  background: linear-gradient(135deg, #fff7ed 0%, #fff 60%);
  border-bottom: 1px solid var(--border);
}

.hero-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.hero-left {
  flex: 1;
}

.hero-label {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
  margin-bottom: 4px;
}

.hero-price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 4px;
}

.hero-number {
  font-size: 48px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -1px;
}

.hero-unit {
  font-size: 16px;
  color: var(--text-dim);
  font-weight: 500;
}

.hero-diff {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.hero-diff.up { color: var(--red); }
.hero-diff.down { color: var(--green); }

.hero-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.hero-right {
  min-width: 160px;
}

.hero-fuels {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero-fuel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.hf-name {
  font-size: 12px;
  color: var(--text-dim);
}

.hf-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

/* Hero Preview (인기 지역 TOP 3) */
.hero-preview {
  margin-top: 20px;
  display: none;
}

.hero-preview.show {
  display: block;
}

.preview-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.preview-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.preview-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.preview-card:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.preview-region {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

.preview-price {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
}

.preview-price-unit {
  font-size: 11px;
  color: var(--text-dim);
}

.preview-station {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Share Full Button (detail modal) */
.detail-share-group {
  margin-top: 12px;
  text-align: center;
}

.share-full-btn {
  width: 100%;
  padding: 12px;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.share-full-btn:hover {
  background: #2563eb;
}

/* Toast */
.toast {
  position: fixed;
  bottom: -60px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 999;
  transition: bottom 0.3s;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.toast.show {
  bottom: 24px;
}

/* Today Link Banner */
.today-link {
  padding: 16px 0;
}

.today-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--accent-light);
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
}

.today-banner:hover {
  border-color: var(--accent);
  background: #fff3e0;
}

.today-badge {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.today-text {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.today-arrow {
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
}

/* SEO Content */
.seo-content {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

.seo-content h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.seo-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.seo-item h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--accent);
}

.seo-item p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}

/* Footer */
.footer {
  padding: 24px 0;
  text-align: center;
  border-top: 1px solid var(--border);
  margin-top: 0;
}

.footer p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.8;
}

.footer a {
  color: var(--text-dim);
  text-decoration: none;
}

.footer a:hover {
  color: var(--accent);
}

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

  /* Header */
  .header {
    padding: 12px 0;
  }

  .header .container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .logo {
    font-size: 15px;
    gap: 6px;
  }

  .logo svg {
    width: 22px;
    height: 22px;
  }

  .avg-value {
    font-size: 17px;
  }

  /* Search */
  .search-section {
    padding: 16px 0 12px;
  }

  .search-bar {
    padding: 14px;
  }

  .search-tabs {
    margin-bottom: 12px;
  }

  .tab {
    padding: 8px 10px;
    font-size: 13px;
  }

  .select-group {
    flex-direction: column;
    gap: 6px;
  }

  .select-group select {
    min-width: 100%;
    padding: 12px;
    font-size: 15px;
  }

  .btn-search {
    padding: 12px;
    font-size: 15px;
  }

  /* Price Cards */
  .avg-section {
    padding: 4px 0 16px;
  }

  .section-title {
    font-size: 14px;
    margin-bottom: 10px;
  }

  .price-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .price-card {
    padding: 12px 8px;
  }

  .fuel-name {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .fuel-price {
    font-size: 18px;
  }

  .fuel-change {
    font-size: 11px;
  }

  /* Station Cards - Mobile Layout */
  .station-list {
    gap: 6px;
  }

  .station-item {
    padding: 12px;
    gap: 10px;
    flex-wrap: wrap;
    position: relative;
  }

  .station-rank {
    min-width: 22px;
    font-size: 13px;
  }

  .station-info {
    flex: 1;
    min-width: 0;
  }

  .station-name {
    font-size: 14px;
    white-space: normal;
    line-height: 1.3;
  }

  .station-addr {
    font-size: 11px;
    white-space: normal;
  }

  .station-brand {
    font-size: 10px;
    padding: 1px 6px;
  }

  .station-price-area {
    min-width: auto;
    text-align: right;
  }

  .station-price {
    font-size: 18px;
  }

  .station-price-unit {
    font-size: 10px;
  }

  .station-diff {
    font-size: 11px;
  }

  /* Navi buttons - horizontal on mobile */
  .station-navi {
    width: 100%;
    flex-direction: row;
    gap: 6px;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }

  .navi-btn {
    flex: 1;
    padding: 8px 4px;
    font-size: 12px;
    border-radius: 6px;
  }

  /* Sort buttons */
  .results-header {
    margin-bottom: 10px;
  }

  .sort-btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  /* Modal */
  .modal {
    padding: 0;
    align-items: flex-end;
  }

  .modal-content {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 16px 16px 0 0;
    padding: 20px 16px;
  }

  .detail-title {
    font-size: 17px;
    padding-right: 30px;
  }

  .detail-addr {
    font-size: 12px;
    margin-bottom: 16px;
  }

  .detail-prices {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 16px;
  }

  .detail-price-item {
    padding: 10px;
  }

  .detail-price-item .fuel-price {
    font-size: 16px;
  }

  .detail-row {
    font-size: 13px;
    padding: 6px 0;
  }

  .detail-navi-group {
    gap: 6px;
    margin-top: 16px;
  }

  .detail-navi-group .btn-navi {
    padding: 12px 8px;
    font-size: 13px;
    border-radius: 8px;
  }

  /* Hero */
  .hero {
    padding: 20px 0 16px;
  }

  .hero-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .hero-number {
    font-size: 40px;
  }

  .hero-right {
    width: 100%;
    min-width: auto;
  }

  .hero-fuels {
    flex-direction: row;
    gap: 6px;
  }

  .hero-fuel {
    flex: 1;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    text-align: center;
  }

  .preview-cards {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .preview-card {
    padding: 10px 6px;
  }

  .preview-price {
    font-size: 16px;
  }

  .preview-station {
    display: none;
  }

  /* SEO sections */

  .seo-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .seo-content {
    padding: 24px 0;
  }

  .seo-content h2 {
    font-size: 16px;
  }

  .seo-item {
    padding: 14px;
  }

  /* Footer */
  .footer {
    margin-top: 0;
    padding: 16px 0;
  }

  .footer p {
    font-size: 11px;
  }

  /* Empty state */
  .empty-state {
    padding: 40px 16px;
  }

  .empty-state svg {
    width: 48px;
    height: 48px;
  }

  .empty-state p {
    font-size: 13px;
  }
}
