@import '../base/variables.css';

.place-page {
  min-height: 100vh;
  background: var(--bg-primary, #f8f9fa);
  color: var(--text-primary, #212529);
}

[data-theme='dark'] .place-page {
  background: var(--bg-primary, #121212);
  color: var(--text-primary, #e0e0e0);
}

.place-search {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-secondary, white);
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

[data-theme='dark'] .place-search {
  background: var(--bg-secondary, #1e1e1e);
}

.search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  position: relative;
}

.search-bar__main {
  flex: 1;
  min-width: 280px;
  display: flex;
  align-items: center;
  background: var(--bg-tertiary, #f0f2f5);
  border-radius: 12px;
  padding: 10px 16px;
  gap: 12px;
}

[data-theme='dark'] .search-bar__main {
  background: var(--bg-tertiary, #2a2a2a);
}

.search-bar__icon {
  color: var(--text-secondary, #6c757d);
  font-size: 18px;
}

.search-bar__input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
}

.search-bar__input::placeholder {
  color: var(--text-secondary);
}

.search-bar__clear {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
  transition: color 0.2s;
}

.search-bar__clear:hover {
  color: var(--text-primary);
}

.search-bar__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-bar__location,
.search-bar__filter {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg-tertiary, #f0f2f5);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
  position: relative;
}

[data-theme='dark'] .search-bar__location,
[data-theme='dark'] .search-bar__filter {
  background: var(--bg-tertiary, #2a2a2a);
}

.search-bar__location:hover,
.search-bar__filter:hover {
  background: var(--accent-primary, #ff6b35);
  color: white;
}

.search-bar__location.active {
  background: var(--accent-primary, #ff6b35);
  color: white;
}

.search-bar__filter.active {
  background: var(--accent-primary, #ff6b35);
  color: white;
}

.filter-count {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: #dc3545;
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-bar__area {
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--bg-tertiary, #f0f2f5);
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  outline: none;
}

[data-theme='dark'] .search-bar__area {
  background: var(--bg-tertiary, #2a2a2a);
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary, white);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  margin-top: 8px;
  overflow: hidden;
  z-index: 101;
}

[data-theme='dark'] .search-suggestions {
  background: var(--bg-secondary, #1e1e1e);
}

.search-suggestions__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.search-suggestions__item:hover {
  background: var(--bg-tertiary, #f0f2f5);
}

[data-theme='dark'] .search-suggestions__item:hover {
  background: var(--bg-tertiary, #2a2a2a);
}

.search-suggestions__item i {
  color: var(--text-secondary);
}

.suggestion-type {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-tertiary, #f0f2f5);
  padding: 2px 8px;
  border-radius: 4px;
}

[data-theme='dark'] .suggestion-type {
  background: var(--bg-tertiary, #2a2a2a);
}

.filter-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary, white);
  border-radius: 0 0 16px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 102;
  max-height: 80vh;
  overflow-y: auto;
}

[data-theme='dark'] .filter-panel {
  background: var(--bg-secondary, #1e1e1e);
}

.filter-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color, #dee2e6);
}

[data-theme='dark'] .filter-panel__header {
  border-color: var(--border-color, #333);
}

.filter-panel__header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.filter-panel__close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

.filter-panel__content {
  padding: 20px;
}

.filter-group {
  margin-bottom: 20px;
}

.filter-group:last-child {
  margin-bottom: 0;
}

.filter-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 0;
}

.filter-checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary, #ff6b35);
}

.filter-checkbox span {
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rating-filter {
  display: flex;
  gap: 8px;
}

.rating-star {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.rating-star.active {
  color: #ffd700;
}

.price-filter {
  display: flex;
  gap: 8px;
}

.price-btn {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  background: var(--bg-tertiary, #f0f2f5);
  border: 2px solid transparent;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

[data-theme='dark'] .price-btn {
  background: var(--bg-tertiary, #2a2a2a);
}

.price-btn.active {
  background: var(--accent-primary, #ff6b35) 15;
  border-color: var(--accent-primary, #ff6b35);
  color: var(--accent-primary, #ff6b35);
}

.amenity-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.filter-panel__footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-color, #dee2e6);
}

[data-theme='dark'] .filter-panel__footer {
  border-color: var(--border-color, #333);
}

.filter-panel__footer button {
  flex: 1;
}

.place-categories {
  background: var(--bg-secondary, white);
  border-bottom: 1px solid var(--border-color, #dee2e6);
}

[data-theme='dark'] .place-categories {
  background: var(--bg-secondary, #1e1e1e);
  border-color: var(--border-color, #333);
}

.categories-scroll {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.categories-scroll::-webkit-scrollbar {
  display: none;
}

.category-tab {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 20px;
  background: var(--bg-tertiary, #f0f2f5);
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

[data-theme='dark'] .category-tab {
  background: var(--bg-tertiary, #2a2a2a);
}

.category-tab:hover {
  background: var(--accent-primary, #ff6b35) 15;
  color: var(--accent-primary, #ff6b35);
}

.category-tab.active {
  background: var(--accent-primary, #ff6b35);
  color: white;
}

.place-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px;
  background: var(--bg-secondary, white);
  margin: 0 0 16px 0;
}

[data-theme='dark'] .place-results-header {
  background: var(--bg-secondary, #1e1e1e);
}

.results-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.results-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.results-count {
  font-size: 14px;
  color: var(--text-secondary);
}

.results-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.sort-dropdown {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-dropdown label {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.sort-dropdown select {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-tertiary, #f0f2f5);
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  outline: none;
}

[data-theme='dark'] .sort-dropdown select {
  background: var(--bg-tertiary, #2a2a2a);
}

.btn-map {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--accent-primary, #ff6b35);
  border: none;
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-map:hover {
  background: var(--accent-primary-dark, #e55a2b);
  transform: translateY(-1px);
}

.place-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 0 16px 24px 16px;
}

.place-card {
  background: var(--bg-secondary, white);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

[data-theme='dark'] .place-card {
  background: var(--bg-secondary, #1e1e1e);
}

.place-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.place-card__image {
  position: relative;
  height: 180px;
  overflow: hidden;
  background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
}

.place-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

/* カテゴリ別フォールバック背景 */
.place-card__image[data-category='cafe']::before {
  content: '\F331';
  font-family: 'bootstrap-icons';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 64px;
  color: rgba(139, 69, 19, 0.15);
  z-index: 0;
}

.place-card__image[data-category='restaurant']::before {
  content: '\F5CF';
  font-family: 'bootstrap-icons';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 64px;
  color: rgba(220, 53, 69, 0.15);
  z-index: 0;
}

.place-card__image[data-category='park']::before {
  content: '\F820';
  font-family: 'bootstrap-icons';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 64px;
  color: rgba(40, 167, 69, 0.15);
  z-index: 0;
}

.place-card__image[data-category='shopping']::before {
  content: '\F109';
  font-family: 'bootstrap-icons';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 64px;
  color: rgba(255, 193, 7, 0.15);
  z-index: 0;
}

.place-card__image[data-category='tourist']::before {
  content: '\F2A5';
  font-family: 'bootstrap-icons';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 64px;
  color: rgba(23, 162, 184, 0.15);
  z-index: 0;
}

.place-card__image[data-category='bar']::before {
  content: '\F34B';
  font-family: 'bootstrap-icons';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 64px;
  color: rgba(111, 66, 193, 0.15);
  z-index: 0;
}

.place-card__image img {
  position: relative;
  z-index: 1;
}

/* 画像読み込みエラー時のスタイル */
.place-card__image img[src$='place-default.jpg'],
.place-card__image img.error {
  opacity: 0;
}

.place-card:hover .place-card__image img {
  transform: scale(1.05);
}

.place-card__badges {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.badge--rating {
  background: rgba(0, 0, 0, 0.7);
  color: white;
}

.badge--rating i {
  color: #ffd700;
}

.badge--distance {
  background: rgba(0, 0, 0, 0.7);
  color: white;
}

.badge--new {
  background: #dc3545;
  color: white;
}

.badge--want-to-go {
  background: rgba(255, 107, 53, 0.85);
  color: white;
}

.badge--want-to-go i {
  font-size: 11px;
}

.place-card__favorite {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
}

.place-card__favorite:hover {
  transform: scale(1.1);
}

.place-card__favorite.active {
  color: #ff4757;
}

.place-card__content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 140px;
}

.place-card__name {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-card__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  min-height: 24px;
}

.place-card__category {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.place-card__category i {
  font-size: 14px;
}

.place-card__price {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.place-card__status {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.place-card__status.open {
  background: #28a74520;
  color: #28a745;
}

.place-card__status.closed {
  background: #6c757d20;
  color: #6c757d;
}

.place-card__location {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.4;
}

.place-card__location i {
  flex-shrink: 0;
  font-size: 14px;
}

.place-card__stats {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
}

.place-card__stats i {
  font-size: 14px;
}

.place-loading,
.place-empty,
.place-error {
  padding: 60px 20px;
  text-align: center;
}

.loading-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 0 16px;
}

.skeleton-card {
  height: 320px;
  border-radius: 16px;
  background: linear-gradient(
    90deg,
    var(--bg-tertiary, #f0f2f5) 25%,
    var(--bg-secondary, white) 50%,
    var(--bg-tertiary, #f0f2f5) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

/* skeleton-loading: uses toko-shimmer from loading-system.css */

.place-empty i,
.place-error i {
  font-size: 64px;
  color: var(--text-secondary);
  opacity: 0.5;
  margin-bottom: 16px;
}

.place-empty h3,
.place-error h3 {
  margin: 0 0 8px 0;
  font-size: 20px;
  color: var(--text-primary);
}

.place-empty p,
.place-error p {
  margin: 0 0 24px 0;
  color: var(--text-secondary);
}

.place-load-more {
  display: flex;
  justify-content: center;
  padding: 24px 16px 48px 16px;
}

.btn-load-more {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: 24px;
  background: var(--bg-secondary, white);
  border: 2px solid var(--accent-primary, #ff6b35);
  color: var(--accent-primary, #ff6b35);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

[data-theme='dark'] .btn-load-more {
  background: var(--bg-secondary, #1e1e1e);
}

.btn-load-more:hover:not(:disabled) {
  background: var(--accent-primary, #ff6b35);
  color: white;
  transform: translateY(-2px);
}

.btn-load-more:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.place-loading-more {
  display: flex;
  justify-content: center;
  padding: 24px;
}

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--bg-tertiary, #f0f2f5);
  border-top-color: var(--accent-primary, #ff6b35);
  border-radius: 50%;
  animation: toko-spin 0.8s linear infinite;
}

.spin {
  animation: toko-spin 0.8s linear infinite;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-primary, #ff6b35);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: var(--accent-primary-dark, #e55a2b);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--accent-primary, #ff6b35);
  border: 2px solid var(--accent-primary, #ff6b35);
  padding: 10px 22px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--accent-primary, #ff6b35);
  color: white;
}

[x-cloak] {
  display: none !important;
}

@media (max-width: 1400px) {
  .place-grid,
  .loading-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1024px) {
  .place-grid,
  .loading-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .search-bar__main {
    min-width: 100%;
  }

  .search-bar__actions {
    width: 100%;
    justify-content: space-between;
  }

  .search-bar__area {
    flex: 1;
  }

  .place-results-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .results-actions {
    width: 100%;
    justify-content: space-between;
  }

  .place-grid,
  .loading-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .place-card {
    display: flex;
    flex-direction: row;
    height: auto;
  }

  .place-card__image {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
  }

  .place-card__badges {
    flex-direction: column;
    gap: 4px;
  }

  .place-card__favorite {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .place-card__content {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .place-card__name {
    font-size: 15px;
    margin-bottom: 6px;
  }

  .btn-map span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
