/* css/member-facility.css - 施設管理セクション用スタイル v2
 *
 * 施設申請・認定管理・PR情報編集のスタイル定義
 * admin.html から読み込む前提
 */

/* =====================================================
   施設タイプバッジ
   ===================================================== */

   .facility-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.facility-type-badge.counseling {
    background: #dcfce7;
    color: #16a34a;
}

.facility-type-badge.medical {
    background: #dbeafe;
    color: #2563eb;
}

.facility-type-badge.medical_associate {
    background: #ede9fe;
    color: #7c3aed;
}

/* =====================================================
   施設ステータスバッジ
   ===================================================== */

.facility-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.facility-status-badge.pending { background: #fef3c7; color: #92400e; }
.facility-status-badge.payment_pending { background: #fed7aa; color: #c2410c; }
.facility-status-badge.payment_pending_bank { background: #fed7aa; color: #c2410c; }
.facility-status-badge.approved { background: #dcfce7; color: #16a34a; }
.facility-status-badge.rejected { background: #fee2e2; color: #dc2626; }
.facility-status-badge.active { background: #dbeafe; color: #2563eb; }
.facility-status-badge.expiring { background: #fef3c7; color: #d97706; }
.facility-status-badge.expired { background: #fee2e2; color: #dc2626; }
.facility-status-badge.suspended { background: #f3f4f6; color: #6b7280; }
.facility-status-badge.pr_pending { background: #e0e7ff; color: #4338ca; }
.facility-status-badge.pr_submitted { background: #ede9fe; color: #7c3aed; }

/* PR ステータスバッジ */
.pr-status-badge {
    font-size: 11px;
    font-weight: 500;
}

.pr-status-badge.done { color: #16a34a; }
.pr-status-badge.empty { color: #94a3b8; }

/* =====================================================
   支払方法バッジ
   ===================================================== */

.payment-method-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
}

.payment-method-badge.card { color: #2563eb; }
.payment-method-badge.bank_transfer { color: #059669; }

/* =====================================================
   施設タブ
   ===================================================== */

.facility-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0;
    overflow-x: auto;
}

.facility-tab {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.facility-tab:hover { color: #1a1a2e; }

.facility-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.facility-tab .tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    margin-left: 6px;
}

.facility-tab-content {
    display: none;
}

.facility-tab-content.active {
    display: block;
}

/* =====================================================
   施設名セル
   ===================================================== */

.facility-name-cell {
    max-width: 280px;
}

.facility-name-cell strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.truncate-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =====================================================
   空状態
   ===================================================== */

.facility-empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #9ca3af;
}

.facility-empty-state svg {
    margin-bottom: 12px;
    opacity: 0.3;
}

.facility-empty-state h3 {
    font-size: 15px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 4px;
}

.facility-empty-state p {
    font-size: 13px;
}

/* =====================================================
   詳細セクション
   ===================================================== */

.facility-detail-section {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
}

.facility-detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.facility-detail-section h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1a1a2e;
}

.facility-detail-section p {
    font-size: 13px;
    color: #374151;
    margin-bottom: 4px;
    line-height: 1.6;
}

.facility-detail-section p strong {
    color: #6b7280;
    font-weight: 600;
    min-width: 80px;
    display: inline-block;
}

/* =====================================================
   PR 情報編集フォーム
   ===================================================== */

.pr-form-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f3f4f6;
}

.pr-form-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.pr-form-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* チェックボックスグループ */
.pr-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pr-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    padding: 5px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    transition: all 0.2s ease;
    user-select: none;
}

.pr-checkbox-label:hover {
    border-color: #2563eb;
    background: #eff6ff;
}

.pr-checkbox-label input[type="checkbox"] {
    accent-color: #2563eb;
    width: 14px;
    height: 14px;
}

.pr-checkbox-label:has(input:checked) {
    background: #eff6ff;
    border-color: #2563eb;
    color: #2563eb;
}

/* 資格者数グリッド */
.pr-cert-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

@media (max-width: 768px) {
    .pr-cert-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .pr-cert-grid {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   PR レビューモーダル
   ===================================================== */

.pr-review-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.pr-review-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pr-review-item.full {
    grid-column: 1 / -1;
}

.pr-review-label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pr-review-item > span:last-child {
    font-size: 13px;
    color: #1a1a2e;
    line-height: 1.5;
}

@media (max-width: 600px) {
    .pr-review-grid {
        grid-template-columns: 1fr;
    }
    .pr-review-item.full {
        grid-column: auto;
    }
}

/* =====================================================
   公開ページエクスポートパネル
   ===================================================== */

.facility-export-panel {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: none;
    border: 1px solid #e5e7eb;
}

.facility-export-panel.active {
    display: block;
}

.facility-export-panel h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
}

.facility-export-panel .export-hint {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 10px;
}

.facility-export-textarea {
    width: 100%;
    height: 200px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    resize: vertical;
    line-height: 1.5;
    background: #f9fafb;
}

.facility-export-textarea:focus {
    outline: none;
    border-color: #2563eb;
}

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

/* =====================================================
   CSV アップロードエリア（admin.html 内のファシリティセクション用）
   ===================================================== */

.facility-csv-upload {
    border: 2px dashed #e5e7eb;
    border-radius: 10px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f9fafb;
    margin-bottom: 16px;
}

.facility-csv-upload:hover,
.facility-csv-upload.dragover {
    border-color: #2563eb;
    background: #eff6ff;
}

.facility-csv-upload svg {
    width: 40px;
    height: 40px;
    color: #9ca3af;
    margin-bottom: 8px;
}

.facility-csv-upload p {
    font-size: 13px;
    color: #6b7280;
}

.facility-csv-upload .hint {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

.facility-csv-upload input[type="file"] {
    display: none;
}

/* =====================================================
   テーブルアクション
   ===================================================== */

.table-actions {
    display: flex;
    gap: 4px;
}

.table-actions .btn-icon {
    padding: 5px;
    border-radius: 4px;
    background: none;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.table-actions .btn-icon:hover {
    background: #f3f4f6;
    color: #1a1a2e;
}

.table-actions .btn-icon.confirm {
    color: #16a34a;
    border-color: #bbf7d0;
}

.table-actions .btn-icon.confirm:hover {
    background: #dcfce7;
}

.table-actions .btn-icon.danger {
    color: #dc2626;
    border-color: #fecaca;
}

.table-actions .btn-icon.danger:hover {
    background: #fee2e2;
}

/* =====================================================
   form-row 2列レイアウト（モーダル内）
   ===================================================== */

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   統計カードの施設専用色
   ===================================================== */

.stat-icon.facility-pending {
    background: #fef3c7;
    color: #d97706;
}

.stat-icon.facility-payment {
    background: #fed7aa;
    color: #c2410c;
}

.stat-icon.facility-active {
    background: #dbeafe;
    color: #2563eb;
}

.stat-icon.facility-expiring {
    background: #fee2e2;
    color: #dc2626;
}

.stat-icon.facility-pr {
    background: #e0e7ff;
    color: #4338ca;
}

/* =====================================================
   モーダル内の施設フォーム追加スタイル
   ===================================================== */

.form-textarea {
    width: 100%;
    padding: 9px 12px;
    font-family: 'Noto Sans JP', -apple-system, sans-serif;
    font-size: 13.5px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    transition: border-color 0.2s ease;
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

.form-textarea:focus {
    outline: none;
    border-color: #2563eb;
}

/* 施設情報ミニカード（CSVインポートプレビュー内など） */
.facility-mini-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #f3f4f6;
    margin-bottom: 8px;
}

.facility-mini-card .mini-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.facility-mini-card .mini-icon.matched {
    background: #dcfce7;
    color: #16a34a;
}

.facility-mini-card .mini-icon.new {
    background: #fef3c7;
    color: #d97706;
}

.facility-mini-card .mini-info {
    flex: 1;
    min-width: 0;
}

.facility-mini-card .mini-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.facility-mini-card .mini-detail {
    font-size: 11px;
    color: #6b7280;
}

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

@media (max-width: 1024px) {
    .pr-cert-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .facility-tabs {
        gap: 0;
    }

    .facility-tab {
        padding: 8px 12px;
        font-size: 12px;
    }

    .pr-checkbox-group {
        gap: 4px;
    }

    .pr-checkbox-label {
        font-size: 12px;
        padding: 4px 8px;
    }
}