@layer property {
  .search-page {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 1rem;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
  }

  .search-page-header {
    grid-column: span 2;
    padding: 1rem;
    border: 1px solid #d3d3d3;
  }

  @media (max-width: 768px) {
    .search-page-header {
      grid-column: span 1;
    }
  }

  .search-page-header-result {
    display: flex;
    gap: 1rem;
    align-items: baseline;
  }

  .search-page-header-total {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--main-color);
  }

  .search-condition {
    font-size: 0.875rem;
  }

  .search-page-header-controls {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
    z-index: 99999;
  }

  .search-page-form-close {
    position: absolute;
    top: 0.5rem;
    right: 0.25rem;
  }

  @media (min-width: 768px) {
    .search-page-header-controls {
      display: none;
    }

    .search-page-form-close {
      display: none !important;
    }
  }

  @media (max-width: 768px) {
    .search-page-form {
      position: fixed;
      top: 100dvh;
      transition: top 0.3s ease-in-out;
      left: 0;
      right: 0;
      background-color: #fff;
      z-index: 100000;
      height: 100dvh;
      overflow-y: auto;
    }
    .search-page-form.active {
      top: 0;
    }
  }

  .pagination {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
  }

  .pagination-big-next {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ccc;
    font-size: 1.25rem;
    padding: 0.5rem 2rem;
    color: inherit;
    text-decoration: none;
  }

  .pagination-big-next:hover {
    background-color: rgb(from var(--main-color) r g b / 0.1);
  }

  .pagination-control {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
  }

  .pagination-control-button {
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    background-color: var(--text-contrast-color);
    cursor: pointer;
    font-size: 0.875rem;
    color: inherit;
    text-decoration: none;
  }

  .pagination-control-button:hover {
    background-color: rgb(from var(--main-color) r g b / 0.1);
  }

  .pagination-control-select {
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    background-color: var(--text-contrast-color);
    cursor: pointer;
    font-size: 0.875rem;
  }

  /* モーダルスタイル */
  .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
  }

  .modal-overlay[style*="opacity: 1"] {
    opacity: 1;
  }

  .modal-content {
    background-color: var(--text-contrast-color);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

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

  .modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
  }

  .modal-close-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    color: #6b7280;
  }

  .modal-close-button:hover {
    background-color: #f3f4f6;
    color: #374151;
  }

  .modal-close-icon {
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1;
  }

  .modal-body {
    padding: 1rem 1.5rem;
    flex: 1;
    overflow-y: auto;
    max-height: 60vh;
  }

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

  .modal-footer .button {
    min-width: 120px;
  }

  /* スピナー */
  .spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
  }

  .spinner-inner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid var(--main-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
  }

  .spinner-inner-inner {
    width: 100%;
    height: 100%;
  }

  @keyframes spin {
    0% {
      transform: rotate(0deg);
    }
    100% {
      transform: rotate(360deg);
    }
  }

  /* モーダル内のリストスタイル */
  .property-search-form-area1-modal-content-body-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
  }

  .property-search-form-area1-modal-content-body-list li {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
  }

  .property-search-form-area1-modal-content-body-list li:hover {
    background-color: rgb(from var(--main-color) r g b / 0.05);
  }

  .property-search-form-area1-modal-content-body-list input[type="checkbox"] {
    margin-right: 0.5rem;
  }

  /* モーダルグループリストスタイル */
  .modal-group-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .modal-group-item {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .modal-group-header {
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
  }

  .modal-group-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
    gap: 0.5em;
    position: relative;
    padding: 0.75rem 1rem;
  }

  .modal-group-label::before {
    content: "";
    display: block;
    width: 1em;
    height: 1em;
    border: 1px solid #ccc;
    border-radius: 0.25em;
    background-color: var(--text-contrast-color);
    flex-shrink: 0;
  }

  .modal-group-checkbox {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
  }

  .modal-group-checkbox:checked + .modal-group-label::before {
    background-color: var(--main-color);
    border-color: var(--main-color);
  }

  .modal-group-checkbox:indeterminate + .modal-group-label::before {
    background-color: var(--main-color);
    border-color: var(--main-color);
  }

  .modal-group-checkbox:checked + .modal-group-label::after {
    content: "";
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E")
      no-repeat center center;
    background-size: 100% 100%;
    position: absolute;
    width: 1em;
    height: 1em;
    top: 50%;
    left: calc(1rem + 0.5em + 1px);
    transform: translate(-50%, -50%);
    pointer-events: none;
  }

  .modal-group-checkbox:indeterminate + .modal-group-label::after {
    content: "";
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='4' y1='12' x2='20' y2='12'%3E%3C/line%3E%3C/svg%3E")
      no-repeat center center;
    background-size: 100% 100%;
    position: absolute;
    width: 1em;
    height: 1em;
    top: 50%;
    left: calc(1rem + 0.5em + 1px);
    transform: translate(-50%, -50%);
    pointer-events: none;
  }

  .modal-group-name {
    font-size: 0.95rem;
  }

  .modal-item-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
  }

  .modal-item {
    border-bottom: 1px solid #f3f4f6;
    border-right: 1px solid #f3f4f6;
  }

  .modal-item:nth-child(3n) {
    border-right: none;
  }

  .modal-item:nth-last-child(-n + 3) {
    border-bottom: none;
  }

  .modal-item-label {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    gap: 0.5em;
    position: relative;
  }

  .modal-item-label:hover {
    background-color: rgb(from var(--main-color) r g b / 0.05);
  }

  .modal-item-label::before {
    content: "";
    display: block;
    width: 1em;
    height: 1em;
    border: 1px solid #ccc;
    border-radius: 0.25em;
    background-color: var(--text-contrast-color);
    flex-shrink: 0;
  }

  .modal-item-checkbox {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
  }

  .modal-item-checkbox:checked + .modal-item-label::before {
    background-color: var(--main-color);
    border-color: var(--main-color);
  }

  .modal-item-checkbox:checked + .modal-item-label::after {
    content: "";
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E")
      no-repeat center center;
    background-size: 100% 100%;
    position: absolute;
    width: 1em;
    height: 1em;
    top: 50%;
    left: calc(1rem + 0.5em + 1px);
    transform: translate(-50%, -50%);
    pointer-events: none;
  }

  .modal-item-name {
    font-size: 0.9rem;
    color: var(--text-color);
  }

  .modal-item-count {
    font-size: 0.8rem;
    color: #6b7280;
    margin-left: auto;
  }

  /* disabled状態のスタイリング */
  .modal-item-disabled .modal-item-label {
    cursor: not-allowed;
    opacity: 0.5;
  }

  .modal-item-disabled .modal-item-checkbox {
    cursor: not-allowed;
  }

  .modal-item-disabled .modal-item-label:hover {
    background-color: transparent;
  }

  .modal-item-disabled .modal-item-label::before {
    background-color: #f3f4f6;
    border-color: #d1d5db;
  }

  .modal-item-disabled .modal-item-name {
    color: #9ca3af;
  }

  .modal-item-disabled .modal-item-count {
    color: #9ca3af;
  }

  /* レスポンシブ対応 */
  @media (max-width: 1024px) {
    .modal-content {
      width: 90vw;
      max-width: 700px;
    }

    .modal-item-list {
      grid-template-columns: repeat(2, 1fr);
    }

    .modal-item:nth-child(3n) {
      border-right: 1px solid #f3f4f6;
    }

    .modal-item:nth-child(2n) {
      border-right: none;
    }

    .modal-item:nth-last-child(-n + 3) {
      border-bottom: 1px solid #f3f4f6;
    }

    .modal-item:nth-last-child(-n + 2) {
      border-bottom: none;
    }
  }

  @media (max-width: 768px) {
    .modal-content {
      width: 95vw;
      margin: 1rem;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
      padding: 1rem;
    }

    .modal-footer {
      flex-direction: column;
    }

    .modal-footer .button {
      width: 100%;
    }

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

    .modal-item:nth-child(2n) {
      border-right: none;
    }

    .modal-item:nth-child(3n) {
      border-right: none;
    }

    .modal-item:nth-last-child(-n + 2) {
      border-bottom: 1px solid #f3f4f6;
    }

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

    .property-search-form-area1-modal-content-body-list {
      grid-template-columns: 1fr;
    }

    /* 路線・駅検索モーダルスタイル */
    .property-search-form-train-line-modal-content-body .modal-group-list,
    .property-search-form-train-station-modal-content-body .modal-group-list {
      list-style: none;
      padding: 0;
      margin: 0;
    }

    .property-search-form-train-line-modal-content-body .modal-group-list-items,
    .property-search-form-train-station-modal-content-body
      .modal-group-list-items {
      list-style: none;
      padding: 0;
      margin: 0;
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 0.5rem;
    }

    .property-search-form-train-line-modal-content-body .modal-group-list-item,
    .property-search-form-train-station-modal-content-body
      .modal-group-list-item {
      display: flex;
      align-items: center;
      padding: 0.5rem;
      border: 1px solid #e0e0e0;
      border-radius: 4px;
      cursor: pointer;
      transition: background-color 0.2s ease;
    }

    .property-search-form-train-line-modal-content-body
      .modal-group-list-item:hover,
    .property-search-form-train-station-modal-content-body
      .modal-group-list-item:hover {
      background-color: rgb(from var(--main-color) r g b / 0.05);
    }

    .property-search-form-train-line-modal-content-body input[type="checkbox"],
    .property-search-form-train-station-modal-content-body
      input[type="checkbox"] {
      margin-right: 0.5rem;
    }

    .property-search-form-train-line-modal-content-body .count,
    .property-search-form-train-station-modal-content-body .count {
      color: #666;
      font-size: 0.9em;
    }
  }

  /* 検索結果ヘッダー */
  .search-page-results-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 1rem;
  }

  @media (max-width: 768px) {
    .search-page-results-header {
      flex-direction: column;
      align-items: flex-start;
      gap: 0.5rem;
    }
  }

  .search-page-results-count {
    line-height: 1em;
    justify-self: flex-start;
  }

  /*
   * テナント物件検索ページのカスタムスタイル
   * Figmaデザインに基づいた左袖部分の調整
   */

  /* 検索結果エリア全体の左側余白 */
  .search-page-results {
    padding-left: 20px;
  }

  @media (max-width: 768px) {
    .search-page-results {
      padding-left: 0;
    }
  }

  /* 物件詳細テーブル */
  .results-list {
    width: 100%;
    max-width: 744px;
  }

  /* テーブル全体 */
  .results-list table,
  .results-list .table {
    width: 100%;
    border-collapse: collapse;
    background-color: #ffffff;
    border-radius: 4px;
    overflow: hidden;
  }

  /* テーブルヘッダー */
  .results-list th,
  .results-list .table-header {
    background-color: #f7f7f7;
    border: 1px solid #d3d3d3;
    padding: 10px 12px;
    font-family: "Noto Sans JP", sans-serif;
    font-weight: 700;
    font-size: 12px;
    line-height: 1.3em;
    color: #000000;
    text-align: center;
  }

  /* テーブルセル */
  .results-list td,
  .results-list .table-cell {
    border: 1px solid #d3d3d3;
    padding: 10px 12px;
    font-family: "Noto Sans JP", sans-serif;
    font-weight: 400;
    font-size: 12px;
    line-height: 1.3em;
    color: #000000;
    text-align: center;
    background-color: #ffffff;
  }

  /* 詳細を見るボタン */
  .results-list .detail-button {
    background-color: #ffffff;
    border: 1px solid #d3d3d3;
    border-radius: 6px;
    padding: 10px;
    font-family: "Noto Sans JP", sans-serif;
    font-weight: 500;
    font-size: 12px;
    line-height: 1.3em;
    color: #2880b8;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    width: 104px;
    cursor: pointer;
  }

  .results-list .detail-button:hover {
    background-color: #f5f5f5;
  }

  /* 検索ページ全体のレイアウト調整 */
  .search-page {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
  }

  @media (max-width: 768px) {
    .search-page {
      grid-template-columns: 1fr;
      gap: 1rem;
      padding: 1rem;
    }
  }

  /* レスポンシブデザイン */
  @media (min-width: 769px) {
    .search-page-form {
      width: 300px; /* PC版の左袖幅 */
    }
  }

  @media (max-width: 768px) {
    .search-page {
      grid-template-columns: 1fr; /* モバイルでは1カラム */
    }
    .search-page-form {
      width: 100%;
    }
  }
}
