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

:root {
    --primary-color: #232f3e;
    --secondary-color: #ff9900;
    --background-color: #f5f5f5;
    --card-background: #ffffff;
    --text-color: #333333;
    --text-secondary: #666666;
    --border-color: #dddddd;
    --hover-color: #f0f0f0;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --error-color: #dc3545;
    --sidebar-width: 280px;
    --header-height: 80px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* 모바일 전용 헤더 - 기본 숨김 */
.mobile-header {
    display: none;
}

/* 컨테이너 레이아웃 */
.container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* 사이드바 */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary-color);
    color: white;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reinvent-logo {
    width: 100%;
    max-width: 200px;
    height: auto;
    cursor: pointer;
    margin-bottom: 8px;
}

.sidebar-subtitle {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
    line-height: 1.3;
}

.built-with-icons {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.built-with-text {
    margin-right: 4px;
}

.tech-icon-sidebar {
    width: 22px;
    height: 22px;
    object-fit: contain;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.tech-icon-sidebar:hover {
    opacity: 1;
}

.sidebar-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

/* 모바일 진행상황 (사이드바용) - 기본 숨김 */
.progress-stats.mobile {
    display: none;
}

.playlist-container {
    flex: 1;
    overflow-y: auto;
}

.playlist-list {
    list-style: none;
    padding: 10px 0;
}

.playlist-list li {
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-left: 3px solid transparent;
}

.playlist-list li:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.playlist-list li.active {
    background-color: rgba(255, 153, 0, 0.2);
    border-left-color: var(--secondary-color);
}

.playlist-list li .playlist-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.playlist-list li .playlist-count {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.playlist-list .empty-playlist {
    padding: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    cursor: default;
}

.playlist-list .empty-playlist:hover {
    background-color: transparent;
}

/* 메인 콘텐츠 */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 헤더 */
.content-header {
    min-height: var(--header-height);
    background-color: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    flex-wrap: wrap;
    min-width: 300px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-container {
    position: relative;
    width: 520px;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--secondary-color);
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
}

.search-clear:hover {
    color: var(--text-color);
}

/* 북마크 필터 버튼 */
.bookmark-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background-color: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.bookmark-filter:hover {
    border-color: var(--secondary-color);
    background-color: #fff9f0;
}

.bookmark-filter.active {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

.bookmark-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.bookmark-filter.active .bookmark-icon {
    color: white;
}

.bookmark-count {
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

/* Powered by 텍스트 */
.powered-by {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.powered-by .tech-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 800;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.powered-by .tech-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.tech-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: middle;
}

/* About 링크 */
.about-link {
    font-size: 0.9rem;
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 800;
    transition: color 0.2s;
}

.about-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* 진행상황 통계 */
.progress-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    background-color: #f8f9fa;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.progress-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.progress-stats .stat-label {
    font-weight: 500;
}

.progress-stats .stat-value {
    font-weight: 700;
    color: var(--text-color);
}

.progress-stats .stat-value.completed {
    color: var(--success-color);
}

/* Prefix 필터 */
.prefix-filter-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.prefix-filter-container label {
    font-weight: 500;
    color: var(--text-secondary);
}

.prefix-filter {
    padding: 10px 16px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: white;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    min-width: 120px;
}

.prefix-filter:focus {
    border-color: var(--secondary-color);
}

.language-selector-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.language-selector-container label {
    font-weight: 500;
    color: var(--text-secondary);
}

.language-selector {
    padding: 10px 16px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: white;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.language-selector:focus {
    border-color: var(--secondary-color);
}

/* 세션 목록 컨테이너 */
.session-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px;
}

.session-count {
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.session-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* 세션 카드 */
.session-card {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.session-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: var(--secondary-color);
}

.session-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.session-code-with-bookmark {
    display: flex;
    align-items: center;
    gap: 8px;
}

.session-code {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.session-bookmark {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 2px;
    color: #999999;
    transition: all 0.2s;
}

.session-bookmark:hover {
    transform: scale(1.2);
    color: var(--secondary-color);
}

.session-bookmark.bookmarked {
    color: var(--secondary-color);
}

.session-bookmark.bookmarked:hover {
    color: #e68a00;
}

.session-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.session-status.completed {
    background-color: var(--success-color);
    color: white;
}

.session-status.in-progress {
    background-color: var(--warning-color);
    color: white;
}

.session-status.pending {
    background-color: var(--text-secondary);
    color: white;
}

.session-status.failed {
    background-color: var(--error-color);
    color: white;
}

.session-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 12px;
    color: var(--text-color);
}

.session-languages {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.language-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.language-badge.available {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.language-badge.unavailable {
    background-color: #f5f5f5;
    color: #999999;
}

/* 요약 뷰어 */
.summary-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--card-background);
    height: 100vh;
    overflow: hidden;
}

.summary-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    background-color: white;
    transition: transform 0.3s ease-in-out;
}

.summary-header.hidden {
    transform: translateY(-100%);
}

.summary-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
}

.close-button {
    background: none;
    border: none;
    color: var(--secondary-color);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
    transition: color 0.2s;
    flex-shrink: 0;
}

.close-button:hover {
    color: var(--primary-color);
}

.disclaimer-notice {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #856404;
    flex: 1;
}

.summary-title-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.summary-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    flex: 1;
}

.summary-bookmark {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    padding: 4px;
    color: #999999;
    transition: all 0.2s;
}

.summary-bookmark:hover {
    transform: scale(1.15);
    color: var(--secondary-color);
}

.summary-bookmark.bookmarked {
    color: var(--secondary-color);
}

.summary-bookmark.bookmarked:hover {
    color: #e68a00;
}

.summary-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.summary-content h1,
.summary-content h2,
.summary-content h3 {
    color: var(--primary-color);
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.summary-content h1 {
    font-size: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5em;
}

.summary-content h2 {
    font-size: 1.5rem;
}

.summary-content h3 {
    font-size: 1.2rem;
}

.summary-content p {
    margin-bottom: 1em;
    line-height: 1.8;
}

.summary-content ul,
.summary-content ol {
    margin-left: 2em;
    margin-bottom: 1em;
}

.summary-content li {
    margin-bottom: 0.5em;
}

.summary-content a {
    color: var(--secondary-color);
    text-decoration: none;
}

.summary-content a:hover {
    text-decoration: underline;
}

.summary-content code {
    background-color: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.summary-content pre {
    background-color: #f5f5f5;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1em;
}

/* 로딩 인디케이터 */
.loading-indicator {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-secondary);
}

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

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 오류 메시지 */
.error-message {
    padding: 20px;
    margin: 20px 30px;
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
}

/* 알림 메시지 (헤더 바로 아래) */
.error-message.notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.95rem;
}

/* 콘텐츠 없음 메시지 */
.content-not-available {
    text-align: center;
    padding: 80px 40px;
    color: var(--text-secondary);
}

.content-not-available h2 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 16px;
}

.content-not-available p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 12px;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    /* 모바일 전용 헤더 표시 */
    .mobile-header {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background-color: var(--primary-color);
        color: white;
        padding: 12px 16px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        z-index: 200;
    }
    
    .mobile-header-content {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }
    
    .mobile-title {
        font-size: 1.1rem;
        font-weight: 600;
        margin: 0;
        white-space: nowrap;
    }
    
    .progress-stats-mobile {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 0.7rem;
        padding: 4px 8px;
        background-color: rgba(255, 255, 255, 0.1);
        border-radius: 4px;
        white-space: nowrap;
    }
    
    .progress-stats-mobile .stat-item {
        display: flex;
        gap: 3px;
    }
    
    .progress-stats-mobile .stat-label {
        color: rgba(255, 255, 255, 0.8);
    }
    
    .progress-stats-mobile .stat-value {
        color: white;
        font-weight: 600;
    }
    
    .progress-stats-mobile .stat-value.completed {
        color: #90ee90;
    }
    
    .language-selector-container.mobile-inline {
        display: flex;
    }
    
    .language-selector-mobile {
        padding: 4px 8px;
        font-size: 0.85rem;
        border: 1px solid rgba(255, 255, 255, 0.3);
        background-color: rgba(255, 255, 255, 0.1);
        color: white;
        border-radius: 4px;
    }
    
    .language-selector-mobile option {
        background-color: var(--primary-color);
        color: white;
    }
    
    .container {
        flex-direction: column;
        height: calc(100vh - 48px);
        margin-top: 48px;
    }

    /* 모바일에서 사이드바 숨김 */
    .sidebar {
        display: none;
    }
    
    .content {
        height: calc(100vh - 48px);
    }
    
    .content-header {
        height: auto;
        padding: 12px 16px;
        gap: 10px;
    }
    
    .header-left {
        width: 100%;
        gap: 10px;
    }
    
    /* 데스크톱 헤더 우측 숨김 (언어 선택은 모바일 헤더로 이동) */
    .header-right {
        display: none !important;
    }
    
    /* 검색창은 첫 번째 줄 전체 */
    .search-container {
        width: 100%;
        flex-basis: 100%;
    }
    
    /* 두 번째 줄: 트랙필터 + 북마크를 한 줄에 */
    .prefix-filter-container {
        flex: 1.8;
        min-width: 0;
    }
    
    .prefix-filter-container label {
        font-size: 0.85rem;
    }
    
    .prefix-filter {
        width: 100%;
        font-size: 0.9rem;
        padding: 8px 12px;
    }
    
    .bookmark-filter {
        flex: 1;
        min-width: 0;
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    /* 데스크톱 진행상황 숨김 */
    .header-left .progress-stats {
        display: none !important;
    }

    .search-container {
        width: 100%;
    }

    .session-list {
        grid-template-columns: 1fr;
    }

    .summary-content {
        padding: 20px;
    }
    
    /* 모바일에서 경고 메시지 크기 축소 */
    .disclaimer-notice {
        font-size: 0.65rem;
        line-height: 1.3;
        padding: 6px 10px;
    }
    
    .summary-header-top {
        margin-bottom: 12px;
        gap: 12px;
    }
    
    /* 모바일에서 세션 제목 크기 축소 */
    .summary-title {
        font-size: 1rem;
        font-weight: 700;
        line-height: 1.3;
    }
    
    .summary-bookmark {
        font-size: 1.2rem;
    }
    
    /* 모바일에서 스크롤 시 헤더 숨김 애니메이션 */
    .summary-viewer {
        position: relative;
    }
    
    .summary-header {
        position: fixed;
        top: 48px;
        left: 0;
        right: 0;
        z-index: 100;
        transition: transform 0.3s ease-in-out;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    
    .summary-header.hidden {
        transform: translateY(-100%);
    }
    
    .summary-content {
        padding-top: 180px;
        transition: padding-top 0.3s ease-in-out;
    }
    
    .summary-header.hidden ~ .summary-content {
        padding-top: 20px;
    }
    
    /* 모바일에서 세션 상세보기 시 헤더 필터 숨김 */
    .summary-viewer ~ .content .content-header {
        display: none;
    }
    
    body:has(.summary-viewer[style*="display: flex"]) .content-header,
    body:has(.summary-viewer[style*="display:flex"]) .content-header {
        display: none !important;
    }
    
    body:has(.summary-viewer[style*="display: flex"]) .mobile-header,
    body:has(.summary-viewer[style*="display:flex"]) .mobile-header {
        display: block !important;
    }
}

/* 스크롤바 스타일 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

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