/* ==========================================================================
   components.css — 재사용 가능한 UI 컴포넌트
   버튼, 카드, 배지, 토스트, 프로그래스 바, 탭, 테이블,
   스켈레톤, 하단 내비게이션, 플로팅 액션 버튼
   ========================================================================== */

/* ==================================================================
   버튼 (.btn)
   Bootstrap 버튼을 보완하는 WYD 커스텀 버튼 스타일
   ================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--wyd-space-sm);
  padding: var(--wyd-space-sm) var(--wyd-space-lg);
  font-family: var(--wyd-font-body);
  font-size: var(--wyd-fs-base);
  font-weight: var(--wyd-fw-medium);
  line-height: 1.5;
  border-radius: var(--wyd-radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--wyd-transition-base);
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--wyd-primary);
  outline-offset: 2px;
}

/* 기본 버튼 (Primary) */
.btn-primary,
.btn.primary {
  background-color: var(--wyd-primary);
  color: var(--wyd-text-inverse);
  border-color: var(--wyd-primary);
}

.btn-primary:hover,
.btn.primary:hover {
  background-color: var(--wyd-primary-dark);
  border-color: var(--wyd-primary-dark);
  color: var(--wyd-text-inverse);
  box-shadow: var(--wyd-shadow-md);
}

/* 보조 버튼 (Secondary) */
.btn-secondary,
.btn.secondary {
  background-color: var(--wyd-secondary);
  color: var(--wyd-text-inverse);
  border-color: var(--wyd-secondary);
}

.btn-secondary:hover,
.btn.secondary:hover {
  background-color: var(--wyd-secondary-dark);
  border-color: var(--wyd-secondary-dark);
  color: var(--wyd-text-inverse);
  box-shadow: var(--wyd-shadow-md);
}

/* 아웃라인 버튼 (Outline) */
.btn-outline,
.btn.outline {
  background-color: transparent;
  color: var(--wyd-primary);
  border-color: var(--wyd-primary);
}

.btn-outline:hover,
.btn.outline:hover {
  background-color: var(--wyd-primary);
  color: var(--wyd-text-inverse);
}

/* 고스트 버튼 (Ghost — 배경/테두리 없음) */
.btn-ghost,
.btn.ghost {
  background-color: transparent;
  color: var(--wyd-primary);
  border-color: transparent;
}

.btn-ghost:hover,
.btn.ghost:hover {
  background-color: rgba(var(--wyd-primary-rgb), 0.08);
}

/* 버튼 크기 변형 */
.btn-sm {
  padding: var(--wyd-space-xs) var(--wyd-space-md);
  font-size: var(--wyd-fs-sm);
}

.btn-lg {
  padding: var(--wyd-space-md) var(--wyd-space-xl);
  font-size: var(--wyd-fs-lg);
}

/* 전체 너비 버튼 */
.btn-block {
  width: 100%;
}

/* 비활성 버튼 */
.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==================================================================
   카드 (.card)
   기본 카드 + 엘리베이션(그림자) 변형
   ================================================================== */
.card {
  background-color: var(--wyd-surface);
  border: 1px solid var(--wyd-border-light);
  border-radius: var(--wyd-radius-lg);
  padding: var(--wyd-space-lg);
  transition: box-shadow var(--wyd-transition-base),
              transform var(--wyd-transition-base);
}

/* 호버 시 살짝 올라오는 효과 */
.card:hover {
  box-shadow: var(--wyd-shadow-sm);
}

/* 엘리베이션 카드 (그림자 강조) */
.card-elevated,
.card.elevated {
  border: none;
  box-shadow: var(--wyd-shadow-md);
}

.card-elevated:hover,
.card.elevated:hover {
  box-shadow: var(--wyd-shadow-lg);
  transform: translateY(-2px);
}

/* 카드 내부 요소 */
.card-header {
  padding-bottom: var(--wyd-space-md);
  border-bottom: 1px solid var(--wyd-border-light);
  margin-bottom: var(--wyd-space-md);
}

.card-title {
  font-family: var(--wyd-font-heading);
  font-size: var(--wyd-fs-lg);
  font-weight: var(--wyd-fw-semibold);
  color: var(--wyd-text);
  margin: 0;
}

