/**
 * Major Facilities Modal Styles
 * Bootstrap非依存の自前モーダルスタイル
 */

/* ==========================================
   モーダル構造
   ========================================== */

.mf-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mf-modal-dialog {
    width: 92vw;
    max-width: 1400px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.mf-modal-content {
    background: #FAFBFD;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 90vh;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.mf-modal-header {
    background: #FAFBFD;
    padding: 16px 24px;
    border-bottom: 1px solid #D2D5DA;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mf-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #141415;
}

.mf-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.mf-close-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.mf-close-btn:active {
    background-color: rgba(0, 0, 0, 0.1);
}

.mf-modal-body {
    flex: 1;
    overflow: hidden;
    padding: 16px;
    min-height: 0;
}

.mf-modal-footer {
    padding: 12px 24px;
    border-top: 1px solid #D2D5DA;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: #FAFBFD;
    flex-shrink: 0;
}

/* ==========================================
   2カラムレイアウト
   ========================================== */

.mf-layout {
    display: flex;
    gap: 16px;
    height: 100%;
    min-height: 0;
}

.mf-left-panel {
    flex: 0 0 420px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.mf-right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ==========================================
   共通テキスト
   ========================================== */

.mf-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #141415;
    margin-bottom: 12px;
}

.mf-subsection-title {
    font-size: 13px;
    font-weight: 600;
    color: #5B5F66;
    margin-bottom: 8px;
}

.mf-hint-text {
    font-size: 12px;
    color: #8A8F98;
    display: block;
    margin-top: 4px;
}

/* 件数バッジ */
.mf-count-badge {
    font-size: 12px;
    font-weight: 600;
    color: #3B82F6;
    background: #DBEAFE;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 4px;
}

/* ==========================================
   企業検索セクション
   ========================================== */

.facility-search-section {
    background: #EBEEF3;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

#facility-company-search {
    padding: 8px 12px;
    border: 1px solid #D2D5DA;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    color: #141415;
    outline: none;
    box-sizing: border-box;
}

#facility-company-search:focus {
    border-color: #3B82F6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.facility-company-info {
    background: #fff;
    padding: 12px;
    border-radius: 4px;
    border-left: 3px solid #3B82F6;
    margin-top: 12px;
}

#facility-selected-company {
    font-size: 14px;
    color: #141415;
    font-weight: 500;
}

.facility-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ==========================================
   拠点リストセクション
   ========================================== */

.facility-list-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.facility-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #D2D5DA;
    flex-shrink: 0;
}

.facility-list-header .mf-section-title {
    margin-bottom: 0;
}

.facility-select-controls {
    display: flex;
    gap: 6px;
}

#facility-facilities-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    border: 1px solid #D2D5DA;
    border-radius: 6px;
    padding: 8px;
    background: #fff;
}

.facility-list-item {
    padding: 10px 12px;
    margin-bottom: 6px;
    background: #F4F5F7;
    border-radius: 4px;
    border: 1px solid #EBEEF3;
    transition: all 0.15s;
}

.facility-list-item:hover {
    background: #EBEEF3;
}

.facility-list-item.selected {
    background: #EFF6FF;
    border-color: #3B82F6;
}

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

.facility-list-item .form-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    padding-left: 0;
}

.facility-list-item .form-check-input {
    width: 16px;
    height: 16px;
    margin-top: 3px;
    cursor: pointer;
    accent-color: #3B82F6;
}

.facility-list-item .form-check-label {
    cursor: pointer;
    flex: 1;
}

.facility-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
    font-size: 12px;
}

.facility-location {
    color: #5B5F66;
    font-weight: 500;
}

.facility-purpose {
    color: #5B5F66;
}

.facility-value {
    color: #3B82F6;
    font-weight: 600;
}

/* ==========================================
   ミニマップセクション
   ========================================== */

.facility-minimap-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#facility-minimap {
    flex: 1;
    min-height: 300px;
    width: 100%;
    border-radius: 6px;
    border: 1px solid #D2D5DA;
}

/* プレースホルダー */
.mf-map-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #EBEEF3;
    border-radius: 6px;
    border: 1px dashed #D2D5DA;
    min-height: 300px;
}

.mf-placeholder-text {
    color: #8A8F98;
    font-size: 14px;
    text-align: center;
    padding: 24px;
}

/* ==========================================
   アクションボタン
   ========================================== */

.facility-geocode-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #D2D5DA;
    flex-shrink: 0;
}

.mf-action-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ==========================================
   ボタン
   ========================================== */

.mf-btn-outline {
    background: transparent;
    color: #3B82F6;
    border: 1px solid #3B82F6;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 13px;
    cursor: pointer;
}

.mf-btn-outline:hover {
    background: rgba(59, 130, 246, 0.08);
}

.mf-btn-success {
    background: #22C55E;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 18px;
    font-size: 14px;
    cursor: pointer;
}

.mf-btn-success:hover:not(:disabled) {
    background: #16A34A;
}

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

/* ==========================================
   ポップアップ / バッジ
   ========================================== */

.facility-popup {
    min-width: 200px;
}

.facility-popup h6 {
    margin: 0 0 6px 0;
    font-weight: 600;
    font-size: 14px;
    color: #141415;
}

.facility-popup p {
    margin: 0;
    font-size: 13px;
    color: #5B5F66;
}

.mf-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.mf-badge-success {
    background: #DCFCE7;
    color: #166534;
}

.mf-badge-warning {
    background: #FEF9C3;
    color: #854D0E;
}

.mf-badge-primary {
    background: #DBEAFE;
    color: #1E40AF;
}

/* ==========================================
   スピナー
   ========================================== */

@keyframes mf-spinner {
    to { transform: rotate(360deg); }
}

.spinner-border {
    display: inline-block;
    width: 14px;
    height: 14px;
    vertical-align: -2px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: mf-spinner 0.75s linear infinite;
}

.spinner-border-sm {
    width: 12px;
    height: 12px;
    border-width: 1.5px;
}

/* ==========================================
   レスポンシブ
   ========================================== */

@media (max-width: 900px) {
    .mf-modal-dialog {
        width: 95vw;
    }

    .mf-layout {
        flex-direction: column;
    }

    .mf-left-panel {
        flex: none;
        max-height: 50vh;
    }

    .mf-right-panel {
        flex: none;
    }

    #facility-minimap {
        min-height: 250px;
        height: 300px;
    }

    .mf-map-placeholder {
        min-height: 200px;
    }

    .mf-action-buttons {
        flex-direction: column;
    }

    .facility-actions {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    .mf-modal-body {
        padding: 12px;
    }

    .mf-left-panel {
        max-height: 40vh;
    }

    .facility-list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .facility-select-controls {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ==========================================
   autoComplete.js
   ========================================== */

#autoComplete_list_1 {
    background: #fff;
    border: 1px solid #D2D5DA;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    max-height: 300px;
    overflow-y: auto;
}

#autoComplete_list_1 li {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.15s;
}

#autoComplete_list_1 li:hover,
#autoComplete_list_1 li[aria-selected="true"] {
    background-color: #EBEEF3;
}

#autoComplete_list_1 li mark {
    background-color: #FEF9C3;
    padding: 1px 2px;
    border-radius: 2px;
}
