/* ========================================
   會員管理頁面 (members.html)
   Navy #2455A6 / Orange #FBAB18
======================================== */

.members-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.btn-primary,
.btn-secondary,
.btn-danger {
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all 0.2s ease;
  font-family: inherit;
}
.btn-primary { background: #2455A6; color: #fff; }
.btn-primary:hover { background: #1e4a8f; }
.btn-secondary { background: #f3f4f6; color: #374151; }
.btn-secondary:hover { background: #e5e7eb; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* 統計卡片 */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card-small {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
}
.stat-card-small .stat-label {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}
.stat-card-small .stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: #2455A6;
  line-height: 1;
}

/* 篩選工具列 */
.filter-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.search-box { position: relative; flex: 1; min-width: 260px; }
.search-input {
  width: 100%;
  padding: 0.625rem 0.875rem 0.625rem 2.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  font-family: inherit;
}
.search-input:focus { outline: none; border-color: #2455A6; box-shadow: 0 0 0 3px rgba(36,85,166,0.12); }
.search-icon { position: absolute; left: 0.875rem; top: 50%; transform: translateY(-50%); color: #9ca3af; pointer-events: none; }

.filter-select {
  padding: 0.625rem 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}
.filter-select:focus { outline: none; border-color: #2455A6; }

.filter-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chip {
  padding: 0.5rem 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #fff;
  color: #374151;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.chip:hover { border-color: #2455A6; color: #2455A6; }
.chip.active { background: #2455A6; border-color: #2455A6; color: #fff; }

/* 表格 */
.members-table-container {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  overflow-x: auto;
}
.members-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.members-table thead th {
  text-align: left;
  padding: 1rem;
  background: #f8f9ff;
  color: #374151;
  font-weight: 700;
  font-size: 0.8125rem;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}
.members-table thead th.sortable { cursor: pointer; user-select: none; }
.members-table thead th.sortable:hover { color: #2455A6; }
.sort-icon { font-size: 0.75rem; color: #9ca3af; margin-left: 0.25rem; }
.members-table tbody td { padding: 0.875rem 1rem; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.member-row:hover { background: #f8f9ff; }
.members-table tbody tr:last-child td { border-bottom: none; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-danger { color: #dc2626; font-weight: 700; }

.member-name-cell { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.member-name { font-weight: 600; color: #1f2937; }
.mzk-id { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 0.8125rem; background: #f3f4f6; padding: 0.125rem 0.5rem; border-radius: 0.375rem; color: #4b5563; }

.badge { font-size: 0.6875rem; font-weight: 700; padding: 0.125rem 0.5rem; border-radius: 0.375rem; white-space: nowrap; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }

.tier-badge { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.8125rem; font-weight: 700; padding: 0.25rem 0.625rem; border-radius: 999px; white-space: nowrap; }
.tier-quaver { background: var(--primary-light); color: #4338ca; }
.tier-crotchet { background: #ecfeff; color: #0e7490; }
.tier-minim { background: #f0fdf4; color: #15803d; }
.tier-semibreve { background: #fff7ed; color: #c2410c; }
.tier-conductor { background: #fdf4ff; color: #a21caf; }

.status-badge { font-size: 0.75rem; font-weight: 700; padding: 0.25rem 0.625rem; border-radius: 999px; }
.status-active { background: #dcfce7; color: #15803d; }
.status-inactive { background: #f3f4f6; color: #6b7280; }

.action-buttons { display: flex; gap: 0.375rem; }
.btn-icon { background: #f3f4f6; border: none; border-radius: 0.375rem; padding: 0.375rem 0.5rem; cursor: pointer; font-size: 0.9375rem; transition: background 0.2s ease; }
.btn-icon:hover { background: #e5e7eb; }
.btn-icon.btn-danger { background: #fef2f2; }
.btn-icon.btn-danger:hover { background: #fee2e2; }

/* 空狀態 */
.empty-state { text-align: center; padding: 3rem 1rem !important; color: #9ca3af; }
.empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.empty-text { font-size: 0.9375rem; }

/* 分頁 */
.pagination { display: flex; align-items: center; gap: 0.375rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
.pagination-btn { padding: 0.5rem 0.875rem; border: 1px solid #d1d5db; background: #fff; border-radius: 0.5rem; cursor: pointer; font-weight: 600; font-size: 0.875rem; color: #374151; font-family: inherit; }
.pagination-btn:hover:not(:disabled) { border-color: #2455A6; color: #2455A6; }
.pagination-btn.active { background: #2455A6; border-color: #2455A6; color: #fff; }
.pagination-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.pagination-ellipsis { padding: 0 0.25rem; color: #9ca3af; }

/* 批量操作 */
.bulk-actions {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #1f2937;
  color: #fff;
  padding: 0.875rem 1.5rem;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(15,23,42,0.35);
  z-index: 200;
}
.bulk-count { font-size: 0.9375rem; }
.bulk-count strong { color: #FBAB18; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 300; display: none; align-items: center; justify-content: center; padding: 1.5rem; }
.modal-overlay { position: absolute; inset: 0; background: rgba(15,23,42,0.5); }
.modal-content { position: relative; background: #fff; border-radius: 1rem; width: 100%; max-width: 520px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(15,23,42,0.3); }
.modal-content.modal-lg { max-width: 680px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid #e5e7eb; }
.modal-title { font-size: 1.25rem; font-weight: 800; margin: 0; color: #1f2937; }
.modal-close { background: none; border: none; font-size: 1.25rem; cursor: pointer; color: #6b7280; line-height: 1; }
.modal-close:hover { color: #1f2937; }
.modal-body { padding: 1.5rem; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.75rem; padding: 1.25rem 1.5rem; border-top: 1px solid #e5e7eb; }

.form-section { margin-bottom: 1.5rem; }
.form-section:last-child { margin-bottom: 0; }
.form-section-title { font-size: 0.9375rem; font-weight: 700; color: #2455A6; margin: 0 0 0.875rem 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 540px) { .form-row { grid-template-columns: 1fr; } }
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.8125rem; font-weight: 600; color: #374151; margin-bottom: 0.375rem; }
.form-label.required::after { content: " *"; color: #dc2626; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 0.625rem 0.75rem; border: 1px solid #d1d5db; border-radius: 0.5rem;
  font-size: 0.9375rem; font-family: inherit; box-sizing: border-box;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: #2455A6; box-shadow: 0 0 0 3px rgba(36,85,166,0.12); }
.form-textarea { resize: vertical; }

.info-box { display: flex; gap: 0.5rem; align-items: flex-start; background: var(--primary-light); border: 1px solid #bfdbfe; border-radius: 0.5rem; padding: 0.75rem 0.875rem; font-size: 0.8125rem; color: #1e40af; }
.info-icon { flex-shrink: 0; }

/* 詳情 Modal */
.detail-section { margin-bottom: 1.5rem; }
.detail-section:last-child { margin-bottom: 0; }
.detail-section-title { font-size: 0.9375rem; font-weight: 700; color: #2455A6; margin: 0 0 0.75rem 0; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.875rem 1.5rem; }
@media (max-width: 540px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-item { display: flex; flex-direction: column; gap: 0.25rem; }
.detail-label { font-size: 0.75rem; color: #6b7280; }
.detail-value { font-size: 0.9375rem; color: #1f2937; font-weight: 600; }

/* Toast */
.mk-toast { position: fixed; bottom: 1.5rem; right: 1.5rem; background: #1f2937; color: #fff; padding: 0.875rem 1.25rem; border-radius: 0.625rem; font-weight: 600; font-size: 0.9375rem; box-shadow: 0 10px 30px rgba(15,23,42,0.35); opacity: 0; transform: translateY(1rem); transition: all 0.3s ease; z-index: 400; pointer-events: none; }
.mk-toast.show { opacity: 1; transform: translateY(0); }
.mk-toast.toast-success { background: #15803d; }
.mk-toast.toast-error { background: #dc2626; }
