/* 物件情報ページのスタイル */
.main-area {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.main-header {
  position: sticky;
  top: 0;
  background-color: #F1EDE7;
  z-index: 100;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.member-properties-main-body {
  padding: 20px;
  background-color: #fff;
  flex: 1;
  overflow-y: auto;
  border-radius: 0 0 20px 20px;
}

.properties-list {
    margin-bottom: 30px;
}

/* テーブルコンテナ */
#member-properties .properties-table-container {
    width: 100% !important;
    overflow-x: auto !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    margin-bottom: 20px !important;
}

/* ヘッダースタイル */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #dddddd;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.properties-list h3 {
    font-size: 20px;
    color: #555555;
    margin: 0;
}

.header .button {
    margin-left: 10px;
}

/* CSVインポートボタンコンテナ */
.csv-import-container {
    margin: 0 0 0 15px;
    display: inline-block;
}

.csv-import-container .button {
    padding: 5px 10px;
    font-size: 14px;
    margin-right: 10px;
}

.csv-import-container .button:last-child {
    margin-right: 0;
}

.csv-import-container .button:hover {
    background-color: #025aa5;
    color: #fff;
}

/* 物件追加ボタンコンテナ */
.add-property-container {
    margin-left: auto;
}

.add-property-container .add-btn {
    background-color: #0AA273;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.add-property-container .add-btn:hover {
    background-color: #088c61;
}

/* テーブルスタイル */
#member-properties .properties-table {
    width: 100% !important;
    border-collapse: collapse !important;
    table-layout: fixed !important; /* 固定レイアウトを強制 */
    margin-top: 0 !important;
    font-size: 14px !important;
    display: table !important; /* テーブル表示を強制 */
}

#member-properties .properties-table th, 
#member-properties .properties-table td {
    border: 1px solid #dddddd !important;
    padding: 8px 10px !important;
    text-align: left !important;
    vertical-align: middle !important;
    word-wrap: break-word !important;
    overflow: hidden !important;
    display: table-cell !important; /* テーブルセル表示を強制 */
}

#member-properties .properties-table thead tr,
#member-properties .properties-table tr:first-child {
    display: table-row !important; /* ヘッダー行の表示を強制 */
}

#member-properties .properties-table th {
    background-color: #f5f5f5 !important;
    font-weight: bold !important;
    padding: 10px !important;
    text-align: left !important;
    border: 1px solid #ddd !important;
    white-space: nowrap !important;
    display: table-cell !important; /* ヘッダーセルの表示を強制 */
}

/* カラム幅の設定 - より具体的なセレクタで強制 */
#member-properties .properties-table th.property-name,
#member-properties .properties-table td:nth-child(1) {
    width: 12% !important;
    min-width: 100px !important;
}

#member-properties .properties-table th.postal-code,
#member-properties .properties-table td:nth-child(2) {
    width: 8% !important;
    min-width: 80px !important;
    text-align: center !important;
}

#member-properties .properties-table th.address,
#member-properties .properties-table td:nth-child(3) {
    width: 16% !important;
    min-width: 140px !important;
}

#member-properties .properties-table th.room-number,
#member-properties .properties-table td:nth-child(4) {
    width: 6% !important;
    min-width: 50px !important;
    text-align: center !important;
}

#member-properties .properties-table th.garden-size,
#member-properties .properties-table td:nth-child(5) {
    width: 10% !important;
    min-width: 80px !important;
}

#member-properties .properties-table th.plants-equipment,
#member-properties .properties-table td:nth-child(6) {
    width: 14% !important;
    min-width: 110px !important;
}

#member-properties .properties-table th.notes,
#member-properties .properties-table td:nth-child(7) {
    width: 18% !important;
    min-width: 140px !important;
}

#member-properties .properties-table th.emergency-contact,
#member-properties .properties-table td:nth-child(8) {
    width: 10% !important;
    min-width: 100px !important;
}

#member-properties .properties-table th.last-service-date,
#member-properties .properties-table td:nth-child(9) {
    width: 9% !important;
    min-width: 90px !important;
    text-align: center !important;
}

