/*
 * Google Maps カスタムスタイル
 * Version: 1.0.0
 */

/* ========================================
 * ページ全体のリセット
 * ======================================== */
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Elementorのデフォルトパディングを削除 */
.elementor-section {
  margin: 0 !important;
  padding: 0 !important;
}

.elementor-container {
  margin: 0 !important;
  padding: 0 !important;
}

/* ========================================
 * レイアウトスタイル
 * ======================================== */

/* サイドバー付きレイアウト */
#main-container {
  display: flex;
  flex-direction: row;
  width: 100%;
  margin: 0;
  padding: 0;
}

#map-container {
  flex: 3;
  height: 100vh;
  margin: 0;
  padding: 0;
}

#map {
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
}

#sidebar-container {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  height: 100vh;
}

/* 地図のみのレイアウト */
#map-only-container {
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
  position: relative;
}

#map-only-container #map {
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
}

/* ========================================
 * ポップアップスタイル
 * ======================================== */
#map-sidebar-popup {
  width: 100%;
  max-width: 500px;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

#map-sidebar-popup h3 {
  font-size: 1.5rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 20px;
  color: #333;
}

/* ========================================
 * 検索セクション
 * ======================================== */
.search-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
}

.search-field {
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #f8f9fa;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.search-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: #333;
}

.search-field input,
.search-field select {
  width: 100%;
  max-width: 250px;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  margin-bottom: 10px;
}

/* 検索タブ */
.search-tabs {
  display: flex;
  margin-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
}

.search-tab {
  flex: 1;
  padding: 10px 5px;
  text-align: center;
  cursor: pointer;
  background: #f8f9fa;
  border: none;
  border-bottom: 2px solid transparent;
  font-weight: bold;
  font-size: 12px;
  transition: all 0.3s ease;
}

.search-tab.active {
  background: #007bff;
  color: white;
  border-bottom-color: #007bff;
}

.search-tab:hover {
  background: #e9ecef;
}

.search-tab.active:hover {
  background: #0056b3;
}

.search-content {
  display: none;
}

.search-content.active {
  display: block;
}

/* ========================================
 * ボタンスタイル
 * ======================================== */
.center-button {
  text-align: center;
  margin-bottom: 30px;
}

.hover-button {
  margin-top: 10px;
  padding: 8px 16px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
  font-size: 14px;
  min-width: 120px;
}

.hover-button:hover {
  background-color: #0056b3;
  transform: scale(1.05);
}

/* ========================================
 * 商品カードスタイル
 * ======================================== */
.product-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: space-between;
}

.product-card {
  flex: 1 1 calc(50% - 5px);
  cursor: pointer;
  padding: 15px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: #f8f9fa;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition: transform 0.2s;
  font-size: 12px;
  line-height: 1.2;
}

.product-card:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* ========================================
 * InfoWindowスタイル
 * ======================================== */
.gm-ui-hover-effect {
  background-color: white !important;
  border: none !important;
  border-radius: 50% !important;
  width: 24px !important;
  height: 24px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer;
  position: relative !important;
  z-index: 1000 !important;
  transform: translate(-3px, 3px) !important;
  opacity: 1 !important;
}

.gm-style-iw-d {
  padding: 15px !important;
}

.gm-style-iw {
  padding: 0 !important;
}

/* ========================================
 * スクロールインジケーター
 * ======================================== */
.scroll-container {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -20%);
  width: 24px;
  height: 24px;
  z-index: 100;
}

.chevron {
  position: absolute;
  width: 28px;
  height: 8px;
  opacity: 0;
  transform: scale3d(0.5, 0.5, 0.5);
  animation: move 3s ease-out infinite;
}

.chevron:first-child {
  animation: move 3s ease-out 1s infinite;
}

.chevron:nth-child(2) {
  animation: move 3s ease-out 2s infinite;
}

.chevron:before,
.chevron:after {
  content: " ";
  position: absolute;
  top: 0;
  height: 100%;
  width: 51%;
  background: navy;
}

.chevron:before {
  left: 0;
  transform: skew(0deg, 30deg);
}

.chevron:after {
  right: 0;
  width: 50%;
  transform: skew(0deg, -30deg);
}

@keyframes move {
  25% {
    opacity: 1;
  }
  33% {
    opacity: 1;
    transform: translateY(30px);
  }
  67% {
    opacity: 1;
    transform: translateY(40px);
  }
  100% {
    opacity: 0;
    transform: translateY(55px) scale3d(0.5, 0.5, 0.5);
  }
}

/* ========================================
 * レスポンシブデザイン（モバイル）
 * ======================================== */
@media (max-width: 768px) {
  /* body全体のパディングをリセット */
  body {
    padding-top: 0 !important;
  }

  /* ヘッダーがある場合の調整 */
  .site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
  }

  #main-container {
    flex-direction: column;
    margin-top: 0;
    padding-top: 0;
  }

  #map-container {
    width: 100%;
    height: 100vh;
    margin: 0;
    padding: 0;
  }

  #map {
    height: 100vh;
  }

  #sidebar-container {
    width: 100%;
    height: auto;
    margin-top: 10px;
  }

  #map-only-container {
    height: 100vh;
    margin: 0;
    padding: 0;
  }

  #map-only-container #map {
    height: 100vh;
  }

  #map-sidebar-popup {
    max-width: 95vw;
    padding: 15px;
    margin: 10px;
  }

  .search-section {
    gap: 15px;
  }

  .search-field {
    padding: 12px;
  }

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

  /* スクロールインジケーターを非表示 */
  .scroll-container {
    display: none !important;
  }

  /* Elementorのモバイル用調整 */
  .elementor-widget-wrap {
    padding: 0 !important;
  }

  /* iOSのセーフエリア対応 */
  @supports (padding: max(0px)) {
    #map-container,
    #map-only-container {
      padding-top: env(safe-area-inset-top);
      height: calc(100vh - env(safe-area-inset-top));
    }
  }
}

/* ========================================
 * PC表示の調整
 * ======================================== */
@media (min-width: 768px) {
  .scroll-container {
    display: none !important;
  }
}

@media (max-width: 768px) {
  /* すべての不要なマージン・パディングをリセット */
  body,
  html {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    height: 100vh !important;
  }

  /* WordPress管理バー非表示 
            #wpadminbar {
                display: none !important;
            }*/

  /* Elementorのヘッダーを非表示（地図専用ページの場合） 
            body.page-template-default .elementor-location-header {
                display: none !important;
            }*/

  /* または、ヘッダーを表示したい場合 */
  body.page-template-default .elementor-location-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
    height: 50px !important; /* 実際の高さに調整 */
  }

  /* 地図コンテナの調整 */
  #map-container,
  #map-only-container {
    position: fixed !important;
    top: 0 !important; /* ヘッダーがある場合は 50px に変更 */
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important; /* ヘッダーがある場合は calc(100vh - 50px) に変更 */
    margin: 0 !important;
    padding: 0 !important;
  }

  #map {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Elementorコンテナのリセット 
            .elementor-section,
            .elementor-container,
            .elementor-widget-wrap,
            .elementor-column,
            .elementor-widget {
                margin: 0 !important;
                padding: 0 !important;
            }*/

  /* メインコンテンツエリアの調整 */
  #content,
  .site-content,
  main {
    margin: 0 !important;
    padding: 0 !important;
  }
}
