/* ===== CSS Variables ===== */
:root {
    --primary-color: #007BFF;
    --primary-hover: #0056b3;
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-muted: #6c757d;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --border-color: #dee2e6;
    --border-light: #e9ecef;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

/* ===== Layout ===== */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

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

/* ===== Header ===== */
.header {
    text-align: center;
    margin-bottom: 48px;
}

.main-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.sub-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 24px;
}

.description {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.description p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.7;
}

.description p:last-child {
    margin-bottom: 0;
}

.beta-notice {
    color: var(--text-muted) !important;
    font-size: 0.875rem !important;
    margin-top: 12px !important;
}

/* ===== Settings Section ===== */
.settings-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.setting-group {
    margin-bottom: 28px;
}

.setting-group:last-of-type {
    margin-bottom: 32px;
}

.setting-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* ===== Radio Buttons ===== */
.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 14px 24px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
    flex: 1;
    min-width: 140px;
}

.radio-option:hover {
    border-color: var(--primary-color);
    background: rgba(0, 123, 255, 0.02);
}

.radio-option input {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    margin-right: 10px;
    position: relative;
    transition: var(--transition);
}

.radio-option input:checked + .radio-custom {
    border-color: var(--primary-color);
}

.radio-option input:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 50%;
}

.radio-option input:checked ~ .radio-text {
    color: var(--primary-color);
    font-weight: 600;
}

.radio-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

/* ===== Select Dropdown ===== */
.select-wrapper {
    position: relative;
}

.select-wrapper select {
    width: 100%;
    padding: 14px 48px 14px 16px;
    font-size: 0.95rem;
    font-family: inherit;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    transition: var(--transition);
}

.select-wrapper select:hover {
    border-color: var(--primary-color);
}

.select-wrapper select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.select-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
}

/* ===== Continue Learning Notice ===== */
.continue-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(0, 123, 255, 0.05);
    border: 1px solid rgba(0, 123, 255, 0.2);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.continue-icon {
    font-size: 1.25rem;
}

.continue-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    flex: 1;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    width: 100%;
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 10px 20px;
    font-size: 0.875rem;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-text {
    background: transparent;
    color: var(--text-muted);
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 500;
}

.btn-text:hover {
    color: var(--text-primary);
}

.btn-icon {
    background: transparent;
    color: var(--text-secondary);
    padding: 10px;
    border-radius: var(--radius-sm);
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--primary-color);
}

/* ===== Study Page ===== */
.study-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.progress-info {
    flex: 1;
}

#progressText {
    font-size: 0.875rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 8px;
}

.progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.study-mode-badge {
    padding: 6px 14px;
    background: rgba(0, 123, 255, 0.1);
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ===== Case Header ===== */
.case-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.case-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 1.125rem;
    font-weight: 700;
    flex-shrink: 0;
}

.case-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

/* ===== Study Content ===== */
.study-content {
    position: relative;
    min-height: 300px;
}

.content-box {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    min-height: 250px;
}

#contentText {
    font-size: 1.05rem;
    line-height: 1.9;
    color: var(--text-primary);
    white-space: pre-wrap;
}

/* 포인트 텍스트 ([]로 감싸진 부분) */
.highlight {
    color: var(--primary-color);
    font-weight: 700;
}

/* ===== Transition Message ===== */
.transition-message {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    animation: fadeIn 0.3s ease;
}

.transition-message.show {
    display: flex;
}

.transition-icon {
    font-size: 3rem;
}

#transitionText {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== Content Progress ===== */
.content-progress {
    text-align: center;
    margin: 20px 0;
}

#contentProgressText {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ===== Navigation Buttons ===== */
.nav-buttons {
    display: flex;
    gap: 16px;
    margin-top: 24px;
}

.nav-buttons .btn {
    flex: 1;
}

.nav-buttons .btn-primary {
    width: auto;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .container {
        padding: 24px 16px;
    }

    .main-title {
        font-size: 1.375rem;
    }

    .description {
        padding: 20px 24px;
    }

    .description p {
        font-size: 0.875rem;
    }

    .settings-section {
        padding: 24px 20px;
    }

    .radio-group {
        flex-direction: column;
    }

    .radio-option {
        min-width: 100%;
    }

    .continue-notice {
        flex-direction: column;
        text-align: center;
    }

    .case-header {
        flex-direction: column;
        text-align: center;
    }

    .case-name {
        font-size: 1.25rem;
    }

    .content-box {
        padding: 24px 20px;
    }

    #contentText {
        font-size: 0.95rem;
    }

    .nav-buttons {
        flex-direction: column;
    }

    .study-nav {
        flex-wrap: wrap;
    }

    .study-mode-badge {
        order: -1;
        width: 100%;
        text-align: center;
        margin-bottom: 8px;
    }
}

/* ===== Animations ===== */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.content-box.animate {
    animation: slideIn 0.3s ease;
}

/* ===== Hidden Utility ===== */
.hidden {
    display: none !important;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
