/* 출석체크 팝업 스타일 */

/* 팝업 오버레이 */
.attendance-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

@media (max-width: 640px) {
  .attendance-popup-overlay {
    padding: 0.5rem;
    padding-bottom: 1rem; /* 하단 패딩 감소 */
    align-items: flex-start;
    padding-top: 2rem; /* 상단 패딩 축소 */
  }
}

/* 배경 Dim 처리 */
.attendance-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

/* 팝업 컨테이너 */
.attendance-popup-container {
  position: relative;
  width: 100%;
  max-width: 42rem;
  max-height: 90vh;
  background: #111827;
  border-radius: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 1px solid #1f2937;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: attendance-popup-up 0.3s ease-out;
}

@media (max-width: 640px) {
  .attendance-popup-container {
    max-height: calc(100vh - 8rem); /* 높이를 더 늘려서 버튼이 보이도록 */
    border-radius: 1rem;
    margin-top: 0;
  }
}

@keyframes attendance-popup-up {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 배경 블러 효과 */
.attendance-popup-bg-blur {
  position: absolute;
  top: 0;
  right: 0;
  width: 16rem;
  height: 16rem;
  background: rgba(37, 99, 235, 0.1);
  filter: blur(80px);
  border-radius: 50%;
  pointer-events: none;
}

/* 헤더 */
.attendance-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 2rem;
  padding-bottom: 1rem;
  position: relative;
  z-index: 10;
}

.attendance-popup-header-left {
  flex: 1;
}

.attendance-popup-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.attendance-badge-daily {
  background: #2563eb;
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.attendance-badge-week {
  color: #6b7280;
  font-size: 0.75rem;
  font-weight: 700;
  display: none;
}

.attendance-popup-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: white;
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.attendance-icon-calendar {
  color: #60a5fa;
  flex-shrink: 0;
}

.attendance-popup-subtitle {
  font-size: 0.875rem;
  color: #9ca3af;
  margin-top: 0.25rem;
  margin-bottom: 0;
}

.attendance-xp-highlight {
  color: #60a5fa;
  font-weight: 700;
}

.attendance-popup-close {
  color: #6b7280;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attendance-popup-close:hover {
  color: white;
}

/* 메인 컨텐츠 */
.attendance-popup-content {
  padding: 2rem;
  padding-top: 1rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

@media (max-width: 640px) {
  .attendance-popup-content {
    padding: 0.75rem; /* 패딩 축소 */
    padding-top: 0.5rem; /* 상단 패딩 축소 */
    overflow-y: visible; /* 스크롤 없이 한 화면에 표시 */
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0; /* flex 아이템이 축소 가능하도록 */
  }
}

/* 일별 출석 그리드 */
.attendance-days-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .attendance-days-grid {
    grid-template-columns: repeat(7, 1fr);
  }
}

@media (max-width: 640px) {
  .attendance-days-grid {
    gap: 0.375rem; /* 간격 축소 */
    margin-bottom: 0.75rem; /* 하단 마진 축소 */
  }
}

.attendance-day-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  border-radius: 1rem;
  border: 1px solid;
  min-height: 110px;
  transition: all 0.3s;
}

@media (max-width: 640px) {
  .attendance-day-card {
    padding: 0.25rem; /* 패딩 축소 */
    min-height: 50px; /* 높이 축소 (65px → 50px) */
    border-radius: 0.5rem;
  }
  
  .attendance-day-label {
    font-size: 0.5rem;
    margin-bottom: 0.25rem;
  }
  
  .attendance-day-icon-today {
    width: 1.5rem; /* 아이콘 크기 축소 */
    height: 1.5rem;
    border-width: 2px;
  }
  
  .attendance-day-icon {
    width: 1.25rem; /* 아이콘 크기 축소 (1.5rem → 1.25rem) */
    height: 1.25rem;
  }
  
  .attendance-day-xp {
    font-size: 0.5rem;
    padding: 0.125rem 0.25rem;
    margin-top: 0.25rem;
  }
}

.attendance-day-card.checked {
  background: rgba(30, 58, 138, 0.2);
  border-color: rgba(59, 130, 246, 0.3);
}

