/* 폰트 및 기본 설정 (Pretendard) */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

:root {
    --primary: #3182f6;        /* Toss Blue */
    --primary-light: #e8f3ff;  /* 연한 블루 (배경용) */
    --primary-dark: #1b64da;   /* 짙은 블루 (호버용) */
    --secondary: #ff6b6b;      /* 보조 강조색 (빨강) */
    --accent: #ffa500;         /* 악센트 색 (주황) */
    --success: #00ba34;        /* 성공 (초록) */
    --warning: #ffb24d;        /* 경고 (노랑) */
    --bg-color: #f8f9fc;       /* 더 밝은 배경 */
    --bg-secondary: #f2f4f8;   /* 보조 배경 */
    --text-main: #191f28;      /* 진한 검정 */
    --text-sub: #8b95a1;       /* 연한 회색 */
    --text-light: #a8b0b8;     /* 더 연한 회색 */
    --white: #ffffff;
    --border-radius: 20px;     /* 더 조화로운 모서리 */
    --border-radius-sm: 12px;  /* 작은 모서리 */
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.06); /* 부드러운 확산형 그림자 */
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.1); /* 더 강한 그림자 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04); /* 약한 그림자 */
    --border: 1px solid rgba(0, 0, 0, 0.05);  /* 아주 연한 테두리 */
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* 부드러운 트랜지션 */
}

* { box-sizing: border-box; }

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    letter-spacing: -0.02em; /* 자간을 좁혀서 단단한 느낌 */
}

a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; padding: 0; margin: 0; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; }

/* 2. Header (Glassmorphism & Sticky) */
header {
    background-color: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 64px;
    display: flex;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.header-inner {
    width: 100%;
    max-width: 1100px; /* 컨텐츠 폭을 살짝 좁혀 집중도 향상 */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

header h1 {
    font-size: 20px;
    color: var(--primary);
    cursor: pointer;
    font-weight: 800;
    letter-spacing: -0.5px;
    transition: var(--transition);
}
header h1:hover {
    text-shadow: 0 0 20px rgba(49, 130, 246, 0.3);
}

/* 검색창 & 유저 메뉴 */
#user_menu { display: flex; align-items: center; gap: 12px; }

#user_menu input {
    padding: 10px 16px;
    border-radius: 20px;
    border: 1px solid transparent;
    background-color: #f2f4f6;
    width: 240px;
    font-size: 14px;
    color: var(--text-main);
    transition: var(--transition);
}
#user_menu input::placeholder {
    color: var(--text-light);
}
#user_menu input:focus {
    background-color: #fff;
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(49, 130, 246, 0.15);
}

.btn-text {
    font-size: 14px;
    color: var(--text-sub);
    font-weight: 500;
    transition: var(--transition);
    padding: 8px 0;
}
.btn-text:hover {
    color: var(--text-main);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    padding: 8px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(49, 130, 246, 0.25);
}
.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(49, 130, 246, 0.35);
}

/* 3. Navigation (Tab Style) */
nav {
    background-color: var(--white);
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    margin-bottom: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

nav ul {
    display: flex;
    justify-content: center;
    max-width: 1100px;
    margin: 0 auto;
    gap: 40px;
}

nav li a {
    display: block;
    padding: 16px 8px;
    color: var(--text-sub);
    font-weight: 600;
    font-size: 16px;
    position: relative;
    transition: var(--transition);
}

nav li a:hover {
    color: var(--text-main);
}

/* 활성화 된 탭 디자인 (밑줄) */
nav li a.active {
    color: var(--text-main);
}
nav li a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 3px 3px 0 0;
    box-shadow: 0 -2px 8px rgba(49, 130, 246, 0.2);
}

/* 4. Main Layout */
#container {
    display: flex;
    max-width: 1140px;
    margin: 0 auto 60px auto;
    gap: 28px;
    padding: 0 20px;
    align-items: flex-start; /* 높이가 달라도 위쪽 정렬 */
}

/* Card Common Style */
.card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: 28px;
    box-shadow: var(--shadow);
    border: var(--border);
    margin-bottom: 24px;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}
.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}
.card h2, .card h3 {
    margin-bottom: 20px;
    font-size: 18px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Layout Widths */
#left { width: 240px; flex-shrink: 0; }
section { flex-grow: 1; min-width: 0; } /* min-width:0은 flex 아이템 넘침 방지 */
#right { width: 240px; flex-shrink: 0; }

/* 5. Components Detail */

/* Left Sidebar: Study List */
.img-wrapper {
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}
.img-wrapper img { 
    width: 100%; 
    display: block; 
    object-fit: cover;
    transition: var(--transition);
}
.img-wrapper:hover img {
    transform: scale(1.05);
}

.sidebar-list li {
    padding: 12px 10px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    color: var(--text-main);
    cursor: pointer;
    margin-bottom: 4px;
    transition: var(--transition);
}
.sidebar-list li:hover {
    background-color: var(--primary-light);
}

.badge {
    background-color: var(--primary-light);
    color: var(--primary);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

/* Audio Player */
.audio-box audio {
    width: 100%;
    height: 40px;
    border-radius: 20px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.05));
}

