/* ========================================
   LG Owner's Manual - Main Page CSS
   메인(인덱스) 페이지 전용 스타일
   ======================================== */

/* ========================================
   Index Page (Chapter Grid)
   ======================================== */
.index-page {
    background-color: var(--color-bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.index-page .index-main {
    flex: 1;
    width: 100%;
}

.index-page .index-search-wrapper {
    width: 100%;
}

/* ========================================
   Index Search Wrapper
   ======================================== */
.index-search-wrapper {
    padding-top: calc(var(--header-height) + 30px);
    padding-bottom: 20px;
    display: flex;
    justify-content: center;
    background-color: var(--color-bg);
}

.index-search-wrapper .search-box {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 40px;
}

.index-search-wrapper .search-box input {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: 4px;
}

.index-main {
    padding: 20px 40px 40px;
    max-width: var(--max-width);
    margin: 0 auto;
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 10px;
    row-gap: 20px;
}

.chapter-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px 25px;
    background-color: var(--color-bg);
    border-left: 3px solid var(--color-border);
    border-top: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.chapter-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    object-fit: contain;
    transition: transform 0.3s ease;
}

/* Chapter Icon Hover Animation */
.chapter-item:hover .chapter-icon {
    animation: iconBounce 0.6s ease;
}

@keyframes iconBounce {
    0% { transform: scale(1) translateY(0); }
    20% { transform: scale(1.1) translateY(-5px); }
    40% { transform: scale(0.95) translateY(2px); }
    60% { transform: scale(1.05) translateY(-2px); }
    80% { transform: scale(0.98) translateY(1px); }
    100% { transform: scale(1) translateY(0); }
}

/* Mobile: 페이지 로드 시 아이콘 애니메이션 */
@media only screen and (max-width: 1068px) {
    .chapter-item:hover .chapter-icon {
        animation: none;
    }

    .chapter-icon {
        animation: iconBounceIn 0.6s ease forwards;
    }

    /* 각 아이템별 순차적 딜레이 */
    .chapter-item:nth-child(1) .chapter-icon { animation-delay: 0.1s; }
    .chapter-item:nth-child(2) .chapter-icon { animation-delay: 0.15s; }
    .chapter-item:nth-child(3) .chapter-icon { animation-delay: 0.2s; }
    .chapter-item:nth-child(4) .chapter-icon { animation-delay: 0.25s; }
    .chapter-item:nth-child(5) .chapter-icon { animation-delay: 0.3s; }
    .chapter-item:nth-child(6) .chapter-icon { animation-delay: 0.35s; }
    .chapter-item:nth-child(7) .chapter-icon { animation-delay: 0.4s; }
    .chapter-item:nth-child(8) .chapter-icon { animation-delay: 0.45s; }
    .chapter-item:nth-child(9) .chapter-icon { animation-delay: 0.5s; }
    .chapter-item:nth-child(10) .chapter-icon { animation-delay: 0.55s; }
    .chapter-item:nth-child(11) .chapter-icon { animation-delay: 0.6s; }
    .chapter-item:nth-child(12) .chapter-icon { animation-delay: 0.65s; }
    .chapter-item:nth-child(13) .chapter-icon { animation-delay: 0.7s; }
    .chapter-item:nth-child(14) .chapter-icon { animation-delay: 0.75s; }
    .chapter-item:nth-child(15) .chapter-icon { animation-delay: 0.8s; }
}

@keyframes iconBounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(20px);
    }
    50% {
        opacity: 1;
        transform: scale(1.1) translateY(-5px);
    }
    70% {
        transform: scale(0.95) translateY(2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.chapter-item:hover {
    border-left-color: var(--color-secondary);
    background-color: var(--color-bg-light);
}

.chapter-item .chapter-title {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--color-text);
}

/* ========================================
   Caution Text
   ======================================== */
.caution-text {
    margin-top: 40px;
    padding: 20px;
    background-color: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    text-align: center;
    line-height: 1.6;
}

/* ========================================
   Footer Styles
   ======================================== */
.main-footer .footer-line1,
.main-footer .footer-line2 {
    margin: 0;
    line-height: 1.5;
}

/* ========================================
   Responsive Design - Main Page
   ======================================== */
@media only screen and (max-width: 1068px) {
    .chapter-grid {
        grid-template-columns: 1fr;
    }

    .index-search-wrapper {
        padding-top: calc(var(--header-height) + 20px);
        padding-bottom: 15px;
    }

    .index-search-wrapper .search-box {
        margin: 0 20px;
    }

    .index-main {
        padding: 15px 20px 20px;
    }

    .caution-text {
        margin-top: 20px;
        padding: 15px;
    }

    .main-footer .footer-line1,
    .main-footer .footer-line2 {
        display: block;
    }
}

@media only screen and (max-width: 735px) {
    .index-search-wrapper {
        padding-top: calc(var(--header-height) + 15px);
        padding-bottom: 10px;
    }

    .index-search-wrapper .search-box {
        margin: 0 10px;
    }

    .index-search-wrapper .search-box input {
        width: 100%;
        font-size: 14px;
    }

    .index-main {
        padding: 10px 10px 15px;
    }

    .chapter-item {
        padding: 15px;
        gap: 10px;
    }

    .chapter-icon {
        width: 32px;
        height: 32px;
    }

    .chapter-item .chapter-title {
        font-size: 13px;
    }

    .caution-text {
        margin-top: 15px;
        padding: 10px;
        font-size: 11px;
    }
}


/* ========================================
   RTL (Right-to-Left) Support
   아랍어, 히브리어 등 RTL 언어 지원
   ======================================== */

/* Chapter Item - RTL: 왼쪽 라인을 오른쪽으로 */
[dir="rtl"] .chapter-item {
    border-left: 1px solid var(--color-border);
    border-right: 3px solid var(--color-border);
}

[dir="rtl"] .chapter-item:hover {
    border-left-color: var(--color-border);
    border-right-color: var(--color-secondary);
}