#member-properties .properties-table tr {
    display: table-row !important; /* テーブル行表示を強制 */
}

#member-properties .properties-table tr:nth-child(even) {
    background-color: #f9f9f9 !important;
}

/* ホバーエフェクト */
#member-properties .properties-table tr:hover {
    background-color: #e9f7fe !important;
    cursor: pointer !important;
}

/* クリック可能な行のスタイル */
#member-properties .properties-table .clickable-row {
    transition: background-color 0.2s ease !important;
    display: table-row !important; /* テーブル行表示を強制 */
}

#member-properties .properties-table .clickable-row:hover {
    background-color: #e9f7fe !important;
}

/* リンクスタイル */
.map-link {
    color: #0275d8;
    text-decoration: none;
}

.map-link:hover {
    text-decoration: underline;
    color: #025aa5;
}

/* 庭の広さセルのスタイル（画像がある場合） */
.garden-size-cell[data-has-image="true"] {
    cursor: pointer;
    color: #0275d8;
    position: relative;
}

.garden-size-cell[data-has-image="true"]:hover {
    text-decoration: underline;
}

/* 画像表示インジケーター */
.image-indicator {
    margin-left: 5px;
    font-size: 18px;
    color: #555;
}

/* モーダルスタイル */
.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 {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 800px;
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 15px;
    top: 10px;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

#garden-image {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

/* ハイライト用のスタイル */
.highlight-property {
    background-color: rgba(146, 113, 189, 0.2) !important;
    transition: background-color 0.5s ease;
}

/* レスポンシブ対応 */
@media screen and (max-width: 1200px) {
    #member-properties .properties-table {
        table-layout: fixed !important; /* 固定レイアウトを維持 */
        font-size: 13px !important;
    }
    
    /* カラム幅を若干調整 */
    #member-properties .properties-table th.property-name,
    #member-properties .properties-table td:nth-child(1) {
        width: 14% !important;
    }
    
    #member-properties .properties-table th.postal-code,
    #member-properties .properties-table td:nth-child(2) {
        width: 8% !important;
    }
    
    #member-properties .properties-table th.address,
    #member-properties .properties-table td:nth-child(3) {
        width: 18% !important;
    }
    
    #member-properties .properties-table th.plants-equipment,
    #member-properties .properties-table td:nth-child(6) {
        width: 15% !important;
    }
    
    #member-properties .properties-table th.notes,
    #member-properties .properties-table td:nth-child(7) {
        width: 17% !important;
    }
}

@media screen and (max-width: 1000px) {
    #member-properties .properties-table th,
    #member-properties .properties-table td {
        font-size: 14px !important;
        padding: 8px !important;
    }
    
    .properties-list h3 {
        font-size: 18px;
    }
    
    .csv-import-container .button {
        font-size: 13px;
        padding: 4px 8px;
    }
    
    .header .button {
        font-size: 13px;
        padding: 4px 8px;
    }
    
    .modal-content {
        width: 90%;
        max-width: 600px;
    }
}

