/**
 * App Shell Styles
 * 
 * 스켈레톤 로더, 페이지 전환 애니메이션, Delay Overlay Skeleton
 * 
 * @package Nexi_Native_App_Theme
 * @since 1.2.0
 */

/* ========================================
   Delay Overlay Skeleton (BEM 방식)
   ======================================== */

/* 오버레이 컨테이너 */
.nx-skel-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #fff;
  opacity: 0;
  transition: opacity 0.15s ease-in;
  overflow-y: auto;
}

.nx-skel-overlay.show {
  opacity: 1;
}

/* ========================================
   스켈레톤 공통 스타일 (BEM)
   ======================================== */

/* 베이스 컨테이너 */
.skel {
  min-height: 100vh;
  background: #fff;
}

/* 공통 쉬머 애니메이션 */
.skel__header,
.skel__tabs,
.skel__avatar,
.skel__line,
.skel__toggle,
.skel__field,
.skel__card,
.skel__footer-btn {
  background: linear-gradient(
    90deg,
    #f0f0f0 0%,
    #f0f0f0 40%,
    #e8e8e8 50%,
    #f0f0f0 60%,
    #f0f0f0 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

/* ========================================
   레이아웃 요소
   ======================================== */

/* 헤더 (고정) */
.skel__header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  border-radius: 0;
  border-bottom: 1px solid #e0e0e0;
  z-index: 100;
}

/* 탭 */
.skel__tabs {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  height: 48px;
  border-radius: 0;
  border-bottom: 1px solid #e0e0e0;
  z-index: 99;
}

/* 리스트 컨테이너 */
.skel__list {
  padding: 0;
}

/* 폼 컨테이너 */
.skel__form {
  padding: 16px;
  padding-bottom: 80px;
}

/* 하단 버튼 (고정) */
.skel__footer-btn {
  position: fixed;
  bottom: 12px;
  left: 16px;
  right: 16px;
  height: 56px;
  z-index: 98;
}

/* ========================================
   아이템 요소
   ======================================== */

/* 기본 아이템 */
.skel__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
}

/* 설정 아이템 (토글 포함) */
.skel__item--setting {
  justify-content: space-between;
}

/* 카드 */
.skel__card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  margin: 0 16px 12px 16px;
  border-radius: 12px;
  background: #f8f8f8;
}

/* ========================================
   컨텐츠 요소
   ======================================== */

/* 아바타 */
.skel__avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skel__avatar--large {
  width: 56px;
  height: 56px;
}

/* 컨텐츠 영역 */
.skel__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 텍스트 라인 */
.skel__line {
  height: 14px;
  border-radius: 4px;
}

.skel__line--title {
  width: 60%;
  height: 16px;
}

.skel__line--meta {
  width: 40%;
  height: 12px;
}

/* 토글 */
.skel__toggle {
  flex-shrink: 0;
  width: 51px;
  height: 31px;
  border-radius: 16px;
}

/* 폼 필드 */
.skel__field {
  height: 80px;
  margin-bottom: 16px;
  border-radius: 8px;
}

.skel__field--large {
  height: 240px;
}

/* ========================================
   페이지별 Modifier (실제 컨테이너 폭/패딩 맞춤)
   ======================================== */

/* 알림 페이지 */
.skel--notif .skel__list {
  margin-top: 104px; /* 헤더 + 탭 */
  max-width: 100%;
  padding: 0;
  background: #fff;
}

.skel--notif .skel__item {
  padding: 12px 16px; /* 실제 알림 아이템 패딩 */
  border-bottom: 1px solid #f0f0f0;
}

/* 알림 설정 페이지 */
.skel--settings .skel__list {
  margin-top: 56px; /* 헤더만 */
  max-width: 100%;
  padding: 16px 0; /* settings-content 패딩 */
  background: #fff;
  min-height: calc(100vh - 56px);
}

.skel--settings .skel__item {
  padding: 20px 16px; /* notification-item 패딩 */
  border-bottom: 1px solid #f0f0f0;
}

/* 그룹 생성 페이지 */
.skel--create .skel__form {
  margin-top: 56px;
  padding: 16px; /* 실제 폼 패딩 */
  padding-bottom: 80px;
}

/* 그룹 목록 페이지 (AJAX) */
.skel--groups .skel__list {
  padding: 0;
  max-width: 100%;
  background: #fff;
}

.skel--groups .skel__card {
  padding: 16px; /* karrot-group-item 패딩 */
  margin: 0;
  border-bottom: 1px solid #f0f0f0;
  border-radius: 0;
  background: #fff;
}

/* 스켈레톤 로딩 애니메이션 */
@keyframes skeleton-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes skeleton-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.skeleton-loading {
  pointer-events: none;
}

.skeleton-box {
  background: linear-gradient(
    90deg,
    #f0f0f0 0%,
    #f0f0f0 40%,
    #e8e8e8 50%,
    #f0f0f0 60%,
    #f0f0f0 100%
  ) !important;
  background-size: 200% 100% !important;
  animation: skeleton-shimmer 1.5s ease-in-out infinite !important;
  border-radius: 8px !important;
  display: inline-block !important;
  min-height: 20px !important;
}

