/* Custom Styles for REDLABEL Web Novel Platform */

/* Font Import - Google Fonts를 사용한 안전한 방식 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap');

/* GmarketSans 폰트를 위한 대체 방식 */
@font-face {
  font-family: 'GmarketSans';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.1/GmarketSansMedium.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* Fallback 폰트 체인 정의 */
.font-gmarket {
  font-family: 'GmarketSans', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 한국어 폰트 전용 클래스 */
.font-korean {
  font-family: 'GmarketSans', 'Noto Sans KR', 'Malgun Gothic', 'Apple SD Gothic Neo', -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: -0.02em;
}

/* 폰트 로딩 실패 시 대체 스타일 */
.font-fallback {
  font-family: 'Noto Sans KR', 'Malgun Gothic', 'Apple SD Gothic Neo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 폰트 굵기 클래스 - GmarketSans 스타일 복원 */
.font-weight-light {
  font-weight: 400;
}

.font-weight-normal {
  font-weight: 500;
}

.font-weight-medium {
  font-weight: 500;
}

.font-weight-bold {
  font-weight: 700;
}

/* Adult Content (19+) Styles */
.adult-content {
  position: relative;
}

.adult-content .book-cover {
  filter: blur(8px);
  transition: filter 0.3s ease;
}

.adult-content:hover .book-cover {
  filter: blur(4px);
}

.adult-content.verified .book-cover {
  filter: none;
}

.adult-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
  transition: opacity 0.3s ease;
  cursor: pointer;
  z-index: 10; /* 순위 번호(z-index: 20)보다 낮게 설정하여 가려지지 않도록 */
}

.adult-content:hover .adult-overlay {
  opacity: 0.8;
}

.adult-content.verified .adult-overlay {
  display: none;
}

.adult-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, #dc2626, #991b1b);
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: bold;
  padding: 0;
  z-index: 20; /* adult-overlay보다 높게 설정 */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 배지 위치별 스타일 정의 */
.badge-top-right {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 20; /* adult-overlay보다 높게 설정 */
}

.badge-bottom-right {
  position: absolute;
  bottom: 0;
  right: 0;
  z-index: 20; /* adult-overlay보다 높게 설정 */
}

.badge-bottom-left {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 20; /* adult-overlay보다 높게 설정 */
}

/* 여러 배지가 있을 때 위치 조정 */
.badge-top-right.has-multiple {
  top: 8px;
  right: 8px;
}

.badge-bottom-right.has-multiple {
  bottom: 0;
  right: 0;
}

.badge-bottom-left.has-multiple {
  bottom: 0;
  left: 0;
}

/* 배지 간격 조정 - 같은 라인에 여러 배지가 있을 때 */
.badge-bottom-right + .badge-bottom-left,
.badge-bottom-left + .badge-bottom-right {
  margin-left: 4px;
}

/* 배지가 여러 개일 때 우선순위에 따른 위치 조정 */
.adult-content .badge-top-right.badge-19 {
  top: 8px;
  right: 8px;
}

.adult-content .badge-bottom-right {
  bottom: 0;
  right: 0;
}

.adult-content .badge-bottom-left {
  bottom: 0;
  left: 0;
}

/* 배지 스타일 */
.badge-square {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  min-width: 44px;
  width: 44px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}

.badge-19 {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  color: white;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  padding: 0;
}

.badge-ai {
  background: linear-gradient(135deg, #9333ea, #ec4899);
  color: white;
}

.badge-exclusive {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
}

.badge-free {
  background: linear-gradient(135deg, #059669, #047857);
  color: white;
  font-weight: 700;
}

.badge-time {
  background: linear-gradient(135deg, #1f2937, #374151);
  color: white;
}

.adult-verification-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.adult-verification-content {
  background: white;
  padding: 2rem;
  border-radius: 0.5rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.dark .adult-verification-content {
  background: rgb(17 24 39);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  @apply bg-gray-100 dark:bg-gray-800;
}

::-webkit-scrollbar-thumb {
  @apply bg-gray-300 dark:bg-gray-600 rounded-full;
}

::-webkit-scrollbar-thumb:hover {
  @apply bg-gray-400 dark:bg-gray-500;
}

/* Text Clamp Utilities */
.line-clamp-1 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.line-clamp-2 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.line-clamp-3 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/* Custom Animations */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slide-in-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Animation Classes */
.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-pulse-soft {
  animation: pulse-soft 2s ease-in-out infinite;
}

.animate-slide-in-right {
  animation: slide-in-right 0.5s ease-out;
}

.animate-slide-in-up {
  animation: slide-in-up 0.5s ease-out;
}

.animate-fade-in {
  animation: fade-in 0.3s ease-out;
}

/* Interactive Elements */
.hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.dark .hover-lift:hover {
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* Glass Effect */
.glass {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.dark .glass {
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Gradient Text */
.gradient-text {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Book Card Hover Effect */
.book-card {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.book-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.book-card:hover::before {
  transform: translateX(100%);
}

/* Banner Slider Indicators */
.banner-dot,
.banner2-dot {
  transition: all 0.3s ease;
}

.banner-dot.active,
.banner2-dot.active {
  transform: scale(1.2);
}

/* Custom Focus Styles */
.focus-primary:focus {
  @apply outline-none ring-2 ring-primary-500 ring-offset-2 dark:ring-offset-gray-900;
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

.dark .skeleton {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Mobile Optimizations */
@media (max-width: 640px) {
  .mobile-optimized {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .mobile-scroll {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  .mobile-scroll::-webkit-scrollbar {
    display: none;
  }
  
  .mobile-scroll > * {
    scroll-snap-align: start;
  }
}

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .book-card {
    border: 2px solid currentColor;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Custom Dropdown Styles for Alpine.js */
.dropdown-enter {
  opacity: 0;
  transform: scale(0.95);
}

.dropdown-enter-active {
  opacity: 1;
  transform: scale(1);
  transition: opacity 150ms ease-out, transform 150ms ease-out;
}

.dropdown-leave {
  opacity: 1;
  transform: scale(1);
}

.dropdown-leave-active {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 75ms ease-in, transform 75ms ease-in;
}

/* Modern Search Input Styles */
.search-container {
  position: relative;
  max-width: 400px;
  width: 100%;
}

/* Underline Style Search (Recommended) */
.search-underline {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.search-underline .search-input {
  width: 100%;
  padding: 12px 0 12px 40px;
  border: none;
  border-bottom: 1px solid #e5e7eb;
  background: transparent;
  font-size: 1rem;
  color: #374151;
  transition: all 0.3s ease;
  outline: none;
}

.search-underline .search-input:focus {
  border-bottom-color: #3b82f6;
  border-bottom-width: 2px;
}

.search-underline .search-input::placeholder {
  color: #9ca3af;
  font-size: 1rem;
}

.search-underline .search-icon {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  font-size: 1.25rem;
  transition: all 0.3s ease;
  pointer-events: none;
}

.search-underline .search-input:focus + .search-icon {
  color: #3b82f6;
}

/* Dark mode for underline search */
.dark .search-underline .search-input {
  color: white;
  border-bottom-color: #4b5563;
}

.dark .search-underline .search-input:focus {
  border-bottom-color: #60a5fa;
}

.dark .search-underline .search-input::placeholder {
  color: #6b7280;
}

.dark .search-underline .search-icon {
  color: #9ca3af;
}

.dark .search-underline .search-input:focus + .search-icon {
  color: #60a5fa;
}

/* Alternative: Rounded Modern Search */
.search-input {
  width: 100%;
  padding: 12px 20px 12px 48px;
  border: none;
  border-radius: 25px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  font-size: 0.95rem;
  transition: all 0.3s ease;
  outline: none;
}

.search-input:focus {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.95);
}

.search-input::placeholder {
  color: #9ca3af;
  transition: all 0.3s ease;
}

.search-input:focus::placeholder {
  opacity: 0.7;
  transform: translateX(4px);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  pointer-events: none;
}

.search-input:focus + .search-icon {
  color: #3b82f6;
  transform: translateY(-50%) scale(1.1);
}

/* Dark mode styles */
.dark .search-input {
  background: rgba(17, 24, 39, 0.9);
  color: white;
}

.dark .search-input:focus {
  background: rgba(17, 24, 39, 0.95);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.dark .search-input::placeholder {
  color: #6b7280;
}

.dark .search-icon {
  color: #9ca3af;
}

.dark .search-input:focus + .search-icon {
  color: #60a5fa;
}

/* Alternative Pill-style Search */
.search-pill {
  border-radius: 50px;
  padding: 10px 24px 10px 44px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(20px);
}

.search-pill:focus {
  border-color: rgba(59, 130, 246, 0.5);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.25));
}

/* Floating Label Style */
.search-floating {
  position: relative;
  margin: 1rem 0;
}

.search-floating .floating-input {
  width: 100%;
  padding: 16px 20px 8px 20px;
  border: 2px solid transparent;
  border-radius: 16px;
  background: #f8fafc;
  font-size: 1rem;
  transition: all 0.3s ease;
  outline: none;
}

.search-floating .floating-label {
  position: absolute;
  left: 20px;
  top: 16px;
  color: #6b7280;
  font-size: 1rem;
  transition: all 0.3s ease;
  pointer-events: none;
  background: transparent;
}

.search-floating .floating-input:focus,
.search-floating .floating-input:not(:placeholder-shown) {
  border-color: #3b82f6;
  background: white;
}

.search-floating .floating-input:focus + .floating-label,
.search-floating .floating-input:not(:placeholder-shown) + .floating-label {
  top: -8px;
  left: 16px;
  font-size: 0.75rem;
  color: #3b82f6;
  background: white;
  padding: 0 4px;
}

.dark .search-floating .floating-input {
  background: #1f2937;
  color: white;
}

.dark .search-floating .floating-input:focus,
.dark .search-floating .floating-input:not(:placeholder-shown) {
  background: #111827;
  border-color: #60a5fa;
}

.dark .search-floating .floating-label {
  color: #9ca3af;
}

.dark .search-floating .floating-input:focus + .floating-label,
.dark .search-floating .floating-input:not(:placeholder-shown) + .floating-label {
  color: #60a5fa;
  background: #111827;
}

/* Animated Search Bar */
.search-animated {
  position: relative;
  overflow: hidden;
}

.search-animated::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
  transition: left 0.6s ease;
}

.search-animated:focus-within::before {
  left: 100%;
}

/* Search Autocomplete */
.search-suggestion {
  @apply px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer text-sm;
  transition: background-color 0.2s ease;
}

.search-suggestion.active {
  @apply bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-300;
}

/* Search Results Styles */
.search-work-item {
  transition: all 0.2s ease;
}

.search-work-item:hover {
  background-color: rgba(59, 130, 246, 0.05);
  transform: translateX(2px);
}

.search-work-title {
  font-weight: 500;
  color: #1f2937;
  transition: color 0.2s ease;
}

.dark .search-work-title {
  color: #f9fafb;
}

.search-work-meta {
  font-size: 0.875rem;
  color: #6b7280;
}

.dark .search-work-meta {
  color: #9ca3af;
}

.search-highlight {
  background: linear-gradient(120deg, #fef3c7 0%, #fde68a 100%);
  padding: 1px 2px;
  border-radius: 2px;
  font-weight: 500;
}

.dark .search-highlight {
  background: linear-gradient(120deg, #92400e 0%, #b45309 100%);
  color: #fbbf24;
}

/* Search Dropdown z-index fix */
/* Removed - reverting z-index changes */

/* Ensure search dropdown is above everything */
/* Removed - reverting z-index changes */

/* Additional search dropdown positioning */
/* Removed - reverting z-index changes */

/* Make sure search results are above navigation */
/* Removed - reverting z-index changes */

/* Search Loading Animation */
.search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.search-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Enhanced Search Input Animation */
header input[type="text"]:focus {
  border-bottom-color: #3b82f6 !important;
  border-bottom-width: 2px !important;
  ring: none !important;
  box-shadow: 0 2px 0 rgba(59, 130, 246, 0.1) !important;
  outline: none !important;
}

.dark header input[type="text"]:focus {
  background: transparent !important;
  background-color: transparent !important;
  border: 0 !important;
  border-width: 0 !important;
  border-style: none !important;
  border-color: transparent !important;
  border-top: 0 !important;
  border-left: 0 !important;
  border-right: 0 !important;
  border-bottom: 2px solid #60a5fa !important;
  box-shadow: none !important;
}

.dark header input[type="text"]::placeholder {
  color: #6b7280 !important;
}

/* Notification Styles */
.notification {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  animation: slide-in-right 0.3s ease-out;
}

.notification-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.notification-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.notification-info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.notification-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #d97706;
}

/* Dark mode notifications */
.dark .notification {
  background: #1f2937;
  border-color: #374151;
  color: #f9fafb;
}

.dark .notification-success {
  background: #065f46;
  border-color: #047857;
  color: #d1fae5;
}

.dark .notification-error {
  background: #7f1d1d;
  border-color: #991b1b;
  color: #fecaca;
}

.dark .notification-info {
  background: #1e3a8a;
  border-color: #1d4ed8;
  color: #dbeafe;
}

.dark .notification-warning {
  background: #92400e;
  border-color: #d97706;
  color: #fef3c7;
}

/* Header Search Styles - Clean Underline */
/* Removed - replaced with inline styles and custom classes */

/* Complete Input Reset for Search */
/* Removed - replaced with inline styles and custom classes */

/* Custom Search Input - Inline Style Support */
/* Removed - complete reset */

/* Large screen width for desktop search */
@media (min-width: 1024px) {
  .search-input-custom {
    width: 20rem !important;
  }
}

/* Removed all search related CSS for complete reset */

/* 순위 번호 스타일 - 성인 콘텐츠에서도 가려지지 않도록 */
.ranking-number {
  position: absolute;
  top: -8px;
  left: -8px;
  z-index: 20; /* adult-overlay(z-index: 10)보다 높게 설정하여 순위 번호가 가려지지 않도록 */
  padding: 4px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 기존 배지 스타일과 함께 작동하도록 조정 */
.adult-content .ranking-number {
  z-index: 20; /* 성인 콘텐츠에서도 순위 번호가 가려지지 않도록 */
} 