.card-body {
  color: var(--wyd-text);
}

.card-footer {
  padding-top: var(--wyd-space-md);
  border-top: 1px solid var(--wyd-border-light);
  margin-top: var(--wyd-space-md);
}

/* 카드 이미지 */
.card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--wyd-radius-lg) var(--wyd-radius-lg) 0 0;
  margin: calc(var(--wyd-space-lg) * -1);
  margin-bottom: var(--wyd-space-md);
  width: calc(100% + var(--wyd-space-lg) * 2);
}

/* ==================================================================
   배지 (.badge)
   info, success, warning 변형
   ================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--wyd-space-xs);
  padding: 2px var(--wyd-space-sm);
  font-size: var(--wyd-fs-xs);
  font-weight: var(--wyd-fw-semibold);
  border-radius: var(--wyd-radius-full);
  line-height: 1.5;
  white-space: nowrap;
}

/* 정보 배지 */
.badge-info,
.badge.info {
  background-color: rgba(52, 152, 219, 0.12);
  color: var(--wyd-info);
}

/* 성공 배지 */
.badge-success,
.badge.success {
  background-color: rgba(46, 204, 113, 0.12);
  color: var(--wyd-success);
}

/* 경고 배지 */
.badge-warning,
.badge.warning {
  background-color: rgba(243, 156, 18, 0.12);
  color: var(--wyd-warning);
}

/* 위험 배지 */
.badge-danger,
.badge.danger {
  background-color: rgba(231, 76, 60, 0.12);
  color: var(--wyd-danger);
}

/* 기본 배지 */
.badge-primary,
.badge.primary {
  background-color: rgba(var(--wyd-primary-rgb), 0.12);
  color: var(--wyd-primary);
}

/* ==================================================================
   토스트 (.toast-container + .toast)
   우측 하단 고정, 페이드 애니메이션
   ================================================================== */
.toast-container {
  position: fixed;
  bottom: var(--wyd-space-xl);
  right: var(--wyd-space-xl);
  z-index: var(--wyd-z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--wyd-space-sm);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--wyd-space-md);
  padding: var(--wyd-space-md) var(--wyd-space-lg);
  background-color: var(--wyd-surface);
  border: 1px solid var(--wyd-border-light);
  border-radius: var(--wyd-radius-lg);
  box-shadow: var(--wyd-shadow-lg);
  min-width: 300px;
  max-width: 420px;
  pointer-events: auto;
  /* 애니메이션 초기 상태 */
  opacity: 0;
  transform: translateX(100%);
  animation: toastSlideIn var(--wyd-transition-base) forwards;
}

/* 토스트 슬라이드 인 */
@keyframes toastSlideIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 토스트 페이드 아웃 */
.toast.fade-out {
  animation: toastFadeOut var(--wyd-transition-base) forwards;
}

@keyframes toastFadeOut {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* 토스트 아이콘 */
.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--wyd-fs-lg);
}

/* 토스트 내용 */
.toast-body {
  flex: 1;
}

.toast-title {
  font-weight: var(--wyd-fw-semibold);
  font-size: var(--wyd-fs-sm);
  margin-bottom: 2px;
}

.toast-message {
  font-size: var(--wyd-fs-sm);
  color: var(--wyd-text-secondary);
}

/* 토스트 닫기 버튼 */
.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--wyd-text-muted);
  cursor: pointer;
  padding: var(--wyd-space-xs);
  font-size: var(--wyd-fs-lg);
  transition: color var(--wyd-transition-base);
}

.toast-close:hover {
  color: var(--wyd-text);
}

/* 토스트 유형별 좌측 강조선 */
.toast.toast-success { border-left: 4px solid var(--wyd-success); }
.toast.toast-error   { border-left: 4px solid var(--wyd-danger); }
.toast.toast-warning { border-left: 4px solid var(--wyd-warning); }
.toast.toast-info    { border-left: 4px solid var(--wyd-info); }

/* ==================================================================
   프로그래스 바 (.progress-bar)
   애니메이션 채우기 효과
   ================================================================== */
