/* 物件一覧ページのスタイル */
.property-list-main-body {
    width: 100%;
    height: calc(100vh - 120px); /* ビューポートの高さから余白を引いた高さ */
    background: #fff;
    border-radius: 0 0 10px 10px;
    padding: 5px 10px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

/* 検索フォームのコンテナ */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 5px;
    background-color: #fff;
    position: sticky;
    top: 0;
    z-index: 2;
}

/* 検索フォーム共通スタイル */
.search-form {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-grow: 1;
    max-width: 500px;
}

/* 入力フィールド共通スタイル */
.search-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    width: 100%;
}

/* クリアボタンのスタイル */
.clear-button {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    background-color: #f0f0f0;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.clear-button:hover {
    background-color: #ff6b6b;
    color: white;
}

.clear-button i {
    font-size: 14px;
}

/* 検索コンテナ（検索フォームとクリアボタンをグループ化） */
.property-search-container {
    display: flex;
    width: 100%;
    margin: 5px 0;
}

.property-search-container .search-form {
    flex: 1;
    min-width: 0;
}

.property-search-container .clear-button {
    flex-shrink: 0;
    white-space: nowrap;
}

.search-button {
    padding: 8px 12px;
    background-color: #d9d8d8;
    color: #333;
    border: none;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    font-size: 14px;
}

.search-button:hover {
    background-color: #0AA273;
    color: white;
}

/* テーブルコンテナ */
.property-list-container {
    flex: 1;
    overflow: auto; /* コンテナ全体でスクロール可能に */
}

/* テーブルの基本スタイル */
.property-list-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* 固定レイアウトを設定 */
}

/* テーブルヘッダー */
.property-list-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: #333333;
}

/* カラム幅の設定 */
.property-list-table th:nth-child(1),
.property-list-table td:nth-child(1) { width: 15%; } /* 物件名 */

.property-list-table th:nth-child(2),
.property-list-table td:nth-child(2) { width: 15%; } /* 会員名 */

.property-list-table th:nth-child(3),
.property-list-table td:nth-child(3) { width: 25%; } /* 所在地 */

.property-list-table th:nth-child(4),
.property-list-table td:nth-child(4) { width: 8%; } /* 号室 */

.property-list-table th:nth-child(5),
.property-list-table td:nth-child(5) { width: 12%; } /* 庭の広さ */

.property-list-table th:nth-child(6),
.property-list-table td:nth-child(6) { width: 15%; } /* 植栽・設備の種類 */

.property-list-table th:nth-child(7),
.property-list-table td:nth-child(7) { width: 10%; } /* 前回受注日 */

/* セルの共通スタイル */
.property-list-table th, 
.property-list-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #ddd;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* テーブルヘッダー特有のスタイル */
.property-list-table th {
    background-color: #333333;
    color: white;
    font-weight: normal;
}

/* ソート可能なヘッダーのスタイル */
.property-list-table th.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 25px; /* アイコン用のスペース */
}

.property-list-table th.sortable .sort-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.property-list-table th.sortable:hover {
    background-color: #444;
}

.property-list-table tbody tr {
    transition: background-color 0.2s ease;
}

.property-list-table tbody tr:hover {
    background-color: #f9f9f9;
}

/* 会員IDセルの右寄せ */
.property-list-table td.member-id-cell {
    text-align: right;
}

/* リンクを持つセルのみカーソルをポインタにする */
.property-name-cell,
.member-name-cell,
.address-cell,
.garden-size-cell[data-has-image="true"] {
    cursor: pointer;
}

/* 他のセルはデフォルトカーソル */
.room-number-cell,
.plants-equipment-cell,
.last-service-date-cell,
.garden-size-cell[data-has-image="false"] {
    cursor: default;
}

/* 物件名と会員名のリンクスタイル */
.property-name-cell a, .member-name-cell a {
    color: #4a90e2;
    text-decoration: none;
}

.property-name-cell a:hover, .member-name-cell a:hover {
    text-decoration: underline;
}

/* 住所リンクスタイル */
.address-cell a {
    color: #4a90e2;
    text-decoration: none;
    display: block;
}

.address-cell a:hover {
    text-decoration: underline;
}

/* 庭の広さセルのスタイル（画像アイコン付き） */
.garden-size-cell {
    position: relative;
}

.garden-size-cell[data-has-image="true"] {
    color: #4a90e2;
}

