/**
 * Notice Component Styles
 * 공지사항 컴포넌트 스타일
 * 
 * Features:
 * - Emergency notices (red/yellow/green color variants)
 * - General notices (accordion UI)
 * - Responsive design
 * - WCAG AA color contrast compliance
 * - Accessibility support
 * 
 * Requirements: 1.3, 9.5
 */

/* ============================================
   Emergency Notices Container
   ============================================ */

.emergency-notices {
  width: 100%;
  background: transparent;
  z-index: 1000;
  position: relative;
  /* CLS 방지: 최소 높이 예약 (긴급공지 1개 기준) */
  min-height: 80px;
  transition: min-height 0.3s ease;
}

/* 공지가 없을 때는 공간 차지하지 않음 */
.emergency-notices:empty,
.emergency-notices[style*='display: none'] {
  min-height: 0;
}

/* ============================================
   Emergency Notice Base Styles
   ============================================ */

.emergency-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  margin-bottom: 0;
  border-radius: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  animation: slideDown 0.3s ease-out;
  position: relative;
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Slide down animation */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Emergency notice content */
.emergency-notice__content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0; /* Allow text truncation */
}

/* Emergency notice icon */
.emergency-notice__icon {
  font-size: 28px;
  flex-shrink: 0;
  margin-top: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* Emergency notice text container */
.emergency-notice__text {
  flex: 1;
  min-width: 0;
}

/* Emergency notice title */
.emergency-notice__title {
  display: block;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Emergency notice message */
.emergency-notice__message {
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
  opacity: 0.95;
  font-weight: 500;
}

/* Emergency notice close button */
.emergency-notice__close {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: 16px;
  flex-shrink: 0;
  opacity: 0.8;
  transition: opacity 0.2s ease;
  border-radius: 4px;
}

.emergency-notice__close:hover,
.emergency-notice__close:focus {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
  outline: none;
}

.emergency-notice__close:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* ============================================
   Emergency Notice Color Variants
   WCAG AA Compliant Colors
   ============================================ */

/* Red variant (danger/critical) */
.emergency-notice--red {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: #ffffff;
  border-left: 6px solid #a71d2a;
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.emergency-notice--red .emergency-notice__icon {
  color: #ffffff;
}

/* Yellow variant (warning) */
.emergency-notice--yellow {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  color: #ffffff;
  border-left: 6px solid #d68910;
  box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.emergency-notice--yellow .emergency-notice__icon {
  color: #ffffff;
}

.emergency-notice--yellow .emergency-notice__title,
.emergency-notice--yellow .emergency-notice__message {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Green variant (info/success) */
.emergency-notice--green {
  background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
  color: #ffffff;
  border-left: 6px solid #1e7e34;
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.emergency-notice--green .emergency-notice__icon {
  color: #ffffff;
}

/* ============================================
   General Notices Container
   ============================================ */

.general-notices {
  max-width: 1200px;
  margin: 60px auto 40px;
  padding: 0 20px;
}

.general-notices__title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 24px;
  color: #f8fafc; /* 다크 테마 흰색 텍스트 */
  letter-spacing: -0.02em;
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ============================================
   General Notice List
   ============================================ */

.general-notices__list {
  background: #1e293b; /* 다크 테마 배경 */
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  border: 1px solid #334155;
}

/* General notice item */
.general-notice {
  border-bottom: 1px solid #334155; /* 다크 테마 구분선 */
}

.general-notice:last-child {
  border-bottom: none;
}

/* General notice header (clickable) */
.general-notice__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 20px 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.general-notice__header:hover {
  background-color: rgba(51, 65, 85, 0.5); /* 다크 테마 호버 */
  transform: translateX(4px);
}

.general-notice__header:focus {
  outline: 2px solid #eab308;
  outline-offset: -2px;
}

.general-notice__header[aria-expanded='true'] {
  background-color: rgba(51, 65, 85, 0.7); /* 다크 테마 활성 */
}

/* General notice title */
.general-notice__title {
  font-size: 17px;
  font-weight: 600;
  color: #f8fafc; /* 다크 테마 흰색 텍스트 */
  margin: 0;
  flex: 1;
  min-width: 0;
  letter-spacing: -0.01em;
}

/* General notice date */
.general-notice__date {
  font-size: 14px;
  color: #94a3b8; /* 다크 테마 회색 텍스트 */
  margin-left: 16px;
  flex-shrink: 0;
  font-weight: 500;
}

/* General notice expand icon */
.general-notice__icon {
  font-size: 20px;
  color: #64748b; /* 다크 테마 아이콘 */
  margin-left: 12px;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.general-notice__header:hover .general-notice__icon {
  color: #eab308; /* 다크 테마 호버 아이콘 */
}

.general-notice__header[aria-expanded='true'] .general-notice__icon {
  transform: rotate(180deg);
  color: #eab308; /* 다크 테마 활성 아이콘 */
}

/* General notice content */
.general-notice__content {
  padding: 0 24px;
  max-height: 0;
  overflow: hidden;
  transition:
    max-height 0.3s ease,
    padding 0.3s ease;
  background-color: rgba(15, 23, 42, 0.5); /* 다크 테마 내용 배경 */
}

.general-notice__content[aria-hidden='false'] {
  max-height: 1000px;
  padding: 20px 24px 24px 24px;
  border-top: 1px solid #334155; /* 다크 테마 구분선 */
}

.general-notice__content p {
  font-size: 15px;
  line-height: 1.7;
  color: #cbd5e1; /* 다크 테마 내용 텍스트 */
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-weight: 400;
}

/* ============================================
   Pagination Controls
   ============================================ */

.general-notices__pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
  padding: 20px 0;
}

.pagination__button {
  padding: 10px 18px;
  background: #1e293b; /* 다크 테마 버튼 배경 */
  border: 2px solid #334155; /* 다크 테마 버튼 테두리 */
  border-radius: 8px;
  color: #f8fafc; /* 다크 테마 버튼 텍스트 */
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.pagination__button:hover:not(:disabled) {
  background: #eab308; /* 다크 테마 호버 */
  border-color: #eab308;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(234, 179, 8, 0.4);
}

.pagination__button:focus {
  outline: 2px solid #eab308;
  outline-offset: 2px;
}

.pagination__button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: #1e293b;
  border-color: #334155;
}

.pagination__button--active {
  background: #eab308;
  border-color: #eab308;
  color: #ffffff;
}

.pagination__info {
  font-size: 15px;
  color: #94a3b8; /* 다크 테마 정보 텍스트 */
  padding: 0 16px;
  font-weight: 600;
}

/* ============================================
   Empty State
   ============================================ */

.general-notices__empty {
  text-align: center;
  padding: 40px 20px;
  color: #64748b; /* 다크 테마 빈 상태 텍스트 */
  font-size: 14px;
}

/* ============================================
   Notice Links
   ============================================ */

.notice-link {
  color: #eab308; /* 다크 테마 링크 색상 */
  text-decoration: underline;
  font-weight: 500;
  transition: all 0.2s ease;
  word-break: break-all; /* 긴 URL 줄바꿈 */
}

.notice-link:hover {
  color: #fde047; /* 다크 테마 링크 호버 */
  text-decoration: none;
}

.notice-link:focus {
  outline: 2px solid #eab308;
  outline-offset: 2px;
  border-radius: 2px;
}

/* Emergency notice links (white background variants) */
.emergency-notice--yellow .notice-link,
.emergency-notice--red .notice-link,
.emergency-notice--green .notice-link {
  color: #ffffff;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.emergency-notice--yellow .notice-link:hover,
.emergency-notice--red .notice-link:hover,
.emergency-notice--green .notice-link:hover {
  text-decoration: none;
  opacity: 0.9;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
  /* Emergency notices */
  .emergency-notice {
    padding: 12px 16px;
    flex-direction: column;
    align-items: flex-start;
  }

  .emergency-notice__content {
    width: 100%;
  }

  .emergency-notice__close {
    position: absolute;
    top: 8px;
    right: 8px;
    margin-left: 0;
  }

  .emergency-notice__title {
    font-size: 14px;
  }

  .emergency-notice__message {
    font-size: 13px;
  }

  /* General notices */
  .general-notices {
    margin: 20px auto;
    padding: 0 12px;
  }

  .general-notices__title {
    font-size: 20px;
  }

  .general-notice__header {
    padding: 12px 16px;
  }

  .general-notice__title {
    font-size: 14px;
  }

  .general-notice__date {
    font-size: 12px;
    margin-left: 8px;
  }

  .general-notice__content[aria-hidden='false'] {
    padding: 0 16px 12px 16px;
  }

  .general-notice__content p {
    font-size: 13px;
  }

  /* Pagination */
  .general-notices__pagination {
    gap: 4px;
  }

  .pagination__button {
    padding: 6px 12px;
    font-size: 13px;
  }

  .pagination__info {
    font-size: 13px;
    padding: 0 8px;
  }
}

@media (max-width: 480px) {
  /* Emergency notices */
  .emergency-notice {
    padding: 10px 12px;
  }

  .emergency-notice__icon {
    font-size: 20px;
  }

  .emergency-notice__title {
    font-size: 13px;
  }

  .emergency-notice__message {
    font-size: 12px;
  }

  /* General notices */
  .general-notices__title {
    font-size: 18px;
  }

  .general-notice__header {
    padding: 10px 12px;
  }

  .general-notice__title {
    font-size: 13px;
  }

  .general-notice__date {
    display: none; /* Hide date on very small screens */
  }

  .general-notice__content[aria-hidden='false'] {
    padding: 0 12px 10px 12px;
  }

  .general-notice__content p {
    font-size: 12px;
  }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
  .emergency-notice__close {
    display: none;
  }

  .general-notice__icon {
    display: none;
  }

  .general-notices__pagination {
    display: none;
  }

  .general-notice__content {
    max-height: none !important;
    padding: 0 20px 16px 20px !important;
  }

  .general-notice__content[aria-hidden='true'] {
    display: block !important;
  }
}

/* ============================================
   High Contrast Mode Support
   ============================================ */

@media (prefers-contrast: high) {
  .emergency-notice {
    border: 2px solid currentColor;
  }

  .general-notice__header {
    border: 1px solid currentColor;
  }

  .pagination__button {
    border: 2px solid currentColor;
  }
}

/* ============================================
   Reduced Motion Support
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .emergency-notice {
    animation: none;
  }

  .general-notice__icon {
    transition: none;
  }

  .general-notice__content {
    transition: none;
  }
}