.progress {
  width: 100%;
  height: 8px;
  background-color: var(--wyd-border-light);
  border-radius: var(--wyd-radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--wyd-primary), var(--wyd-primary-light));
  border-radius: var(--wyd-radius-full);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* 애니메이션 광택 효과 */
.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* 프로그래스 바 색상 변형 */
.progress-bar.success { background: linear-gradient(90deg, var(--wyd-success), #5dde9e); }
.progress-bar.warning { background: linear-gradient(90deg, var(--wyd-warning), #f7b731); }
.progress-bar.danger  { background: linear-gradient(90deg, var(--wyd-danger), #e97777); }

/* 프로그래스 라벨 */
.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--wyd-space-xs);
  font-size: var(--wyd-fs-sm);
  color: var(--wyd-text-secondary);
}

/* ==================================================================
   탭 내비게이션 (.tab-nav) — 언더라인 스타일
   ================================================================== */
.tab-nav {
  display: flex;
  border-bottom: 2px solid var(--wyd-border-light);
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tab-nav::-webkit-scrollbar {
  display: none;
}

.tab-nav-item {
  position: relative;
  padding: var(--wyd-space-md) var(--wyd-space-lg);
  font-size: var(--wyd-fs-base);
  font-weight: var(--wyd-fw-medium);
  color: var(--wyd-text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--wyd-transition-base);
  text-decoration: none;
}

.tab-nav-item:hover {
  color: var(--wyd-primary);
}

/* 활성 탭 */
.tab-nav-item.active {
  color: var(--wyd-primary);
  font-weight: var(--wyd-fw-semibold);
}

/* 활성 탭 언더라인 인디케이터 */
.tab-nav-item.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--wyd-primary);
  border-radius: var(--wyd-radius-full);
}

/* 탭 콘텐츠 */
.tab-content {
  padding: var(--wyd-space-lg) 0;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: tabFadeIn var(--wyd-transition-base) ease-out;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==================================================================
   반응형 테이블 (.table-responsive)
   모바일에서 가로 스크롤
   ================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--wyd-radius-md);
  border: 1px solid var(--wyd-border-light);
}

.table-responsive table {
  width: 100%;
  border-collapse: collapse;
}

.table-responsive th,
.table-responsive td {
  padding: var(--wyd-space-sm) var(--wyd-space-md);
  text-align: left;
  font-size: var(--wyd-fs-sm);
  border-bottom: 1px solid var(--wyd-border-light);
  white-space: nowrap;
}

.table-responsive th {
  background-color: var(--wyd-bg);
  font-weight: var(--wyd-fw-semibold);
  color: var(--wyd-text-secondary);
  font-size: var(--wyd-fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table-responsive tr:hover td {
  background-color: var(--wyd-surface-hover);
}

/* ==================================================================
   스켈레톤 로딩 (.skeleton)
   콘텐츠 로딩 중 플레이스홀더 애니메이션
   ================================================================== */
.skeleton {
  position: relative;
  overflow: hidden;
  background-color: var(--wyd-border-light);
  border-radius: var(--wyd-radius-md);
}

/* 반짝이는 애니메이션 */
.skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.5) 50%,
    transparent 100%
  );
  animation: skeletonShimmer 1.5s ease-in-out infinite;
}

@keyframes skeletonShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* 스켈레톤 크기 변형 */
.skeleton-text {
  height: 16px;
  margin-bottom: var(--wyd-space-sm);
  width: 100%;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-title {
  height: 24px;
  width: 40%;
  margin-bottom: var(--wyd-space-md);
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--wyd-radius-full);
}

.skeleton-img {
  width: 100%;
  height: 200px;
}

.skeleton-card {
  height: 300px;
}

/* ==================================================================
   하단 내비게이션 (.bottom-nav)
   → 실제 사용 정의는 하단(inc_footer.asp 대응)에 통합
   ================================================================== */

/* ==================================================================
   플로팅 액션 버튼 (.fab)
   우측 하단 고정 원형 버튼
   ================================================================== */
.fab {
  position: fixed;
  bottom: var(--wyd-space-xl);
  right: var(--wyd-space-xl);
  width: 56px;
  height: 56px;
  background-color: var(--wyd-primary);
  color: var(--wyd-text-inverse);
  border: none;
  border-radius: var(--wyd-radius-full);
  font-size: var(--wyd-fs-xl);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--wyd-shadow-lg);
  z-index: var(--wyd-z-fab);
  transition: all var(--wyd-transition-base);
}

