/* 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1e3a8a;
    --secondary-color: #3b82f6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    overflow-y: hidden;
    height: 100vh;
    position: fixed;
    width: 100%;
}

/* 페이지 전환 */
.page {
    display: none;
    min-height: 100vh;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-color);
    z-index: 1;
    animation: fadeIn 0.3s ease-in-out;
}

.page.active {
    display: block;
    z-index: 10;
}

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

/* 컨테이너 */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

/* 랜딩 페이지 */
#landingPage {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    z-index: 1;
}

#loginPage,
#signupPage {
    background-color: white;
    z-index: 1;
}

#mainApp {
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 50%, #bfdbfe 100%);
    z-index: 1;
}

.logo-container {
    text-align: center;
    margin-bottom: 20px;
}

.logo-text {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 10px;
    color: white;
    text-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    letter-spacing: -1px;
}

.logo {
    display: none;
}

.subtitle {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 15px;
    text-align: center;
    color: white;
}

.description {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 40px;
    text-align: center;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 로고 (작은 버전) */
.logo-container-small {
    text-align: center;
    margin-bottom: 30px;
}

.logo-text-small {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--primary-color);
    letter-spacing: -1px;
}

.subtitle-small {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 0;
}

.logo-small {
    display: none;
}

/* 버튼 */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

.btn-secondary {
    background-color: transparent;
    color: white;
    border: 2px solid white;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.btn-block {
    width: 100%;
}

.btn-back {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    margin-bottom: 20px;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 20px;
    color: white;
    cursor: pointer;
    padding: 8px;
}

.btn-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
}

/* 폼 */
.auth-form {
    margin: 30px 0;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

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

.form-footer {
    text-align: center;
    color: var(--text-secondary);
    margin-top: 20px;
}

.form-footer a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
}

/* 헤더 */
.app-header {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    border-bottom: none;
    padding: 18px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.2);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 600px;
    margin: 0 auto;
}

.header-logo {
    display: none;
}

.header-logo-text {
    font-size: 24px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    color: white;
}

/* 하단 네비게이션 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #ffffff 0%, #f0f9ff 100%);
    border-top: 2px solid #bfdbfe;
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    z-index: 100;
    box-shadow: 0 -4px 12px rgba(59, 130, 246, 0.1);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s ease;
}

.nav-item i {
    font-size: 22px;
}

.nav-item span {
    font-size: 12px;
    font-weight: 500;
}

.nav-item.active {
    color: #2563eb;
    transform: scale(1.05);
}

/* 탭 콘텐츠 */
.tab-content {
    display: none;
    padding-bottom: 80px;
    min-height: calc(100vh - 70px);
}

.tab-content.active {
    display: block;
}

/* 챕터 정보 */
.chapter-info {
    text-align: center;
    padding: 30px 20px 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    margin: -20px -20px 20px -20px;
    border-radius: 0 0 24px 24px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.chapter-info h3 {
    font-size: 32px;
    color: white;
    margin-bottom: 8px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chapter-number {
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 15px;
}

.chapter-nav-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.btn-nav {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-nav:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
    transform: scale(1.05);
}

.btn-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-nav:disabled:hover {
    transform: none;
}

/* 구절 카드 */
.verse-card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.12);
    border: 2px solid #bfdbfe;
    transition: all 0.3s ease;
}

.verse-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.2);
    border-color: #93c5fd;
}

.verse-reference {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.verse-reference h4 {
    font-size: 22px;
    color: #1e40af;
    font-weight: 700;
}

.speaker-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 22px;
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.speaker-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    transform: scale(1.08);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.4);
}

.speaker-btn.playing {
    background-color: var(--danger-color);
}

.verse-text {
    color: #475569;
    line-height: 2;
    font-size: 16px;
    display: none;
    padding: 16px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-radius: 12px;
    margin-top: 12px;
    border-left: 4px solid #3b82f6;
}

.verse-text.show {
    display: block;
}

/* 암기 섹션 */
.memorization-section {
    background: white;
    border-radius: 20px;
    padding: 28px;
    margin-top: 30px;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.12);
    border: 2px solid #bfdbfe;
}

