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

:root {
    --mc-primary: #5865f2;
    --mc-secondary: #57f287;
    --mc-accent: #ffa500;
    --mc-gold: #ffcc02;
    --mc-bg-dark: #1e2124;
    --mc-bg-medium: #2f3136;
    --mc-bg-light: #36393f;
    --mc-text-primary: #ffffff;
    --mc-text-secondary: #b9bbbe;
    --mc-text-muted: #72767d;
    --mc-border: #4f5660;
    --mc-success: #57f287;
    --mc-warning: #fee75c;
    --mc-danger: #ed4245;
    --mc-grass: #7cb342;
    --mc-dirt: #8d6e63;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 16px;
    background: linear-gradient(135deg, var(--mc-bg-dark) 0%, var(--mc-bg-medium) 100%);
    min-height: 100vh;
    color: var(--mc-text-primary);
    line-height: 1.6;
}

/* 메인 컨테이너 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* 헤더 */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 24px;
    background: linear-gradient(135deg, var(--mc-primary) 0%, var(--mc-secondary) 100%);
    border-radius: 16px;
    box-shadow: 
        0 8px 32px rgba(88, 101, 242, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 12px;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    position: relative;
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
    position: relative;
}

/* 네비게이션 */
.nav {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 14px 28px;
    background: var(--mc-bg-light);
    border: 1px solid var(--mc-border);
    border-radius: 8px;
    color: var(--mc-text-primary);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

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

.nav-btn:hover {
    background: var(--mc-primary);
    border-color: var(--mc-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(88, 101, 242, 0.4);
}

.nav-btn:hover::before {
    left: 100%;
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--mc-primary), var(--mc-secondary));
    border-color: transparent;
    color: white;
}

/* 페이지 표시/숨김 */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* 통계 카드 */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--mc-bg-light);
    border: 1px solid var(--mc-border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--mc-primary), var(--mc-secondary), var(--mc-accent));
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
    border-color: var(--mc-primary);
}

.stat-card .icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
}

.stat-card.books .icon { color: var(--mc-accent); }
.stat-card.authors .icon { color: var(--mc-success); }

.stat-card .number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--mc-text-primary);
    margin-bottom: 6px;
    font-family: 'JetBrains Mono', monospace;
}

.stat-card .label {
    font-size: 1rem;
    color: var(--mc-text-secondary);
    font-weight: 500;
}

/* 알림 */
.alert {
    background: linear-gradient(135deg, rgba(87, 242, 135, 0.1), rgba(88, 101, 242, 0.1));
    border: 1px solid var(--mc-success);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
    position: relative;
}

.alert-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--mc-success);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-content {
    color: var(--mc-text-secondary);
    font-size: 1rem;
}

/* 검색 영역 */
.search-section {
    background: var(--mc-bg-light);
    border: 1px solid var(--mc-border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
}

.search-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.search-bar input {
    flex: 1;
    min-width: 300px;
    padding: 14px 20px;
    background: var(--mc-bg-dark);
    border: 1px solid var(--mc-border);
    border-radius: 8px;
    color: var(--mc-text-primary);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--mc-primary);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.2);
}

.search-bar input::placeholder {
    color: var(--mc-text-muted);
}

.search-btn {
    padding: 14px 24px;
    background: var(--mc-primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-btn:hover {
    background: #4752c4;
    transform: translateY(-1px);
}

/* 책 목록 */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.book-card {
    background: var(--mc-bg-light);
    border: 1px solid var(--mc-border);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.book-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--mc-accent), var(--mc-primary));
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
    border-color: var(--mc-primary);
}

.book-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--mc-text-primary);
    margin-bottom: 12px;
    line-height: 1.4;
}

.book-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--mc-text-muted);
    flex-wrap: wrap;
}

.book-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.book-preview {
    color: var(--mc-text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 16px;
    height: 80px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.book-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.book-tag {
    background: rgba(88, 101, 242, 0.2);
    color: var(--mc-primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid rgba(88, 101, 242, 0.3);
}

.read-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--mc-primary), #4752c4);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.read-btn::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 ease;
}

.read-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(88, 101, 242, 0.4);
}

.read-btn:hover::before {
    left: 100%;
}

