/**
 * forestryAttributeTable.css
 * 森林計画属性テーブルのスタイル（シンプルな白ベースデザイン）
 */

/* ========================================
   属性テーブル: 基本スタイル
   ======================================== */

#forestry-attribute-table {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 2px solid #ccc;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
    z-index: 999;
    display: none;
    flex-direction: column;
    height: 300px;
    min-height: 100px;
    max-height: 75vh;
}

#forestry-attribute-table.visible {
    display: flex;
}

/* ========================================
   リサイズハンドル
   ======================================== */

.forestry-table-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    cursor: ns-resize;
    background: transparent;
    z-index: 10;
}

.forestry-table-resize-handle:hover {
    background: #2196F3;
}

/* ========================================
   ヘッダー部分
   ======================================== */

.forestry-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    user-select: none;
}

.forestry-table-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.forestry-table-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.forestry-table-title h3 {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.forestry-model-name {
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

.forestry-table-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ========================================
   検索コントロール
   ======================================== */

.forestry-search-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.forestry-search-column {
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: white;
    font-size: 12px;
    cursor: pointer;
    min-width: 120px;
    color: #333;
}

.forestry-search-column:focus {
    outline: none;
    border-color: #2196F3;
}

.forestry-search-column option {
    background-color: #ffffff;
    color: #333;
}

.forestry-search-operator {
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: white;
    font-size: 12px;
    cursor: pointer;
    min-width: 90px;
    color: #333;
}

.forestry-search-operator.hidden {
    display: none;
}

.forestry-search-operator:focus {
    outline: none;
    border-color: #2196F3;
}

.forestry-search-input {
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
    width: 150px;
}

.forestry-search-input:focus {
    outline: none;
    border-color: #2196F3;
}

.forestry-search-input::placeholder {
    font-size: 12px;
}

.forestry-search-input-max {
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
    width: 120px;
}

.forestry-search-input-max.hidden {
    display: none;
}

.forestry-search-input-max:focus {
    outline: none;
    border-color: #2196F3;
}

.forestry-search-btn,
.forestry-clear-btn,
.forestry-map-extent-btn,
.forestry-toggle-detail-btn {
    padding: 5px 12px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.forestry-search-btn:hover,
.forestry-clear-btn:hover,
.forestry-map-extent-btn:hover,
.forestry-toggle-detail-btn:hover {
    background: #f0f0f0;
    border-color: #999;
}

.forestry-map-extent-btn {
    color: #2196F3;
    font-weight: 500;
}

.forestry-toggle-detail-btn {
    color: #4CAF50;
    font-weight: 500;
}

/* ========================================
   ページネーション情報
   ======================================== */

.forestry-pagination-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    font-size: 11px;
    color: #666;
}

.record-count {
    font-weight: 600;
}

.page-info {
    opacity: 0.85;
}

/* ========================================
   閉じるボタン
   ======================================== */

.forestry-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 20px;
    color: #666;
    transition: background 0.2s;
}

.forestry-close-btn:hover {
    background: #e0e0e0;
}

/* ========================================
   テーブルコンテンツ部分
   ======================================== */

.forestry-table-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.forestry-table-scroll {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
}

.forestry-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.forestry-data-table thead {
    position: sticky;
    top: 0;
    background: #fafafa;
    z-index: 10;
}

.forestry-data-table th {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid #ddd;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    user-select: none;
    background: #fafafa;
}

.forestry-data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.forestry-data-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

.forestry-data-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.forestry-data-table tbody tr:hover {
    background: #e3f2fd;
}

.forestry-data-table tbody tr.highlighted {
    background: #bbdefb !important;
    font-weight: 500;
}

/* ========================================
   ローディング・エラー表示
   ======================================== */

.forestry-loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 16px 28px;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #666;
}

.forestry-loading-indicator.hidden {
    display: none;
}

.forestry-loading-indicator::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========================================
   スクロールバーのスタイル（Webkit系ブラウザ）
   ======================================== */

.forestry-table-scroll::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.forestry-table-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.forestry-table-scroll::-webkit-scrollbar-thumb {
    background: #999;
    border-radius: 5px;
}

.forestry-table-scroll::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* レスポンシブ対応 */
@media (max-width: 1024px) {
    #forestry-attribute-table {
        height: 350px;
    }
    
    .forestry-table-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .forestry-search-controls {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    #forestry-attribute-table {
        height: 300px;
    }
    
    .forestry-table-title h3 {
        font-size: 13px;
    }
    
    .forestry-search-column,
    .forestry-search-input {
        width: 110px;
        font-size: 11px;
    }
    
    .forestry-data-table {
        font-size: 11px;
    }
    
    .forestry-data-table thead th,
    .forestry-data-table tbody td {
        padding: 6px 8px;
        max-width: 150px;
    }
}
