/* index.css - 메인페이지 전용 스타일 */

/* 퀴즈 목록 그리드 */
.grid-auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* 모바일 반응형 */
@media (max-width: 640px) {
    .grid-auto-fit {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem; /* 간격 조정 (24px -> 16px) */
    }

    /* 퀴즈 카드 이미지 높이 절반으로 */
    .quiz-card-img {
        height: 6rem !important; /* h-24 (96px) - h-48의 절반 */
    }

    /* 퀴즈 카드 콘텐츠 간격 조정 */
    .quiz-card-content {
        padding: 0.75rem !important; /* p-5에서 p-3로 */
    }

    /* 퀴즈 카드 정보를 세로로 쌓이게 */
    .quiz-card-info {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.25rem;
    }

    /* 모든 텍스트에 말줄임표 적용 */
    .quiz-card-info > * {
        width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* 제목 폰트 크기 조정 */
    .quiz-card-content > div:first-child {
        font-size: 13px;
    }

    /* 설명 폰트 크기 조정 */
    .quiz-card-content > p {
        font-size: 12px;
        line-height: 1.3;
        margin-bottom: 0.5rem !important;
        min-height: 2rem !important;
    }

    /* 정보 텍스트 크기 조정 */
    .quiz-card-info,
    .quiz-card-content > div:last-child {
        font-size: 10px;
    }
}

/* 퀴즈 카드 스타일 */
.quiz-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.quiz-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
    background-color: #f9fafb;
}

.quiz-card:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* 텍스트 말줄임 (2줄) */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2; /* 표준 속성 추가 */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 초대코드 입력 섹션 스타일 */
#inviteSection {
    animation: fadeIn 0.3s ease-in-out;
}

/* 퀴즈 목록 섹션 스타일 */
#quizListSection {
    animation: fadeIn 0.5s ease-in-out;
}

/* 로그인 안내 섹션 스타일 */
#loginPrompt {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* 로딩 스피너 애니메이션 개선 */
.loading-spinner {
    animation: spin 1s linear infinite;
}

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

/* 검색바와 초대코드 영역 반응형 스타일 */
.search-invite-container {
    transition: all 0.3s ease;
}

/* 모바일에서 검색바 우선순위 */
@media (max-width: 1023px) {
    .search-invite-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    #inviteSection {
        margin-top: 1rem;
    }
    
    #inviteSection .bg-white {
        padding: 1rem;
    }
    
    #inviteSection .flex {
        flex-wrap: wrap;
        gap: 0.75rem;
        justify-content: center;
    }
    
    #inviteInput {
        width: auto;
        min-width: 120px;
        flex: 1;
    }
}

/* 데스크톱에서 균형잡힌 레이아웃 */
@media (min-width: 1024px) {
    .search-invite-container {
        align-items: center;
    }
    
    #inviteSection {
        flex-shrink: 0;
    }
}

/* 초대코드 입력창 포커스 스타일 */
#inviteInput:focus {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

/* 검색 입력창 포커스 스타일 */
#searchInput:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 퀴즈 카드 내 이미지 스타일 */
.quiz-card img {
    transition: transform 0.3s ease;
}

.quiz-card:hover img {
    transform: scale(1.05);
}

/* 퀴즈 시작 버튼 호버 효과 */
.quiz-card button {
    position: relative;
    overflow: hidden;
}

.quiz-card button:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.quiz-card:hover button:before {
    left: 100%;
}

/* 빈 상태 메시지 스타일 */
.empty-state {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
}

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

/* 에러 메시지 스타일 */
.error-message {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border: 1px solid #f87171;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* 다시 시도 버튼 스타일 */
.retry-button {
    transition: all 0.3s ease;
}

.retry-button:hover {
    transform: scale(1.05);
    background-color: rgb(147, 197, 253);
}

/* 태블릿 반응형 */
@media (min-width: 641px) and (max-width: 1024px) {
    .grid-auto-fit {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 큰 화면 반응형 */
@media (min-width: 1025px) {
    .grid-auto-fit {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 초고해상도 화면 */
@media (min-width: 1440px) {
    .grid-auto-fit {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 검색 및 초대 영역 그림자 효과 */
.search-invite-container > div {
    transition: box-shadow 0.3s ease;
}

.search-invite-container > div:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 모바일 전용 광고 (스마트폰만) */
.mobile-only-ad {
    display: none; /* 기본적으로 숨김 */
}

/* 스마트폰에서만 표시 (480px 이하) */
@media (max-width: 480px) {
    .mobile-only-ad {
        display: block;
    }
}