* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Meiryo', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* メインアプリレイアウト */
#app {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左パネル */
#left-panel {
    width: 400px;
    min-width: 300px;
    max-width: 500px;
    background-color: #fff;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* パネルセクション */
.panel-section {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.panel-section h3 {
    margin-bottom: 12px;
    color: #444;
    font-size: 14px;
    font-weight: 600;
}

.panel-section h3 small {
    font-weight: normal;
    color: #888;
    font-size: 11px;
}

/* テーブルセクション */
.table-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    overflow: hidden;
}

/* ドロップゾーン */
#drop-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

#drop-zone.drag-over {
    border-color: #4CAF50;
    background-color: #e8f5e9;
}

#drop-zone p {
    margin: 5px 0;
    color: #666;
    font-size: 13px;
}

/* ボタン */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: #2196F3;
    color: white;
}

.btn-secondary {
    background-color: #757575;
    color: white;
}

.btn-success {
    background-color: #4CAF50;
    color: white;
}

.btn-warning {
    background-color: #FF9800;
    color: white;
}

.btn-danger {
    background-color: #f44336;
    color: white;
}

.button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.button-group .btn {
    flex: 1;
    min-width: 100px;
}

/* テーブル */
#table-container {
    flex: 1;
    overflow: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#kml-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

#kml-table thead {
    position: sticky;
    top: 0;
    background-color: #f5f5f5;
    z-index: 1;
}

#kml-table th,
#kml-table td {
    padding: 8px 6px;
    text-align: right;
    border-bottom: 1px solid #eee;
}

#kml-table th {
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #ddd;
}

#kml-table th:first-child,
#kml-table td:first-child {
    text-align: center;
}

#kml-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s;
}

#kml-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

#kml-table tbody tr:hover {
    background-color: #e3f2fd;
}

#kml-table tbody tr.selected {
    background-color: #bbdefb;
}

#kml-table td.altitude-cell {
    color: #1976D2;
    font-weight: 500;
}

#kml-table td.altitude-cell.editing {
    padding: 2px;
}

#kml-table td.altitude-cell input {
    width: 100%;
    padding: 4px;
    border: 1px solid #2196F3;
    border-radius: 2px;
    font-size: 12px;
    text-align: right;
}

/* 右パネル（地図） */
#right-panel {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

/* ステータスバー */
#status-bar {
    background-color: #424242;
    color: #fff;
    padding: 6px 15px;
    font-size: 12px;
}

#status-text {
    color: #e0e0e0;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 18px;
}

.modal-content p {
    margin-bottom: 20px;
    color: #666;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
}

.input-group {
    display: flex;
    align-items: center;
}

.input-group input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.input-group input:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.input-suffix {
    margin-left: 8px;
    color: #666;
    font-size: 14px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    #app {
        flex-direction: column;
    }

    #left-panel {
        width: 100%;
        max-width: none;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    #right-panel {
        min-height: 50vh;
    }

    .button-group .btn {
        min-width: 80px;
        font-size: 12px;
        padding: 6px 10px;
    }
}

/* Leaflet カスタムスタイル */
.leaflet-control-layers {
    font-size: 12px;
}

.leaflet-popup-content {
    font-size: 12px;
}
