/**
 * 동적 뉴스 로딩을 위한 CSS 스타일
 */

/* 로딩 상태 스타일 */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  font-size: 16px;
  color: #666;
  background-color: #f8f9fa;
  border-radius: 8px;
  margin: 20px 0;
  min-height: 100px;
}

.loading::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid #e3e3e3;
  border-top: 2px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 에러 상태 스타일 */
.error {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  font-size: 16px;
  color: #dc3545;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 8px;
  margin: 20px 0;
  min-height: 100px;
}

.error::before {
  content: '⚠️';
  margin-right: 10px;
  font-size: 20px;
}

/* 뉴스가 없을 때 스타일 */
.no-news {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  font-size: 16px;
  color: #6c757d;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  margin: 20px 0;
  min-height: 100px;
}

.no-news::before {
  content: '📰';
  margin-right: 10px;
  font-size: 20px;
}

/* 공지사항이 없을 때 스타일 */
.no-notice {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  font-size: 16px;
  color: #6c757d;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  margin: 20px 0;
  min-height: 100px;
}

.no-notice::before {
  content: '📢';
  margin-right: 10px;
  font-size: 20px;
}

/* 뉴스 배너 로딩 슬라이드 */
.loading-slide {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  font-size: 14px;
  color: #666;
  background-color: #f8f9fa;
  border-radius: 4px;
  margin: 0 10px;
  min-height: 60px;
}

/* 뉴스 목록 애니메이션 */
.news_line {
  transition: all 0.3s ease;
}

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

/* 반응형 디자인 */
@media (max-width: 768px) {
  .loading,
  .error,
  .no-news {
    padding: 20px 15px;
    font-size: 14px;
    min-height: 80px;
  }
  
  .loading::before {
    width: 16px;
    height: 16px;
    margin-right: 8px;
  }
  
  .error::before,
  .no-news::before {
    font-size: 16px;
    margin-right: 8px;
  }
}

/* 뉴스 목록 페이드인 애니메이션 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.news_line {
  animation: fadeInUp 0.5s ease-out;
}

/* 뉴스 배너 슬라이드 애니메이션 */
.swiper-slide {
  transition: all 0.3s ease;
}

.swiper-slide:hover {
  transform: scale(1.02);
}

/* 로딩 상태에서 스크롤 방지 */
body.loading-news {
  overflow: hidden;
}

/* 뉴스 컨테이너 최소 높이 설정 */
#news_list,
#hpnk-list-container,
#indonesia-news-container,
#hpnk-notice-container {
  min-height: 200px;
}

/* 뉴스 배너 컨테이너 최소 높이 설정 */
#hpnk-banner-container {
  min-height: 80px;
}

/* 뉴스 상세 페이지 내용 스타일 */
.news-content {
  line-height: 1.6;
  color: #333;
}

.news-content p {
  margin-bottom: 1rem;
  font-size: 1rem;
}

.news-content h1, .news-content h2, .news-content h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: bold;
}

.news-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1rem 0;
}

.news-content ul, .news-content ol {
  margin: 1rem 0;
  padding-left: 2rem;
}

.news-content li {
  margin-bottom: 0.5rem;
}

/* 공지사항 상세 페이지 내용 스타일 (뉴스와 동일) */
#news-content {
  line-height: 1.6;
  color: #333;
  font-size: 1rem;
  margin-bottom: 1rem;
  overflow: hidden;
  clear: both;
  position: relative;
}

/* 콘텐츠 영역 내부 요소들의 오버플로우 방지 */
#news-content * {
  max-width: 100%;
  box-sizing: border-box;
}

#news-content p {
  margin-bottom: 1rem;
}

#news-content div {
  margin-bottom: 1rem;
}

#news-content h1, #news-content h2, #news-content h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: bold;
}

#news-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1rem 0;
}

/* TinyMCE 부모 p 태그의 text-align 스타일 처리 */
#news-content p[style*="text-align: left"] img,
#news-content p[style*="text-align: left"] video {
  float: left !important;
  margin: 0 10px 10px 0 !important;
  display: block !important;
}

#news-content p[style*="text-align: center"] img,
#news-content p[style*="text-align: center"] video {
  display: block !important;
  margin: 0 auto !important;
  float: none !important;
}

#news-content p[style*="text-align: right"] img,
#news-content p[style*="text-align: right"] video {
  float: right !important;
  margin: 0 0 10px 10px !important;
  display: block !important;
}

/* TinyMCE 인라인 스타일 직접 처리 (iframe용) */
#news-content img[style*="float: left"],
#news-content iframe[style*="float: left"],
#news-content video[style*="float: left"] {
  float: left !important;
  margin: 0 10px 10px 0 !important;
  display: block !important;
}

#news-content img[style*="margin: 0 auto"],
#news-content iframe[style*="margin: 0 auto"],
#news-content video[style*="margin: 0 auto"] {
  display: block !important;
  margin: 0 auto !important;
  float: none !important;
}

#news-content img[style*="float: right"],
#news-content iframe[style*="float: right"],
#news-content video[style*="float: right"] {
  float: right !important;
  margin: 0 0 10px 10px !important;
  display: block !important;
}

/* 추가적인 TinyMCE 스타일 처리 */
#news-content img[style*="display: block"][style*="margin: 0 auto"],
#news-content iframe[style*="display: block"][style*="margin: 0 auto"],
#news-content video[style*="display: block"][style*="margin: 0 auto"] {
  display: block !important;
  margin: 0 auto !important;
  float: none !important;
}

/* 유튜브 임베드 스타일 */
#news-content iframe[src*="youtube.com"],
#news-content iframe[src*="youtu.be"] {
  max-width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  border-radius: 8px;
  margin: 1rem 0;
  display: block;
}

/* 유튜브 정렬 스타일 */
/* 왼쪽 정렬 */
#news-content iframe[src*="youtube.com"][style*="float: left"],
#news-content iframe[src*="youtu.be"][style*="float: left"] {
  float: left !important;
  margin: 0 10px 10px 0 !important;
  display: block !important;
}

/* 가운데 정렬 */
#news-content iframe[src*="youtube.com"][style*="margin-left: auto"],
#news-content iframe[src*="youtu.be"][style*="margin-left: auto"],
#news-content iframe[src*="youtube.com"][style*="margin: 0 auto"],
#news-content iframe[src*="youtu.be"][style*="margin: 0 auto"],
#news-content iframe[src*="youtube.com"][style*="display: table"],
#news-content iframe[src*="youtu.be"][style*="display: table"] {
  display: block !important;
  margin: 0 auto !important;
  float: none !important;
}

/* 오른쪽 정렬 */
#news-content iframe[src*="youtube.com"][style*="float: right"],
#news-content iframe[src*="youtu.be"][style*="float: right"] {
  float: right !important;
  margin: 0 0 10px 10px !important;
  display: block !important;
}

/* 동영상 태그 스타일 */
#news-content video {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1rem 0;
}

#news-content ul, #news-content ol {
  margin: 1rem 0;
  padding-left: 2rem;
}

#news-content li {
  margin-bottom: 0.5rem;
}