/* Video Player */
.video-wrapper {
    border-radius: 16px;
    overflow: hidden;
    background-color: black;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.video-wrapper video { width: 100%; display: block; }

/* Trend List Styles */
.trend-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trend-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    border-radius: 12px;
    background-color: #fcfcfc;
    border: 1px solid transparent;
    transition: var(--transition);
    cursor: pointer;
}

.trend-item:hover {
    background-color: var(--primary-light);
    border-color: var(--primary);
    transform: translateX(4px);
}

.trend-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
}

.trend-content {
    flex: 1;
    min-width: 0;
}

.trend-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-main);
    margin: 0 0 6px 0;
    line-height: 1.4;
}

.trend-meta {
    font-size: 12px;
    color: var(--text-light);
    margin: 0;
}

.qna-list li {
    margin-bottom: 8px;
}
.qna-list li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 12px;
    border-radius: 16px;
    background-color: #fcfcfc; /* 아주 연한 회색 */
    border: 1px solid transparent;
    transition: var(--transition);
}
.qna-list li a:hover {
    background-color: var(--white);
    border-color: #e5e8eb;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    transform: translateY(-2px); /* 살짝 떠오르는 효과 */
}
.qna-title { font-weight: 500; font-size: 16px; }
.qna-meta {
    font-size: 13px;
    color: var(--text-sub);
    background-color: #f2f4f6;
    padding: 4px 10px;
    border-radius: 12px;
}

/* Right Sidebar: Tags & AD */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud span {
    background-color: var(--white);
    border: 1px solid #e5e8eb;
    color: #4e5968;
    padding: 6px 14px;
    border-radius: 100px; /* 완전 둥근 알약 모양 */
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
}
.tag-cloud span:hover {
    border-color: var(--primary);
    color: var(--primary);
    background-color: var(--primary-light);
    transform: scale(1.05);
}

.banner {
    background: linear-gradient(120deg, #3182f6, #0050c9);
    color: white;
    padding: 24px;
    border-radius: 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(49, 130, 246, 0.3);
}
.banner:hover { 
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(49, 130, 246, 0.4);
}
.banner p { margin: 0; font-weight: 700; line-height: 1.4; }

/* Footer */
footer {
    border-top: 1px solid #e5e8eb;
    background-color: var(--white);
    color: var(--text-sub);
    text-align: center;
    padding: 40px 0 60px;
    margin-top: 40px;
    font-size: 13px;
}

footer a {
    color: var(--primary);
    font-weight: 600;
    transition: var(--transition);
}

footer a:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

/* --- 회원가입/로그인 폼 전용 스타일 (추가본) --- */

/* 중앙 정렬 카드 사이즈 조절 */
.auth-card {
    width: 100%;
    max-width: 460px; /* 너무 넓지 않게 */
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.auth-header p {
    color: var(--text-sub);
    font-size: 14px;
}

/* 입력 필드 그룹 */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333d4b;
}

.form-group input {
    width: 100%;
    padding: 14px;
    border: 1px solid #e5e8eb;
    border-radius: 12px; /* 둥근 입력창 */
    font-size: 15px;
    background-color: #f9fafb; /* 아주 연한 회색 배경 */
    transition: 0.2s;
    outline: none;
}

/* 입력창 포커스 효과 (Toss Blue) */
.form-group input:focus {
    background-color: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(49, 130, 246, 0.1);
}

/* 약관 동의 체크박스 */
.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    font-size: 14px;
    cursor: pointer;
}

.checkbox-group input {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary); /* 체크박스 색상 변경 */
}

.checkbox-group span {
    color: var(--primary);
    font-weight: bold;
}

/* 가득 차는 버튼 스타일 */
.btn-full {
    width: 100%;
    padding: 16px;
    background-color: var(--primary);
    color: white;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-full:hover {
    background-color: #1b64da;
}

/* --- 로그인 페이지 전용 추가 스타일 --- */

/* 하단 링크 영역 (비밀번호 찾기 | 회원가입) */
.auth-actions {
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
    color: var(--text-sub);
}

.auth-actions a {
    color: #4e5968;
    text-decoration: none;
    transition: color 0.2s;
}

.auth-actions a:hover {
    color: var(--primary); /* 마우스 올리면 파란색 */
    text-decoration: underline;
}

/* 구분선 (|) */
.auth-actions .divider {
    margin: 0 10px;
    color: #e5e8eb;
}

/* --- 게시판(Board) 전용 스타일 --- */

/* 게시판 헤더 (제목과 버튼 가로 배치) */
.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #f2f4f6;
    padding-bottom: 20px;
}