.attendance-day-card.today {
  background: #1f2937;
  border-color: #3b82f6;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.3), 0 0 0 1px rgba(96, 165, 250, 0.5);
  transform: scale(1.05);
  z-index: 10;
}

.attendance-day-card.locked {
  background: rgba(31, 41, 55, 0.5);
  border-color: #374151;
  opacity: 0.6;
}

.attendance-day-card.bonus {
  background: linear-gradient(to bottom, #1f2937, #111827);
  border-color: rgba(234, 179, 8, 0.3);
}

.attendance-day-label {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.attendance-day-card.today .attendance-day-label {
  color: #60a5fa;
}

.attendance-day-card:not(.today) .attendance-day-label {
  color: #6b7280;
}

.attendance-day-icon-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
}

.attendance-day-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 2px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3b82f6;
  transform: rotate(-12deg);
  opacity: 0.8;
}

.attendance-day-icon-check {
  width: 1.25rem;
  height: 1.25rem;
  stroke-width: 4;
}

.attendance-day-icon-today {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 3px solid #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60a5fa;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

@media (max-width: 640px) {
  .attendance-day-icon-today {
    width: 2.25rem;
    height: 2.25rem;
    border-width: 2px;
  }
  
  .attendance-day-icon {
    width: 2rem;
    height: 2rem;
  }
}

.attendance-day-icon-shield {
  width: 1.5rem;
  height: 1.5rem;
}

.attendance-day-icon-pulse {
  animation: attendance-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes attendance-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.attendance-day-icon-gift {
  width: 1.75rem;
  height: 1.75rem;
  color: #facc15;
  filter: drop-shadow(0 0 10px rgba(250, 204, 21, 0.5));
}

.attendance-day-icon-lock {
  width: 1.25rem;
  height: 1.25rem;
  color: #4b5563;
}

.attendance-day-xp {
  font-size: 0.625rem;
  font-weight: 900;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  margin-top: 0.5rem;
}

.attendance-day-xp.bonus {
  background: #facc15;
  color: black;
}

.attendance-day-xp.checked {
  background: #1e3a8a;
  color: #93c5fd;
}

.attendance-day-xp.locked {
  background: #374151;
  color: #9ca3af;
}

.attendance-day-sparkle {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  width: 1rem;
  height: 1rem;
  color: #facc15;
  fill: #facc15;
  animation: attendance-spin-slow 3s linear infinite;
}

@keyframes attendance-spin-slow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* 스탬프 애니메이션 */
.attendance-stamp-slam {
  animation: attendance-stamp-slam 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes attendance-stamp-slam {
  0% {
    transform: scale(2);
    opacity: 0;
  }
  50% {
    transform: scale(0.8);
    opacity: 1;
  }
  70% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.attendance-stamp-in {
  animation: attendance-stamp-in 0.3s ease-out;
}

@keyframes attendance-stamp-in {
  from {
    transform: scale(0) rotate(-12deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(-12deg);
    opacity: 0.8;
  }
}

/* 누적 보상 모듈 */
.attendance-milestones-container {
  background: rgba(31, 41, 55, 0.4);
  border-radius: 1rem;
  padding: 1rem 1.25rem 3rem 1.25rem; /* 상단 패딩 0.5rem → 1rem, 하단 패딩 2.5rem → 3rem */
  border: 1px solid #374151;
  margin-bottom: 2.5rem; /* 2rem → 2.5rem */
  position: relative;
  overflow: hidden;
}

@media (max-width: 640px) {
  /* 타이틀 및 아이콘 축소 */
  .attendance-milestones-title {
    font-size: 0.875rem !important; /* 14px - 출석일수와 비슷한 크기 */
    gap: 0.25rem;
  }
  
  .attendance-milestones-title span {
    font-size: 0.875rem !important; /* span에도 직접 적용 */
  }
  
  .attendance-icon-trophy {
    width: 14px;
    height: 14px;
  }
  
  /* 우측 상단 카운트 축소 */
  .attendance-count-number {
    font-size: 0.875rem; /* 14px */
  }
  
  .attendance-count-label {
    font-size: 0.5rem; /* 8px */
  }

  /* 컨테이너 패딩 축소 */
  .attendance-milestones-container {
    padding: 0.5rem 0.5rem 1.5rem 0.5rem; /* 패딩 축소 */
    margin-bottom: 0.75rem; /* 하단 마진 축소 (1.5rem → 0.75rem) */
  }
  
  .attendance-milestones-header {
    margin-bottom: 0.5rem; /* 타이틀과 바 사이 간격 축소 (1rem → 0.5rem) */
  }

  /* 프로그레스 바 영역 축소 */
  .attendance-progress-container {
    height: 1rem; /* 전체 높이 축소 (1.5rem → 1rem) */
    margin-top: 0.75rem; /* 상단 마진 축소 (1.25rem → 0.75rem) */
  }
  
  .attendance-progress-bg,
  .attendance-progress-bar {
    height: 0.25rem; /* 바 두께 4px로 축소 */
  }

  /* 보상 아이콘 박스(3,5,7일) 축소 */
  .attendance-milestone-box {
    width: 1.25rem; /* 20px (1.5rem → 1.25rem) */
    height: 1.25rem;
    border-width: 1.5px;
    border-radius: 0.375rem;
  }

  .attendance-icon-gift {
    width: 0.75rem; /* 12px */
    height: 0.75rem;
  }

  /* 보상 하단 텍스트 축소 */
  .attendance-milestone-day {
    font-size: 0.4375rem; /* 7px (0.5rem → 0.4375rem) */
    margin-top: 0.25rem;
  }

  .attendance-milestone-xp {
    font-size: 0.4375rem; /* 7px (0.5rem → 0.4375rem) */
    padding: 0.1rem 0.3rem;
  }
  
  /* 마일스톤 간격 조정 */
  .attendance-milestones-markers {
    padding: 0 0.25rem;
  }
}

.attendance-milestones-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.5rem; /* 1rem → 1.5rem */
  margin-top: 0;
  position: relative;
  z-index: 10;
}

.attendance-milestones-title-section {
  flex: 1;
}

.attendance-milestones-title {
  font-size: 1.125rem;
  font-weight: 800;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin: 0;
}

.attendance-icon-trophy {
  color: #facc15;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.attendance-milestones-subtitle {
  font-size: 0.625rem;
  color: #9ca3af;
  margin-top: 0.25rem;
  margin-bottom: 0;
  display: none;
}

.attendance-milestones-count {
  text-align: right;
}

.attendance-count-number {
  font-size: 1.5rem;
  font-weight: 950;
  color: white;
  font-style: italic;
  line-height: 1;
}

.attendance-count-label {
  font-size: 0.875rem;
  color: #9ca3af;
  font-weight: 800;
}

/* 프로그레스 바 영역 */
.attendance-progress-container {
  position: relative;
  height: 2.5rem;
  display: flex;
  align-items: center;
  margin-top: 2rem; /* 1.5rem → 2rem */
}

.attendance-progress-bg {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 0.25rem;
  background: #374151;
  border-radius: 9999px;
  transform: translateY(-50%);
  z-index: 0;
}

.attendance-progress-bar {
  position: absolute;
  top: 50%;
  left: 0;
  height: 0.25rem;
  background: linear-gradient(to right, #2563eb, #60a5fa);
  border-radius: 9999px;
  transform: translateY(-50%);
  z-index: 0;
  transition: width 1s ease;
}

.attendance-milestones-markers {
  width: 100%;
  display: flex;
  justify-content: space-between;
  position: relative;
  z-index: 10;
  padding: 0 0.5rem;
}

.attendance-milestone-spacer {
  width: 0.25rem;
}

.attendance-milestone-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem; /* 0.5rem → 0.75rem */
}

.attendance-milestone-box {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid;
  transition: all 0.3s;
}

@media (max-width: 640px) {
  .attendance-milestone-box {
    width: 1.5rem;
    height: 1.5rem;
    border-width: 1.5px;
  }
  
  .attendance-icon-gift {
    width: 0.75rem;
    height: 0.75rem;
  }
}

.attendance-milestone-box.reached {
  background: #facc15;
  border-color: #fde047;
  color: black;
  box-shadow: 0 0 15px rgba(250, 204, 21, 0.5);
  transform: scale(1.1);
}

.attendance-milestone-box.locked {
  background: #1f2937;
  border-color: #4b5563;
  color: #6b7280;
}

.attendance-icon-gift {
  width: 1rem;
  height: 1rem;
}

.attendance-milestone-box.reached .attendance-icon-gift {
  animation: attendance-bounce 1s ease-in-out infinite;
}

@keyframes attendance-bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.attendance-milestone-info {
  text-align: center;
}

.attendance-milestone-day {
  font-size: 0.625rem;
  font-weight: 700;
}

.attendance-milestone-marker .attendance-milestone-box.reached ~ .attendance-milestone-info .attendance-milestone-day {
  color: white;
}

.attendance-milestone-marker .attendance-milestone-box.locked ~ .attendance-milestone-info .attendance-milestone-day {
  color: #6b7280;
}

.attendance-milestone-xp {
  font-size: 0.5625rem;
  font-weight: 900;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  margin-top: 0.125rem;
}

.attendance-milestone-marker .attendance-milestone-box.reached ~ .attendance-milestone-info .attendance-milestone-xp {
  background: #2563eb;
  color: white;
}

.attendance-milestone-marker .attendance-milestone-box.locked ~ .attendance-milestone-info .attendance-milestone-xp {
  background: #374151;
  color: #6b7280;
}

/* 하단 버튼 영역 */
.attendance-popup-footer {
  display: flex;
  justify-content: center;
  flex-shrink: 0; /* footer가 항상 보이도록 */
}

.attendance-checkin-btn {
  width: 100%;
  max-width: 24rem;
  padding: 1rem;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 0.75rem;
  font-weight: 900;
  font-size: 1.125rem;
  transition: all 0.2s;
  box-shadow: 0 0 30px rgba(37, 99, 235, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.attendance-checkin-btn:hover {
  background: #1d4ed8;
  box-shadow: 0 0 40px rgba(37, 99, 235, 0.6);
}

.attendance-checkin-btn:active {
  transform: scale(0.95);
}

.attendance-checkin-btn:disabled {
  opacity: 0.8;
  cursor: not-allowed;
}

.attendance-completed-btn {
  width: 100%;
  max-width: 24rem;
  padding: 1rem;
  background: #1f2937;
  color: #9ca3af;
  border: none;
  border-radius: 0.75rem;
  font-weight: 700;
  transition: all 0.2s;
  cursor: pointer;
}

.attendance-completed-btn:hover {
  background: #374151;
}

/* 반응형 디자인 */
@media (max-width: 640px) {
  .attendance-popup-container {
    max-width: 100%;
    margin: 0;
  }

  .attendance-popup-header {
    padding: 0.75rem; /* 패딩 축소 (1.25rem → 0.75rem) */
    padding-bottom: 0.5rem; /* 하단 패딩 축소 */
    flex-shrink: 0;
  }

  .attendance-popup-title {
    font-size: 0.875rem; /* 폰트 크기 축소 (1rem → 0.875rem) */
  }
  
  .attendance-popup-subtitle {
    font-size: 0.625rem; /* 폰트 크기 축소 (0.6875rem → 0.625rem) */
    margin-top: 0.125rem;
  }
  
  .attendance-popup-badges {
    gap: 0.25rem;
    margin-bottom: 0.125rem;
  }
  
  .attendance-badge-daily {
    font-size: 0.5rem;
    padding: 0.125rem 0.25rem;
  }
  
  .attendance-badge-week {
    font-size: 0.625rem;
  }
  
  .attendance-icon-calendar {
    width: 18px;
    height: 18px;
  }
  
  .attendance-checkin-btn {
    padding: 0.625rem; /* 패딩 축소 (0.75rem → 0.625rem) */
    font-size: 0.875rem; /* 폰트 크기 축소 (0.9375rem → 0.875rem) */
    border-radius: 0.5rem;
  }
  
  .attendance-completed-btn {
    padding: 0.625rem; /* 패딩 축소 */
    font-size: 0.8125rem;
    border-radius: 0.5rem;
  }
  
  .attendance-popup-footer {
    margin-top: 0.5rem; /* 상단 마진 축소 (1rem → 0.5rem) */
    padding-bottom: 1rem; /* 하단 패딩 축소 (2rem → 1rem) */
    padding-top: 0.25rem; /* 상단 패딩 축소 (0.5rem → 0.25rem) */
    flex-shrink: 0; /* footer가 항상 보이도록 */
  }
}