.memorization-section h4 {
    font-size: 22px;
    margin-bottom: 10px;
    color: #1e40af;
    font-weight: 700;
}

.hint {
    color: #475569;
    font-size: 14px;
    margin-bottom: 20px;
    font-weight: 500;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 10px;
    color: #1e40af;
    font-size: 15px;
}

.input-group textarea {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border: 2px solid #bfdbfe;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    background-color: #f8fafc;
    transition: all 0.3s ease;
}

.input-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    background-color: white;
}

/* 결과 메시지 */
.result-message {
    margin-top: 24px;
    padding: 24px;
    border-radius: 16px;
    text-align: center;
    font-weight: 700;
    font-size: 20px;
    display: none;
    animation: slideUp 0.4s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.result-message.show {
    display: block;
}

.result-message.success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 2px solid #34d399;
}

.result-message.error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 2px solid #f87171;
}

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

/* 진도 통계 */
.progress-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 20px 0 30px;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
    border: 2px solid #bfdbfe;
}

.stat-card i {
    font-size: 32px;
    color: #3b82f6;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #1e40af;
}

/* 챕터 리스트 */
.chapter-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chapter-item {
    background: white;
    border-radius: 16px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
    border: 2px solid #e0e7ff;
    transition: all 0.3s ease;
}

.chapter-item:not(.locked) {
    cursor: pointer;
}

.chapter-item:not(.locked):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    border-color: #93c5fd;
}

.chapter-item.completed {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-left: 4px solid #10b981;
}

.chapter-item.locked {
    opacity: 0.5;
}

.chapter-item-info h5 {
    font-size: 16px;
    margin-bottom: 4px;
    color: #1e40af;
    font-weight: 600;
}

.chapter-item-info p {
    font-size: 13px;
    color: #64748b;
}

.chapter-status i {
    font-size: 24px;
}

.chapter-status .fa-check-circle {
    color: var(--success-color);
}

.chapter-status .fa-lock {
    color: var(--text-secondary);
}

.chapter-status .fa-circle {
    color: var(--warning-color);
}

/* 랭킹 리스트 */
.ranking-list {
    margin-top: 20px;
}

.ranking-item {
    background: white;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
    border: 2px solid #e0e7ff;
}

.ranking-item.top-3 {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
}

.rank-number {
    font-size: 24px;
    font-weight: 700;
    color: #1e40af;
    min-width: 40px;
    text-align: center;
}

.ranking-item.top-3 .rank-number {
    color: #f59e0b;
}

.rank-info {
    flex: 1;
}

.rank-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #1e293b;
}

.rank-score {
    font-size: 13px;
    color: #64748b;
}

.rank-medal {
    font-size: 28px;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 30px;
    width: 100%;
    max-width: 600px;
    position: relative;
    animation: slideUpModal 0.3s ease-out;
    border-top: 3px solid #3b82f6;
}

@keyframes slideUpModal {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.modal-content h3 {
    font-size: 22px;
    margin-bottom: 20px;
    color: #1e40af;
}

.menu-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-item {
    background-color: #eff6ff;
    border: 2px solid #bfdbfe;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #1e293b;
    transition: all 0.3s ease;
}

.menu-item:hover {
    background-color: #dbeafe;
    border-color: #93c5fd;
}

.menu-item i {
    font-size: 20px;
    color: #3b82f6;
}

/* 로딩 스피너 */
.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--secondary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

/* 반응형 */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    .logo-text {
        font-size: 36px;
    }

    .subtitle {
        font-size: 22px;
    }

    .logo-text-small {
        font-size: 28px;
    }

    .chapter-info h3 {
        font-size: 26px;
    }

    .verse-reference h4 {
        font-size: 18px;
    }

    .speaker-btn {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }

    .progress-stats {
        grid-template-columns: 1fr;
    }
}

/* 다크모드 대응 */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --bg-color: #111827;
        --card-bg: #1f2937;
        --border-color: #374151;
    }
}