/* 책 액션 버튼들 */
.book-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    justify-content: flex-end;
}

.action-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.public-btn {
    background: var(--mc-success);
    color: white;
}

.public-btn:hover {
    background: #3eb049;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(87, 242, 135, 0.3);
}

.private-btn {
    background: var(--mc-text-muted);
    color: white;
}

.private-btn:hover {
    background: #5a6269;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(114, 118, 125, 0.3);
}

/* 로그인 컨테이너 */
.login-container {
    max-width: 500px;
    margin: 2rem auto;
    background: var(--mc-bg-light);
    border: 1px solid var(--mc-border);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.login-container h2 {
    text-align: center;
    color: var(--mc-text-primary);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.login-container p {
    text-align: center;
    color: var(--mc-text-secondary);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--mc-text-primary);
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 14px;
    background: var(--mc-bg-dark);
    border: 1px solid var(--mc-border);
    border-radius: 8px;
    color: var(--mc-text-primary);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--mc-primary);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.2);
}

.form-group input::placeholder {
    color: var(--mc-text-muted);
}

button[type="submit"] {
    width: 100%;
    background: linear-gradient(135deg, var(--mc-primary), #4752c4);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(88, 101, 242, 0.4);
}

/* 책 모달 */
.book-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.book-modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.book-page {
    background: #ffffff;
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.4s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* 책 제목 */
.modal-book-title {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    text-align: center;
    margin: 0;
    padding: 30px 40px 20px;
    border-bottom: 2px solid #f0f0f0;
    background: #fafafa;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

/* 메타 정보 */
.modal-book-meta {
    text-align: center;
    padding: 15px 40px;
    background: #f8f9fa;
    color: #666;
    font-size: 0.9rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.modal-book-meta .divider {
    color: #999;
}

/* 페이지 표시 */
.page-indicator {
    position: absolute;
    top: 35px;
    right: 40px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 10;
}

/* 책 내용 */
.modal-book-content {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
    padding: 30px 40px;
    min-height: 300px;
    flex-grow: 1;
    overflow-y: auto;
}

.modal-book-content p {
    margin-bottom: 1.2em;
    text-align: justify;
}

/* 내비게이션 */
.book-nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}

.nav-btn-book {
    padding: 12px 20px;
    background: var(--mc-primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(88, 101, 242, 0.3);
}

.nav-btn-book:hover {
    background: #4752c4;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(88, 101, 242, 0.4);
}

.nav-btn-book:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: #ccc;
}

.nav-btn-book:disabled:hover {
    background: #ccc;
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 닫기 버튼 */
.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
    background: #ff4757;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
    z-index: 20;
}

.close-btn:hover {
    background: #ff3742;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.5);
}

/* 푸터 */
.footer {
    text-align: center;
    padding: 40px 0;
    margin-top: 60px;
    border-top: 1px solid var(--mc-border);
    color: var(--mc-text-muted);
    font-size: 0.9rem;
}

/* 로딩 */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--mc-text-secondary);
}

/* 애니메이션 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
    to { 
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 반응형 */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .header {
        padding: 24px 16px;
    }
    
    .header h1 {
        font-size: 2.2rem;
    }
    
    .nav {
        flex-direction: column;
        align-items: center;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
    
    .books-grid {
        grid-template-columns: 1fr;
    }
    
    .search-bar {
        flex-direction: column;
    }
    
    .search-bar input {
        min-width: 100%;
    }
    
    /* 모달 반응형 */
    .book-page {
        max-width: 90vw;
        max-height: 90vh;
        margin: 20px;
    }
    
    .modal-book-title {
        font-size: 1.5rem;
        padding: 20px 25px 15px;
    }
    
    .modal-book-content {
        padding: 20px 25px;
        font-size: 1rem;
    }
    
    .modal-book-meta {
        padding: 10px 25px;
        font-size: 0.8rem;
        gap: 10px;
    }
    
    .nav-btn-book {
        padding: 10px 16px;
        font-size: 0.8rem;
    }
    
    .book-nav {
        padding: 15px;
        gap: 10px;
    }
}

/* 스크롤바 커스텀 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--mc-bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--mc-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4752c4;
}