/**
 * 미아 이미지 관리 페이지 스타일
 * AR Namecard Admin - Orphaned Images Management
 */

/* 통계 카드 */
.stat-card {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-card h6 {
  color: #6c757d;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: bold;
  color: #495057;
}

/* 체크포인트 및 파일 경로 스타일 */
.checkpoint-id,
.file-path {
  font-family: "Courier New", monospace;
  background-color: #f8f9fa;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid #dee2e6;
}

.checkpoint-id {
  font-size: 0.875rem;
}

.file-path {
  font-size: 0.75rem;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 체크포인트 정보 스타일 */
.checkpoint-info {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 15px;
  margin: 15px 0;
}

.checkpoint-info p {
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.checkpoint-info p:last-child {
  margin-bottom: 0;
}

.checkpoint-info strong {
  color: #495057;
  min-width: 80px;
  display: inline-block;
}

/* 체크포인트 액션 버튼 그룹 */
/* Buttons inherit from common.css */
.btn-group .btn { margin-right: 2px; }

.btn-group .btn:last-child {
  margin-right: 0;
}

/* 체크포인트 ID 스타일 */
.checkpoint-id {
  font-family: "Courier New", monospace;
  background: #e9ecef;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* 이유 배지 스타일 */
.reason-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-weight: 600;
  display: inline-block;
}

.reason-not_referenced {
  background-color: #e9ecef;
  color: #343a40;
}

.reason-broken_reference {
  background-color: #dee2e6;
  color: #495057;
}

.reason-old_temporary {
  background-color: #adb5bd;
  color: #212529;
}

/* 검증 단계 스타일 */
.verification-step {
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  border-left: 3px solid #007bff;
  background-color: #f8f9fa;
  border-radius: 0 4px 4px 0;
  transition: border-color 0.3s ease;
}

.verification-step:hover {
  border-left-color: #0056b3;
}

.verification-step strong {
  color: #495057;
}

.verification-step small {
  display: block;
  margin-top: 0.25rem;
}
.small li {
  padding-left: 24px;
}
.small li:last-child {
  margin-bottom: 20px;
}
.u-flex-col h3 {
  margin-left: 10px;
}

/* 빈 상태 표시 */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #6c757d;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state p {
  font-size: 1.1rem;
  margin: 0;
}

/* 워크플로우 단계 */
.workflow-steps {
  display: flex;
  justify-content: space-between;
  margin: 1rem 0 0.5rem 0;
  padding: 0;
  list-style: none;
}

.workflow-steps li {
  flex: 1;
  text-align: center;
  position: relative;
}

/* 상단 컨테이너 간격/배지 톤 통일 */
.orphaned-images-container .section-title { margin-bottom: 8px; }
.orphaned-images-container .badge { background: var(--blue-light); color: var(--gray-700); border: 1px solid var(--gray-200); }

@media (max-width: 768px) {
  .orphaned-images-container .u-flex { flex-wrap: wrap; gap: 8px; }
}

.workflow-steps li:not(:last-child):after {
  content: "";
  position: absolute;
  top: 20px;
  right: -50%;
  width: 100%;
  height: 2px;
  background-color: #dee2e6;
  z-index: -1;
}

.workflow-step { display:inline-flex; align-items:center; justify-content:center; width:56px; height:56px; border-radius:50%; background:#f1f5f9; color:#374151; font-weight:600; margin:8px auto; }

.workflow-step.active { background: var(--blue-light); color: var(--gray-700); box-shadow: 0 0 0 3px rgba(102,126,234,.25); }

.workflow-step.completed { background: var(--blue-light); color: var(--gray-700); }

.workflow-step.completed::after {
  content: "✓";
  position: absolute;
  right: -5px;
  top: -5px;
  background: white;
  color: #495057;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  line-height: 20px;
  font-size: 14px;
  border: 2px solid #495057;
}

/* 알림 스타일 개선 */
.orphaned-alert {
  position: relative;
  margin-bottom: 1rem;
  animation: slideDown 0.3s ease;
}

/* slideDown 애니메이션은 common.css에서 제공 */

.orphaned-alert .btn-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

/* 로딩 오버레이 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  backdrop-filter: blur(2px);
  display: none;
}

.loading-overlay.show {
  display: flex;
  justify-content: center;
  align-items: center;
}

.loading-content {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  min-width: 250px;
  max-width: 400px;
  word-wrap: break-word;
  word-break: keep-all;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.loading-content .spinner-border {
  width: 3rem;
  height: 3rem;
  border-width: 0.3rem;
  margin-bottom: 1rem;
  transform-origin: center center;
  position: relative;
  display: block;
  margin-left: auto;
  margin-right: auto;
  border: 0.3rem solid #f3f3f3;
  border-top: 0.3rem solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-content p {
  margin: 0;
  color: #495057;
  font-weight: 500;
  white-space: nowrap;
  word-spacing: normal;
  letter-spacing: 0.02em;
  font-size: 0.95rem;
  text-align: center;
  width: 100%;
}

/* 테이블 개선 */
/* Tables inherit base styles from common.css; keep container shadow */
.table-responsive { border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.05); }

/* thead styling moved to common.css */

/* row hover moved to common.css */

/* 버튼 그룹 스타일 */
.btn-group-sm .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

/* 모달 스타일 개선 */
/* modal content base from common.css; keep width override */
.modal-content { width: 1000px !important; max-width: 1000px !important; }

.modal-header {
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  border-radius: 12px 12px 0 0;
}

.modal-footer {
  background-color: #f8f9fa;
  border-top: 1px solid #dee2e6;
  border-radius: 0 0 12px 12px;
}

/* 통계 요약 카드 */
.orphans-summary {
  margin-bottom: 2rem;
}

.orphans-summary .row {
  gap: 1rem;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
  .workflow-steps {
    flex-direction: column;
    align-items: center;
  }

  .workflow-steps li {
    margin-bottom: 1rem;
  }

  .workflow-steps li:not(:last-child):after {
    display: none;
  }

  .table-responsive {
    font-size: 0.875rem;
  }

  .btn-group-sm {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }

  .btn-group-sm .btn {
    width: 100%;
  }

  /* 모바일 로딩 컨텐츠 개선 */
  .loading-content {
    min-width: 280px;
    max-width: 90vw;
    padding: 1.5rem;
  }

  .loading-content p {
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: nowrap;
  }
}

/* 다크 모드 지원 (선택적) */
@media (prefers-color-scheme: dark) {
  .stat-card {
    background: #ffffff;
    border-color: #e2e2e2;
    color: #666;
  }

  .stat-card h6 {
    color: #adb5bd;
  }

  .stat-number {
    color: #f8f9fa;
  }

  .checkpoint-id,
  .file-path {
    background-color: #495057;
    color: #f8f9fa;
    border-color: #6c757d;
  }

  .verification-step {
    background-color: #343a40;
    border-left-color: #0d6efd;
  }

  .loading-content {
    background: #343a40;
    color: #f8f9fa;
  }

  .loading-content p {
    color: #e9ecef;
    font-weight: 400;
    text-align: center;
    width: 100%;
  }
}

/* 애니메이션은 common.css에서 제공 - .fade-in 클래스 사용 */
.fade-in {
  animation: fadeIn 0.5s ease;
}

/* 스크롤바는 common.css의 .common-scrollbar 클래스 사용 */

/* 이미지 미리보기 스타일 */
.image-preview-card {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  transition: all 0.3s ease;
  /* height: 100%; */
}

.image-preview-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.image-container {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: #f8f9fa;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.preview-image:hover {
  transform: scale(1.05);
}

.error-image {
  opacity: 0.5;
  filter: grayscale(100%);
}

.image-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(33, 37, 41, 0.8));
  padding: 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-container:hover .image-overlay {
  opacity: 1;
}

.image-info {
  text-align: center;
}

.image-details {
  font-size: 0.75rem;
  line-height: 1.2;
}

.image-details small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 모달 크기 조정 */
.modal-xl {
  max-width: 90%;
}

/* 이미지 미리보기 모달 중앙 정렬 */
#imagePreviewModal .modal-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  width: 90%;
  max-width: 1000px;
  align-items: center;
  justify-content: center;
}

#imagePreviewModal.show {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

#image-preview-container {
  max-height: 70vh;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  
}

.col-md-3 {
  min-width: 150px;
}

/* 로딩 상태 */
.image-container::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 1;
}
.image-container img {
  z-index: 2;
}

.preview-image[src*="data:image"] + .image-container::before {
  display: none;
}

/* 스피너 애니메이션 */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