/* 스켈레톤 컨테이너 */
.app-shell-skeleton {
  background: #fff;
  min-height: 100vh;
}

/* 페이지 전환 애니메이션 */
@keyframes app-shell-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-shell-fade-in {
  animation: app-shell-fade-in 0.3s ease-out;
}

/* App Shell 활성화 상태 */
.app-shell-enabled {
  /* 추가 스타일 필요 시 */
}

/* 로딩 중 커서 */
.app-shell-enabled.is-navigating {
  cursor: wait;
}

/* ========================================
   Groups List Skeleton
   ======================================== */
.karrot-group-item.skeleton-loading {
  margin-bottom: 16px;
}

.karrot-group-item.skeleton-loading .karrot-group-thumbnail.skeleton-box {
  width: 80px;
  height: 80px;
  border-radius: 12px;
}

.karrot-group-item.skeleton-loading .skeleton-title {
  width: 60%;
  height: 20px;
  margin-bottom: 8px;
}

.karrot-group-item.skeleton-loading .skeleton-desc {
  width: 90%;
  height: 16px;
  margin-bottom: 8px;
}

.karrot-group-item.skeleton-loading .skeleton-meta {
  width: 70%;
  height: 14px;
}

/* ========================================
   Groups Create Skeleton
   ======================================== */
.karrot-create-skeleton {
  width: 100%;
  min-height: 100vh;
  background-color: #fff;
  padding-bottom: 80px;
}

.karrot-skeleton-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: #fff;
  border-bottom: 1px solid #e5e5e5;
}

.karrot-skeleton-back {
  width: 44px;
  height: 44px;
  background-color: #f2f2f2;
  border-radius: 50%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.karrot-skeleton-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 24px;
  background-color: #f2f2f2;
  border-radius: 4px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.karrot-skeleton-submit {
  width: 60px;
  height: 20px;
  background-color: #f2f2f2;
  border-radius: 4px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.karrot-skeleton-body {
  padding: 0;
}

.karrot-skeleton-section {
  background-color: #fff;
  padding: 24px 16px;
  border-bottom: 1px solid #f2f2f2;
}

.karrot-skeleton-label {
  width: 100px;
  height: 20px;
  margin-bottom: 16px;
  background-color: #f2f2f2;
  border-radius: 4px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.karrot-skeleton-input {
  width: 100%;
  height: 56px;
  background-color: #f2f2f2;
  border-radius: 8px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.karrot-skeleton-textarea {
  width: 100%;
  height: 200px;
  background-color: #f2f2f2;
  border-radius: 8px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.karrot-skeleton-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background-color: #fff;
  border-top: 1px solid #e5e5e5;
  z-index: 99;
}

.karrot-skeleton-button {
  width: 100%;
  height: 56px;
  background-color: #f2f2f2;
  border-radius: 8px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

/* ========================================
   Notifications Page Skeleton
   ======================================== */
.notice-skeleton {
  width: 100%;
  min-height: 100vh;
  background-color: #f5f5f5;
}

.notice-skeleton-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}

.skeleton-back-btn,
.skeleton-settings-btn {
  width: 40px;
  height: 40px;
  background-color: #f2f2f2;
  border-radius: 50%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.notice-skeleton-header .skeleton-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 22px;
  background-color: #f2f2f2;
  border-radius: 4px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.notice-skeleton-tabs {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  height: 48px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  gap: 16px;
  padding: 0 16px;
  align-items: center;
  z-index: 99;
}

.skeleton-tab {
  width: 80px;
  height: 20px;
  background-color: #f2f2f2;
  border-radius: 4px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.notice-skeleton-content {
  margin-top: 104px;
  background: #fff;
  padding: 0;
}

.notice-skeleton-item {
  padding: 16px 8px;
  border-bottom: 1px solid #f0f0f0;
  display: grid;
  grid-template-columns: 40px 1fr 80px;
  gap: 8px;
  align-items: center;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  background-color: #f2f2f2;
  border-radius: 50%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-text-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-text-line {
  width: 100%;
  height: 14px;
  background-color: #f2f2f2;
  border-radius: 4px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-text-line.short {
  width: 60%;
  height: 12px;
}

.skeleton-action {
  width: 60px;
  height: 20px;
  background-color: #f2f2f2;
  border-radius: 4px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  justify-self: end;
}

/* ========================================
   Notification Settings Page Skeleton
   ======================================== */
.settings-skeleton {
  width: 100%;
  min-height: 100vh;
  background-color: #f5f5f5;
}

.settings-skeleton-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
}

.settings-skeleton-header .skeleton-title {
  margin-left: 8px;
  width: 80px;
  height: 22px;
  background-color: #f2f2f2;
  border-radius: 4px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.settings-skeleton-content {
  margin-top: 56px;
  padding: 16px 0;
  background: #fff;
}

.settings-skeleton-item {
  padding: 20px 16px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-skeleton-item .skeleton-text-group {
  flex: 1;
  min-width: 0;
}

.skeleton-toggle {
  width: 51px;
  height: 31px;
  background-color: #f2f2f2;
  border-radius: 31px;
  flex-shrink: 0;
  margin-left: 16px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}