@media screen and (max-width: 768px) {
    .member-properties-main-body {
        padding: 15px;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    #member-properties .properties-table {
        width: 100% !important;
        display: table !important;
        table-layout: fixed !important;
        overflow-x: visible !important;
        white-space: normal !important;
    }
    
    /* モバイル表示時のカラム幅調整 - 3カラムのみ表示 */
    #member-properties .properties-table th.property-name,
    #member-properties .properties-table td:nth-child(1) {
        width: 50% !important; /* 物件名 */
        min-width: 120px !important;
    }
    
    #member-properties .properties-table th.garden-size,
    #member-properties .properties-table td:nth-child(5) {
        width: 25% !important; /* 庭の広さ */
        min-width: 80px !important;
    }
    
    #member-properties .properties-table th.last-service-date,
    #member-properties .properties-table td:nth-child(9) {
        width: 25% !important; /* 前回受注日 */
        min-width: 80px !important;
    }
    
    /* モバイル表示時に非表示にするカラムを確実に隠す */
    #member-properties .properties-table th.postal-code,
    #member-properties .properties-table td:nth-child(2),
    #member-properties .properties-table th.address,
    #member-properties .properties-table td:nth-child(3),
    #member-properties .properties-table th.room-number,
    #member-properties .properties-table td:nth-child(4),
    #member-properties .properties-table th.plants-equipment,
    #member-properties .properties-table td:nth-child(6),
    #member-properties .properties-table th.notes,
    #member-properties .properties-table td:nth-child(7),
    #member-properties .properties-table th.emergency-contact,
    #member-properties .properties-table td:nth-child(8) {
        display: none !important;
        width: 0 !important;
        padding: 0 !important;
        border: none !important;
    }
    
    #member-properties .properties-table th,
    #member-properties .properties-table td {
        font-size: 13px !important;
        padding: 6px !important;
    }
    
    .properties-list h3 {
        font-size: 16px;
    }
    
    .header {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .csv-import-container {
        margin: 5px 0 0 0;
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .csv-import-container .button {
        margin-right: 0;
    }
    
    .add-property-container {
        margin: 5px 0 0 auto;
    }
    
    #garden-image {
        max-height: 400px;
    }
    
    /* モーダルスタイルの調整 */
    .modal-content {
        margin: 5% auto;
        padding: 15px;
        width: 90% !important;
        max-width: 90% !important;
    }
    
    /* 物件詳細モーダル内のスタイル調整 */
    .property-info-row {
        flex-direction: column;
    }
    
    .property-info-label {
        width: 100%;
        margin-bottom: 5px;
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .property-info-value {
        width: 100%;
        padding-left: 10px;
    }
}

@media screen and (max-width: 480px) {
    .member-properties-main-body {
        padding: 10px;
    }
    
    #member-properties .properties-table th,
    #member-properties .properties-table td {
        font-size: 12px !important;
        padding: 4px !important;
    }
    
    /* 極小画面でのカラム幅調整 */
    #member-properties .properties-table th.property-name,
    #member-properties .properties-table td:nth-child(1) {
        width: 45% !important; /* 物件名 */
        min-width: 100px !important;
    }
    
    #member-properties .properties-table th.garden-size,
    #member-properties .properties-table td:nth-child(5) {
        width: 27.5% !important; /* 庭の広さ */
        min-width: 70px !important;
    }
    
    #member-properties .properties-table th.last-service-date,
    #member-properties .properties-table td:nth-child(9) {
        width: 27.5% !important; /* 前回受注日 */
        min-width: 70px !important;
    }
    
    /* 480px以下でも非表示カラムを確実に隠す */
    #member-properties .properties-table th.postal-code,
    #member-properties .properties-table td:nth-child(2),
    #member-properties .properties-table th.address,
    #member-properties .properties-table td:nth-child(3),
    #member-properties .properties-table th.room-number,
    #member-properties .properties-table td:nth-child(4),
    #member-properties .properties-table th.plants-equipment,
    #member-properties .properties-table td:nth-child(6),
    #member-properties .properties-table th.notes,
    #member-properties .properties-table td:nth-child(7),
    #member-properties .properties-table th.emergency-contact,
    #member-properties .properties-table td:nth-child(8) {
        display: none !important;
        width: 0 !important;
        padding: 0 !important;
        border: none !important;
    }
    
    .properties-list h3 {
        font-size: 15px;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header .button {
        margin-left: 0;
        margin-top: 5px;
    }
    
    .csv-import-container {
        width: 100%;
        flex-direction: column;
    }
    
    .csv-import-container .button {
        width: 100%;
        margin-bottom: 5px;
        text-align: center;
    }
    
    .add-property-container {
        width: 100%;
        margin-top: 10px;
        margin-left: 0;
    }
    
    .add-property-container .add-btn {
        width: 100%;
        text-align: center;
    }
    
    .modal-content {
        margin: 5% auto;
        padding: 15px;
        width: 95%;
    }
    
    #garden-image {
        max-height: 300px;
    }
}