/* Base styles */
* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

/* Main content should flex to fill space */
main {
  flex: 1;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* Enhanced button styles */
.btn-primary {
  background: #3b82f6;
  border: none;
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: #f3f4f6;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-secondary:hover {
  background: #e5e7eb;
  transform: translateY(-2px);
}

.btn-danger {
  background: #ef4444;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

/* Enhanced card styles */
.contest-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.contest-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #3b82f6;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.contest-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  border-color: #3b82f6;
}

.contest-card:hover::before {
  opacity: 1;
}

/* Status badges */
.status-badge {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-ongoing {
  background: #10b981;
  color: white;
}

.status-upcoming {
  background: #3b82f6;
  color: white;
}

.status-ended {
  background: #9ca3af;
  color: white;
}

/* Form enhancements */
.form-input {
  background: white;
  border: 2px solid #e5e7eb;
  color: #1f2937;
  padding: 12px 16px;
  border-radius: 12px;
  transition: all 0.3s ease;
  width: 100%;
}

.form-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  outline: none;
}

.form-input::placeholder {
  color: #9ca3af;
}

.form-textarea {
  background: white;
  border: 2px solid #e5e7eb;
  color: #1f2937;
  padding: 12px 16px;
  border-radius: 12px;
  transition: all 0.3s ease;
  width: 100%;
  min-height: 120px;
  resize: vertical;
}

.form-textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  outline: none;
}

/* Star ratings */
.star.empty {
  color: #d1d5db;
}

.star.filled {
  color: #fbbf24;
}

/* Small star rating for cards */
.star-rating .star {
  font-size: 12px;
}

/* Poster image styles */
.poster-image {
  border-radius: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.poster-image:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Poster Toggle Styles */
.poster-toggle-container {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.5rem;
}

.poster-toggle-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
}

.poster-toggle-bg {
  width: 3.5rem;
  height: 2rem;
  background-color: #d1d5db;
  border-radius: 9999px;
  position: relative;
  transition: background-color 0.3s ease;
  margin-right: 0.75rem;
}

.poster-toggle-bg.active {
  background-color: #3b82f6;
}

.poster-toggle-dot {
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  width: 1.5rem;
  height: 1.5rem;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Adjust poster container sizes - smaller than before */
.poster-container {
  width: 280px;
  height: 373px; /* maintains 3:4 ratio */
  overflow: hidden;
  margin: 0 auto;
  border-radius: 12px;
}

.poster-container > div {
  width: 100%;
  height: 100%;
}

.poster-container img,
.poster-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Background poster styling */
.poster-container div[style*="background"],
.poster-container div[style*="aspect-ratio"] {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Contest card with fixed poster size - reduced size */
.contest-card {
  width: 280px;
  max-width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
}

.contest-card-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Contest info section below poster */
.contest-info {
  padding: 16px;
  width: 100%;
  box-sizing: border-box;
}

/* Contest grid for fixed size cards */
.contest-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* Poster view grid - more cards per row */
.poster-view .contest-grid {
  gap: 20px;
}

/* Horizontal list view */
.horizontal-view .contest-card {
  width: 100% !important;
  max-width: none !important;
  margin: 0 0 12px 0;
  display: block;
  flex-direction: row;
}

.horizontal-view .contest-card-inner {
  flex-direction: row;
  align-items: center;
}

.horizontal-view .poster-container {
  width: 120px;
  height: 160px;
  flex-shrink: 0;
  margin-right: 16px;
}

.horizontal-view .contest-info {
  flex: 1;
  padding: 16px;
}

/* Space-y layouts for horizontal lists */
.space-y-4 .contest-card,
.space-y-2 .contest-card {
  width: 100%;
  max-width: none;
  margin: 0 0 16px 0;
  display: block;
}

/* Responsive grid columns */
@media (min-width: 1000px) {
  .contest-grid {
    justify-content: flex-start;
  }
}

@media (min-width: 1400px) {
  .contest-grid {
    gap: 16px;
  }
}

/* Mobile responsive */
@media (max-width: 600px) {
  .poster-container {
    width: 100%;
    max-width: 350px;
    height: 467px; /* maintain 3:4 ratio */
  }
  
  .contest-card {
    width: 100%;
    max-width: 350px;
  }
  
  .contest-grid {
    gap: 16px;
  }
}

@media (max-width: 400px) {
  .poster-container {
    width: 100%;
    max-width: 300px;
    height: 400px;
  }
  
  .contest-card {
    width: 100%;
    max-width: 300px;
  }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .contest-card:hover {
    transform: none;
  }
  
  .btn-primary:hover,
  .btn-secondary:hover,
  .btn-danger:hover {
    transform: none;
  }
}

/* Loading animation */
@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.loading-shimmer {
  background: linear-gradient(90deg, #f3f4f6 0px, #e5e7eb 40px, #f3f4f6 80px);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
}

/* Multiline text content styling */
/* 멀티라인 텍스트(비고, 공지사항, 리뷰 등)에서 개행문자를 올바르게 표시하기 위한 스타일 */
/* 자세한 내용은 docs/MULTILINE_TEXT_GUIDE.md 참조 */
.multiline-text {
  white-space: pre-line;    /* 개행문자 유지, 공백은 축소 */
  word-break: break-word;   /* 긴 단어 적절히 줄바꿈 */
  overflow-wrap: break-word; /* 컨테이너 넘침 방지 */
}

/* 모든 공백까지 그대로 유지해야 하는 경우 사용 */
.multiline-text-preserve {
  white-space: pre-wrap;     /* 개행문자와 공백 모두 유지 */
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Animation classes */
.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}