.image-indicator {
    margin-left: 5px;
    font-size: 16px;
}

/* モーダルスタイル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
}

.modal-content {
    position: relative;
    background-color: #fff;
    margin: 10% auto;
    padding: 20px;
    max-width: 50%;
    max-height: 80%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.close {
    position: absolute;
    top: 10px;
    right: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #333;
}

#garden-image {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
}

/* 結果なしメッセージ */
.no-results {
    text-align: center;
    color: #888;
    padding: 20px;
    font-size: 16px;
}

/* テーブルカラム幅の調整 */
.property-list-table th.property-name {
    min-width: 120px;
}

.property-list-table th.member-id {
    width: 80px;
}

.property-list-table th.member-name {
    width: 120px;
}

.property-list-table th.address {
    min-width: 150px;
}

.property-list-table th.room-number {
    width: 60px;
}

.property-list-table th.garden-size {
    width: 100px;
}

.property-list-table th.plants-equipment {
    min-width: 150px;
}

.property-list-table th.last-service-date {
    width: 120px;
}

/* ハイライト用のスタイル（遷移先で使用） */
.highlight-property {
    background-color: rgba(146, 113, 189, 0.2) !important;
    transition: background-color 0.5s ease;
}

/* ソートアイコンのスタイル */
.sort-icon {
    margin-left: 5px;
    display: inline-block;
}

/* 昇順/降順アイコンのスタイル */
.sort-asc::after {
    content: "\f0de";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    display: inline-block;
    margin-left: 5px;
}

.sort-desc::after {
    content: "\f0dd";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    display: inline-block;
    margin-left: 5px;
}

/* レスポンシブ対応 */
@media screen and (max-width: 1000px) {
    .property-list-table th,
    .property-list-table td {
        font-size: 14px;
    }
}

@media screen and (max-width: 739px) {
    .property-list-table th,
    .property-list-table td {
        font-size: 12px;
        padding: 8px;
    }
    
    .search-form {
        max-width: 100%;
    }
}

/* 画面幅480px以下での表示調整 */
@media screen and (max-width: 480px) {
    /* ソートアイコンを非表示にする */
    .property-list-table th.sortable .sort-icon {
        display: none;
    }

    .property-list-main-body {
        height: 90%;
    }
    
    /* ソートアイコンを非表示にした際のパディング調整 */
    .property-list-table th.sortable {
        padding-right: 8px;
    }
    
    /* テーブル文字サイズをさらに小さく */
    .property-list-table th,
    .property-list-table td {
        font-size: 11px;
        padding: 6px 4px;
    }
}

/* 横スクロール機能は768px以下の画面幅でのみ適用 */
@media screen and (max-width: 768px) {
    .property-list-table th,
    .property-list-table td {
        font-size: 13px;
        padding: 6px;
    }
    
    /* モバイル表示で特定のカラムのみ表示 */
    .property-list-table th.member-id,
    .property-list-table td.member-id-cell,
    .property-list-table th.address,
    .property-list-table td.address-cell,
    .property-list-table th.room-number,
    .property-list-table td.room-number-cell,
    .property-list-table th.garden-size,
    .property-list-table td.garden-size-cell,
    .property-list-table th.plants-equipment,
    .property-list-table td.plants-equipment-cell {
        display: none;
    }
    
    /* 表示するカラムの幅を調整 */
    .property-list-table th.property-name,
    .property-list-table td.property-name-cell {
        width: 40%;
    }
    
    .property-list-table th.member-name,
    .property-list-table td.member-name-cell {
        width: 35%;
    }
    
    .property-list-table th.last-service-date,
    .property-list-table td.last-service-date-cell {
        width: 25%;
    }
    
    /* テキストを複数行で表示 */
    .property-list-table td.property-name-cell a,
    .property-list-table td.member-name-cell a {
        white-space: normal;
        word-break: break-word;
        display: block;
        line-height: 1.4;
    }
    
    .search-form {
        max-width: 100%;
    }
    
    .property-list-table {
        width: 100%;
        table-layout: fixed;
    }
}

/* PC表示での長いテキストの処理 */
@media screen and (min-width: 769px) {
    .property-list-table td.property-name-cell a,
    .property-list-table td.member-name-cell a {
        display: block;
        white-space: normal;
        word-break: break-word;
        line-height: 1.4;
    }
}