/* 필터 (최신순 등) */
.board-filter {
    margin-bottom: 15px;
    font-size: 14px;
    color: var(--text-sub);
}
.board-filter span {
    margin-right: 15px;
    cursor: pointer;
}
.board-filter span.active {
    color: var(--text-main);
    font-weight: bold;
}

/* 리스트 아이템 (한 줄) */
.board-item {
    display: flex;
    align-items: flex-start; /* 뱃지와 제목 높이 맞춤 */
    padding: 20px 0;
    border-bottom: 1px solid #f2f4f6;
    transition: background-color 0.2s;
}
.board-item:hover {
    background-color: #fafbfd; /* 마우스 올렸을 때 아주 연한 배경 */
}

/* 상태 뱃지 (해결/대기) */
.board-status {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    margin-right: 15px;
    min-width: 50px;
    text-align: center;
}
.board-status.completed {
    background-color: var(--primary-light);
    color: var(--primary);
}
.board-status.pending {
    background-color: #f2f4f6;
    color: var(--text-sub);
}

/* 게시글 내용 영역 */
.board-content {
    flex: 1;
}
.board-title {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
    text-decoration: none;
}
.board-title:hover {
    color: var(--primary); /* 제목 마우스 오버 시 파란색 */
}

/* 메타 정보 (작성자, 날짜 등) */
.board-meta {
    font-size: 13px;
    color: var(--text-sub);
    display: flex;
    gap: 12px;
}

/* 페이지네이션 (1, 2, 3...) */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 40px;
    gap: 8px;
}
.pagination a {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-sub);
    transition: 0.2s;
}
.pagination a:hover {
    background-color: #f2f4f6;
}
.pagination a.active {
    background-color: var(--primary);
    color: white;
    font-weight: bold;
}

/* --- 추가 고도화 스타일 --- */

/* 하이라이트 효과 */
.highlight {
    background: linear-gradient(120deg, rgba(49, 130, 246, 0.1), rgba(49, 130, 246, 0.2));
    border-left: 4px solid var(--primary);
    padding-left: 16px;
    border-radius: 0 8px 8px 0;
}

/* 상태 표시기 (온라인/오프라인) */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}
.status-indicator.online {
    background-color: var(--success);
    animation: pulse 2s infinite;
}
.status-indicator.offline {
    background-color: #d0d0d0;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* 로딩 스켈레톤 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 스크롤 부드러움 */
html {
    scroll-behavior: smooth;
}

/* 텍스트 선택 스타일 */
::selection {
    background-color: var(--primary);
    color: white;
}

/* 스크롤바 스타일 (웹킷 기반 브라우저) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

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

/* ===== 반응형 디자인 (미디어 쿼리) ===== */

@media (max-width: 1200px) {
    #container {
        gap: 20px;
    }
    
    #left, #right {
        width: 200px;
    }
}

@media (max-width: 1024px) {
    #container {
        flex-direction: column;
        gap: 20px;
    }
    
    #left, #right {
        width: 100%;
    }
    
    nav ul {
        gap: 20px;
    }
    
    nav li a {
        padding: 12px 4px;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        gap: 12px;
        height: auto;
        padding: 12px 16px;
    }
    
    header {
        height: auto;
    }
    
    #user_menu {
        width: 100%;
        justify-content: center;
    }
    
    #user_menu input {
        width: 100%;
        max-width: 240px;
    }
    
    nav ul {
        flex-wrap: wrap;
        gap: 12px;
        padding: 12px 16px;
    }
    
    nav li a {
        font-size: 13px;
        padding: 10px 4px;
    }
    
    .card {
        padding: 20px;
        border-radius: 16px;
    }
    
    .trend-item {
        gap: 12px;
        padding: 12px;
    }
    
    .trend-badge {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .qna-list li a {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .qna-meta {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    header h1 {
        font-size: 18px;
    }
    
    .card {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .card h2, .card h3 {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    nav ul {
        gap: 8px;
    }
    
    nav li a {
        padding: 8px 2px;
        font-size: 12px;
    }
    
    .trend-item {
        padding: 10px;
    }
    
    .trend-content {
        min-width: 0;
    }
    
    .trend-title {
        font-size: 13px;
    }
    
    .trend-meta {
        font-size: 11px;
    }
}