.fab:hover {
  background-color: var(--wyd-primary-dark);
  transform: scale(1.08);
  box-shadow: var(--wyd-shadow-xl);
}

.fab:active {
  transform: scale(0.96);
}

/* 모바일에서 하단 내비게이션 위로 위치 조정 */
@media (max-width: 767.98px) {
  .fab {
    bottom: calc(var(--wyd-bottom-nav-height) + var(--wyd-space-md));
    right: var(--wyd-space-md);
    width: 48px;
    height: 48px;
    font-size: var(--wyd-fs-lg);
  }

  /* 토스트 위치도 하단 내비게이션 위로 */
  .toast-container {
    bottom: calc(var(--wyd-bottom-nav-height) + var(--wyd-space-md));
    right: var(--wyd-space-md);
    left: var(--wyd-space-md);
  }

  .toast {
    min-width: auto;
    max-width: none;
  }
}

/* ==================================================================
   푸터 (#footer)
   ================================================================== */
#footer {
    background: #1a1a2e;
    color: #ccc;
    padding: 30px 0 20px;
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    text-align: center;
}
.footer-links {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    display: flex;
    justify-content: center;
    gap: 24px;
}
.footer-links li a {
    color: #ccc;
    text-decoration: none;
    font-size: 0.85rem;
}
.footer-links li a:hover {
    color: #fff;
}
.footer-links li a.privacy {
    font-weight: 700;
    color: #FFD700;
}
.footer-sns {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}
.footer-sns__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    text-decoration: none;
    transition: background 0.2s, transform 0.2s;
    overflow: hidden;
}
.footer-sns__icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}
.footer-sns__icon:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}
.footer-sns__x-icon {
    font-size: 18px;
    color: #fff;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}
.footer-sns-title {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    margin: 0 0 12px 0;
    text-align: center;
    font-weight: 500;
    letter-spacing: 0.5px;
}
.footer-copy {
    font-size: 0.8rem;
    color: #888;
    margin: 0;
}

/* 맨 위로 버튼 */
.btn-to-top {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: #1D48A1;
    color: #fff;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 200;
    transition: background 0.2s;
}
.btn-to-top:hover {
    background: #163a80;
    color: #fff;
}

/* ==================================================================
   더보기 팝업 메뉴 (.more-menu)
   ================================================================== */
.more-menu {
    position: fixed;
    bottom: calc(var(--wyd-bottom-nav-height, 56px) + 8px);
    right: 12px;
    background: var(--wyd-surface, #fff);
    border-radius: 12px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    padding: 8px 0;
    z-index: var(--wyd-z-bottom-nav, 250);
    min-width: 160px;
}
.more-menu__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--wyd-text, #333);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background var(--wyd-transition-base);
}
.more-menu__item:hover {
    background: rgba(var(--wyd-primary-rgb, 29,72,161), 0.06);
    color: var(--wyd-primary);
}
.more-menu__item i {
    width: 18px;
    text-align: center;
    color: var(--wyd-text-secondary, #888);
}
.more-menu__item:hover i {
    color: var(--wyd-primary);
}

/* ==================================================================
   하단 내비게이션 (.bottom-nav) — inc_footer.asp 대응
   ================================================================== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--wyd-surface);
    border-top: 1px solid var(--wyd-border-light);
    z-index: var(--wyd-z-bottom-nav, 250);
}
.bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: var(--wyd-space-xs) 0;
    color: var(--wyd-text-muted);
    text-decoration: none;
    font-size: 0.65rem;
    transition: color var(--wyd-transition-base);
}
.bottom-nav__item i {
    font-size: 1.2rem;
    margin-bottom: 2px;
}
.bottom-nav__item:hover,
.bottom-nav__item.active {
    color: var(--wyd-primary);
}

@media (max-width: 767.98px) {
    .bottom-nav {
        display: flex;
    }
    .btn-to-top {
        bottom: calc(var(--wyd-bottom-nav-height) + var(--wyd-space-sm));
    }
}
