/* KML高度設定ツール - スタイル */

:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --secondary: #6b7280;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --bg-dark: #1e293b;
    --bg-panel: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
}

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

body {
    font-family: 'Segoe UI', 'Noto Sans JP', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

#app {
    display: flex;
    height: calc(100vh - 32px);
}

/* 左パネル */
#left-panel {
    width: 380px;
    min-width: 380px;
    background: var(--bg-panel);
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.back-to-top {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}

.back-to-top:hover {
    color: var(--primary-dark);
}

#left-panel h1 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* パネルセクション */
.panel-section {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.panel-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* ファイルグループ */
.file-group {
    margin-bottom: 0.75rem;
}

.file-group:last-child {
    margin-bottom: 0;
}

.file-group > label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.file-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filename {
    flex: 1;
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filename.loaded {
    color: var(--success);
    font-weight: 500;
}

.file-info {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    line-height: 1.3;
}

/* フォームグループ */
.form-group {
    margin-bottom: 0.75rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group > label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    background: #fff;
}

.form-group input[type="number"]:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

.form-group small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* チェックボックスラベル */
.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500 !important;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ラジオボタングループ */
.radio-group {
    display: flex;
    gap: 1rem;
    margin: 0.5rem 0;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.radio-label input[type="radio"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* サブオプション */
.sub-options {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: 4px;
}

.sub-options select {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
    background: #fff;
}

.sub-options small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* サブフォーム */
.sub-form {
    margin-top: 0.5rem;
    padding-left: 1.5rem;
    padding-top: 0.5rem;
    border-left: 2px solid var(--border-color);
}

.sub-form.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.sub-form label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.sub-form input {
    max-width: 120px;
}

/* ボタン */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-large {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
    color: #fff;
}

.btn-secondary:hover:not(:disabled) {
    background: #4b5563;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* プログレスバー */
.progress-container {
    margin-top: 0.75rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

#progress-text {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* 統計表示 */
.stats-display {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 0.8rem;
    line-height: 1.6;
}

.stats-display .stat-row {
    display: flex;
    justify-content: space-between;
}

.stats-display .stat-label {
    color: var(--text-secondary);
}

.stats-display .stat-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* ログセクション */
.log-section {
    flex: 1;
    min-height: 150px;
    display: flex;
    flex-direction: column;
}

#log-container {
    flex: 1;
    background: #0f172a;
    border-radius: 4px;
    padding: 0.5rem;
    overflow-y: auto;
    max-height: 200px;
    min-height: 100px;
}

#log-output {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    color: #94a3b8;
    white-space: pre-wrap;
    word-break: break-all;
}

#log-output .log-info {
    color: #60a5fa;
}

#log-output .log-success {
    color: #34d399;
}

#log-output .log-warning {
    color: #fbbf24;
}

#log-output .log-error {
    color: #f87171;
}

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

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

/* 地図凡例 */
#map-legend {
    position: absolute;
    bottom: 20px;
    left: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.75rem;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    font-size: 0.8rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-color {
    width: 24px;
    height: 4px;
    border-radius: 2px;
}

.legend-color.original {
    background: #3b82f6;
}

.legend-color.processed {
    background: #ef4444;
}

.legend-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.legend-marker.start {
    background: #22c55e;
}

.legend-marker.end {
    background: #dc2626;
}

.legend-marker.node {
    background: #3b82f6;
}

.legend-marker.interpolated {
    background: #94a3b8;
    width: 8px;
    height: 8px;
}

/* ステータスバー */
#status-bar {
    height: 32px;
    background: #1e293b;
    color: #94a3b8;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    font-size: 0.8rem;
}

/* モバイルヘッダー */
.mobile-header {
    display: none;
    background: var(--bg-panel);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.mobile-header .back-to-top {
    margin-bottom: 0.25rem;
}

.mobile-header h1 {
    font-size: 1.1rem;
    margin: 0;
    color: var(--text-primary);
}

/* レスポンシブ */
@media (max-width: 1024px) {
    html, body {
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .mobile-header {
        display: block;
    }

    #left-panel .back-to-top,
    #left-panel h1 {
        display: none;
    }

    #app {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: auto;
    }

    #left-panel {
        width: 100%;
        min-width: auto;
        max-height: none;
        overflow-y: visible;
    }

    #right-panel {
        width: 100%;
        height: 50vh;
        min-height: 300px;
        flex: none;
        position: relative;
    }

    #map {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100% !important;
        height: 100% !important;
    }

    #map-legend {
        bottom: 10px;
        left: 10px;
    }

    #status-bar {
        position: sticky;
        bottom: 0;
        z-index: 100;
    }
}

/* スクロールバー */
#left-panel::-webkit-scrollbar,
#log-container::-webkit-scrollbar {
    width: 6px;
}

#left-panel::-webkit-scrollbar-track,
#log-container::-webkit-scrollbar-track {
    background: transparent;
}

#left-panel::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

#log-container::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

/* Leaflet カスタマイズ */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.leaflet-popup-content {
    margin: 0.75rem;
    font-size: 0.85rem;
}

/* ドラッグ＆ドロップ */
body.drag-over::after {
    content: 'KML/KMZファイルをドロップ';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(16, 185, 129, 0.9);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
    z-index: 9999;
    pointer-events: none;
}
