/* Import Google Font */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

/* CSS Variables for Dark Mode Theme */
:root {
    --bg-color: #1a1a1a;
    --surface-color: #2c2c2c;
    --primary-color: #4a90e2;
    /* A nice blue accent */
    --primary-hover-color: #5aa1f2;
    --text-color: #e0e0e0;
    --text-secondary-color: #a0a0a0;
    --border-color: #444;
}

/* public1/main.css 파일에 아래 내용을 추가하세요. */

/* --- 홈 화면 레이아웃 --- */
.home-container {
    display: flex;
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
    align-items: flex-start;
    /* 컨텐츠 상단 정렬 */
}

.sidebar {
    flex: 0 0 280px;
    /* 사이드바 너비 고정 */
    position: sticky;
    /* 스크롤 따라다니도록 설정 */
    top: 20px;
}

.main-content {
    flex-grow: 1;
    /* 남은 공간 모두 차지 */
}

.cardbox-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 20px;
    text-align: center;
}

/* 사이드바 내의 카드박스 컨테이너 스타일 조정 */
.sidebar .cardbox-container {
    margin: 0;
    padding: 1rem;
    background-color: var(--surface-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.sidebar .cardbox-container h4 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-title-link {
    text-decoration: none;
    color: var(--text-color);
    transition: color 0.2s;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

/* 사이드바 내의 카드 그리드 스타일 조정 */
.sidebar .card-grid {
    grid-template-columns: 1fr;
    /* 세로로 한 줄로 쌓이도록 변경 */
    gap: 10px;
    margin-top: 0;
}

.card-box {
    background-color: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    text-decoration: none;
    /* a 태그의 밑줄 제거 */
    color: inherit;
    /* a 태그의 색상 상속 */
}

/* 사이드바 내의 카드 박스 스타일 조정 */
.sidebar .card-box {
    flex-direction: row;
    /* 가로로 배치 */
    justify-content: space-between;
    padding: 10px 15px;
    gap: 10px;
}

.card-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.card-level {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--text-secondary-color);
}

/* 사이드바 내의 레벨 텍스트 스타일 조정 */
.sidebar .card-level {
    font-size: 1em;
}

.card-count {
    font-size: 3em;
    font-weight: bold;
    margin: 10px 0;
    color: var(--text-color);
}

/* 사이드바 내의 단어 수 텍스트 스타일 조정 */
.sidebar .card-count {
    font-size: 1.5em;
    margin: 0;
}

.card-label {
    font-size: 0.9em;
    color: var(--text-secondary-color);
}

/* 레벨별 색상 */
.level-1 {
    border-top: 5px solid #4CAF50;
}

.level-2 {
    border-top: 5px solid #8BC34A;
}

.level-3 {
    border-top: 5px solid #CDDC39;
}

.level-4 {
    border-top: 5px solid #FFEB3B;
}

.level-5 {
    border-top: 5px solid #FFC107;
}

.level-6 {
    border-top: 5px solid #FF9800;
}

.level-7 {
    border-top: 5px solid #F44336;
}

.level-1 .card-count {
    color: #4CAF50;
}

.level-2 .card-count {
    color: #8BC34A;
}

.level-3 .card-count {
    color: #CDDC39;
}

.level-4 .card-count {
    color: #FFC107;
}

.level-5 .card-count {
    color: #FF9800;
}

.level-6 .card-count {
    color: #F44336;
}

/* 
   level-4의 글자색이 배경과 비슷해 잘 보이지 않을 수 있습니다. 
   필요하다면 .level-4 .card-count { color: #cda700; } 처럼 조정하세요.
*/

.sidebar-title-link:hover {
    color: var(--primary-color);
}

/* 테스트 시작 버튼 스타일 */
.sidebar-test-btn {
    display: block;
    box-sizing: border-box;
    padding: 12px;
    margin-top: 15px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 6px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.sidebar-test-btn:hover {
    background-color: var(--primary-hover-color);
}


/* General Styles */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Noto Sans KR', sans-serif;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

h1,
h5 {
    color: var(--text-color);
    text-align: center;
}

h1 {
    margin-bottom: 2rem;
}

/* Navigation Bar */
.nav {
    width: 100%;
    max-width: 800px;
    background-color: var(--surface-color);
    padding: 1rem 2rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nav a,
.nav span {
    color: var(--text-color);
    text-decoration: none;
    margin: 0 1rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav a:hover {
    color: var(--primary-color);
}

.nav .logo {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color);
}

/* Form Styling */
.form-box {
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    max-width: 500px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.form-box input[type="text"],
.form-box input[type="password"] {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
}

.form-box input::placeholder {
    color: var(--text-secondary-color);
}

.form-box button[type="submit"] {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.form-box button[type="submit"]:hover {
    background-color: var(--primary-hover-color);
}

/* Word List Styling with Animation */
.word-list-container {
    width: 100%;
    max-width: 600px;
    background-color: var(--surface-color);
    padding: 1rem 2rem 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    /* 스크롤 기능 추가 */
    max-height: 60vh;
    /* 컨테이너의 최대 높이를 뷰포트 높이의 60%로 제한 */
    overflow-y: auto;
    /* 내용이 최대 높이를 넘어가면 세로 스크롤바 표시 */
}

.word-list-container h4 {
    text-align: center;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

/* (선택) 다크 테마에 어울리는 스크롤바 스타일링 (웹킷 브라우저용) */
.word-list-container::-webkit-scrollbar {
    width: 10px;
}

.word-list-container::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 5px;
}

.word-list-container::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 5px;
    border: 2px solid var(--bg-color);
}

.word-list-container::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-secondary-color);
}

.word-list {
    list-style: none;
    padding: 0;
}

.word-item {
    background-color: var(--bg-color);
    margin-bottom: 1rem;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0;
    /* 애니메이션 시작을 위해 초기 투명도를 0으로 설정 */
    animation: float-in 0.5s ease-out forwards;
}

/* Staggered animation for list items */
.word-item:nth-child(1) {
    animation-delay: 0.1s;
}

.word-item:nth-child(2) {
    animation-delay: 0.2s;
}

.word-item:nth-child(3) {
    animation-delay: 0.3s;
}

.word-item:nth-child(4) {
    animation-delay: 0.4s;
}

.word-item:nth-child(5) {
    animation-delay: 0.5s;
}

.word-item h5 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 500;
}

.word-item span {
    font-size: 0.9rem;
    color: var(--text-secondary-color);
    background-color: var(--surface-color);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
}

@keyframes float-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    /* Initially hidden */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    flex-direction: column;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid var(--border-color);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-overlay p {
    color: var(--text-color);
    margin-top: 20px;
    font-size: 1.2rem;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.korean-meaning-box {
    color: #4a90e2;
    opacity: 0.4;
    float: right;
}

.word-sentences {
    display: none;
    background: #222;
    color: #e0e0e0;
    border-radius: 8px;
    margin: 0.5rem 0 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid #4a90e2;
    font-size: 0.98em;
    transition: background 0.2s;
}

.word-sentences h6 {
    margin-top: 0;
    color: #4a90e2;
    font-size: 1em;
    font-weight: 500;
}

.word-sentences p {
    margin: 0.2em 0 0.5em 0;
    line-height: 1.5;
}

.showsentence {
    display: block !important;
    background: #2c2c2c;
    color: #4a90e2;
    /* 필요하다면 아래도 추가 */
    /* border: 1px solid #4a90e2; */
}

.testpage-뜻-박스-보이기{
    display: block !important;
    background: #2c2c2c;
    color: #4a90e2;
    /* 필요하다면 아래도 추가 */
    border: 1px solid #4a90e2;
}

.reroll-button{
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
