/**
 * HARA 3컬럼 레이아웃 공통 CSS
 * 진로피드 표준 디자인 (EBS 스타일)
 * 모든 메인 페이지에서 사용
 */

/* ===== 색상 변수 ===== */
:root {
    --page-primary: #8b5cf6;
    --page-secondary: #7c3aed;
    --page-accent: #FF6B35;
    --page-success: #059669;
    --page-header-dark: #6d28d9;
    --page-header-light: #8b5cf6;
    --page-header-soft: #a78bfa;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --text-dark: #1a1a1a;
    --text-medium: #444;
    --text-light: #666;
}

/* ===== 3컬럼 레이아웃 ===== */
.page-layout {
    display: flex;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 10px 16px;
    gap: 16px;
    align-items: flex-start;
    box-sizing: border-box;
}

/* 왼쪽 사이드바 */
.page-sidebar-left {
    width: 160px;
    max-width: 160px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    overflow: hidden;
    margin-top: 40px;
}

/* 중앙 콘텐츠 */
.page-main {
    flex: 1;
    min-width: 0;
    margin-top: 0;
}

/* 오른쪽 사이드바 */
.page-sidebar-right {
    width: 120px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    margin-top: 40px;
}

/* 오른쪽 사이드바 헤더 - 페이지별 테마 색상 적용 (기본값 제거) */
/* 각 페이지에서 .sidebar-widget-header 스타일로 통일 적용 */

/* ===== 왼쪽 사이드바 - 메뉴 탭 ===== */
.sidebar-nav {
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.sidebar-nav-header {
    padding: 12px 10px;
    background: linear-gradient(135deg, #6d28d9 0%, #8b5cf6 100%);
    border-bottom: none;
    text-align: center;
}

.sidebar-nav-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    margin: 0 0 2px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.sidebar-nav-title i {
    color: rgba(255,255,255,0.9);
}

.sidebar-nav-subtitle {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.8);
    margin: 0;
    line-height: 1.3;
    text-align: center;
}

.sidebar-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav-item {
    border-bottom: 1px solid #eee;
}

.sidebar-nav-item:last-child {
    border-bottom: none;
}

/* 사이드바 구분선 (학생용/교사용 등) */
.sidebar-nav-divider {
    padding: 6px 10px 4px 10px;
    font-size: 0.6rem;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: transparent;
    border-bottom: 1px solid #e5e5e5;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    text-decoration: none;
    color: #4b5563;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
    background: white;
    border-left: 3px solid transparent;
}

.sidebar-nav-link:hover {
    background: #f5f3ff;
    color: var(--page-primary);
    border-left-color: #ddd6fe;
}

.sidebar-nav-link.active {
    background: #f5f3ff;
    color: var(--page-primary);
    font-weight: 600;
    border-left-color: var(--page-primary);
}

.sidebar-nav-link.active:hover {
    background: #ede9fe;
    color: var(--page-primary);
}

.sidebar-nav-link i {
    width: 18px;
    text-align: center;
    font-size: 0.875rem;
    color: #9ca3af;
}

.sidebar-nav-link:hover i,
.sidebar-nav-link.active i {
    color: var(--page-primary);
}

.sidebar-nav-count {
    margin-left: auto;
    background: #e2e8f0;
    color: #475569;
    padding: 2px 6px;
    border-radius: 0;
    font-size: 0.7rem;
    font-weight: 600;
}

.sidebar-nav-link.active .sidebar-nav-count {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* 사이드바 메뉴 설명 텍스트 (공통) */
.sidebar-nav-desc {
    display: block;
    font-size: 0.65rem;
    color: #888;
    margin-top: 2px;
    font-weight: 400;
}

/* ===== 중앙 - 메인 콘텐츠 헤더 ===== */
.main-header {
    margin-bottom: 24px;
}

.main-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.main-title i {
    color: var(--page-primary);
}

.main-subtitle {
    color: #475569;
    font-size: 0.95rem;
    margin: 0;
}

/* ===== 메인 페이지 - EBS 스타일 섹션 ===== */
.main-section {
    background: white;
    border-radius: 0;
    margin-bottom: 24px;
    overflow: visible;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    background: transparent;
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 16px;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 0;
    position: relative;
}

.section-title::after {
    display: none;
}

.section-title i {
    color: #4d6bcc;
    font-size: 1.1rem;
}

.section-more {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.section-more:hover {
    color: #4d6bcc;
}

.section-content {
    padding: 0;
    background: white;
}

/* ===== 콘텐츠 그리드 ===== */
.content-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.content-grid.single-column {
    grid-template-columns: 1fr;
}

.content-grid.three-column {
    grid-template-columns: repeat(3, 1fr);
}

.content-grid.four-column {
    grid-template-columns: repeat(4, 1fr);
}

/* ===== 콘텐츠 카드 ===== */
.content-card {
    background: #f8f8f8;
    border-radius: 0;
    overflow: hidden;
    transition: all 0.2s;
    text-decoration: none;
    display: block;
}

.content-card:hover {
    transform: translateY(-2px);
    background: #f0f0f0;
}

.content-card-body {
    padding: 16px;
}

.content-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.content-card-badge {
    padding: 3px 10px;
    border-radius: 0;
    font-size: 0.7rem;
    font-weight: 600;
    background: #e2e8f0;
    color: #475569;
}

.content-card-badge.primary { background: #dbeafe; color: #1d4ed8; }
.content-card-badge.success { background: #dcfce7; color: #16a34a; }
.content-card-badge.warning { background: #fef3c7; color: #d97706; }
.content-card-badge.danger { background: #fee2e2; color: #dc2626; }
.content-card-badge.purple { background: #ddd6fe; color: #6d28d9; }
.content-card-badge.pink { background: #fbcfe8; color: #be185d; }

.content-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.content-card-desc {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 12px;
}

.content-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #64748b;
    padding-top: 8px;
    background: #f5f5f5;
    margin: 0 -16px -16px -16px;
    padding: 8px 16px;
}

.content-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--page-primary);
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* ===== 아이템 리스트 ===== */
.item-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #eee;
}

.item-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-radius: 0;
    text-decoration: none;
    transition: all 0.2s;
    color: inherit;
}

.item-list-item:hover {
    background: #f8f8f8;
}

.item-list-icon {
    width: 40px;
    height: 40px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: var(--page-primary);
    font-size: 1rem;
    flex-shrink: 0;
}

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

.item-list-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.item-list-meta {
    font-size: 0.8rem;
    color: #64748b;
    display: flex;
    gap: 12px;
}

.item-list-badge {
    padding: 4px 10px;
    background: #e2e8f0;
    color: #475569;
    border-radius: 0;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ===== 사이드바 - 위젯 래퍼 (통합) ===== */
.sidebar-widget-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.sidebar-widget-header {
    padding: 6px;
    /* 배경색은 각 페이지에서 테마별로 정의 */
}

.sidebar-widget-header-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    margin: 0;
    text-align: center;
}

.sidebar-widget {
    background: white;
    border-radius: 0;
    margin-bottom: 0;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    word-break: break-word;
}

.sidebar-widget:last-child {
    border-bottom: 1px solid #e0e0e0;
}

.widget-header {
    padding: 4px 6px;
    background: #e8e8e8;
    border-bottom: 1px solid #ddd;
}

.widget-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: #333;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.widget-title .badge-hot {
    background: none;
    color: #dc2626;
    font-size: 0.55rem;
    padding: 0;
    font-weight: 800;
    font-style: italic;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.widget-content {
    padding: 0;
}

.widget-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget-list-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    background: white;
    border-bottom: 1px solid #f0f0f0;
}

.widget-list-item:last-child {
    border-bottom: none;
}

.widget-list-item:hover {
    background: #f5f5f5;
}

.widget-rank {
    width: 14px;
    height: 14px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 700;
    flex-shrink: 0;
}

.widget-rank.rank-1 { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: white; }
.widget-rank.rank-2 { background: linear-gradient(135deg, #64748b 0%, #475569 100%); color: white; }
.widget-rank.rank-3 { background: linear-gradient(135deg, #b45309 0%, #92400e 100%); color: white; }
.widget-rank.rank-other { background: #e2e8f0; color: #475569; }

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

.widget-item-title {
    font-size: 0.6rem;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.widget-item-meta {
    font-size: 0.55rem;
    color: #64748b;
    margin-top: 0;
    line-height: 1.2;
}

.widget-item-icon {
    color: #94a3b8;
    font-size: 0.55rem;
    display: none;
}

/* 랭킹 포인트 배지 */
.point-badge {
    background: var(--page-primary);
    color: white;
    padding: 1px 4px;
    border-radius: 0;
    font-size: 0.5rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* 위젯 빈 상태 */
.widget-empty {
    text-align: center;
    padding: 8px 6px;
    color: #64748b;
    font-size: 0.6rem;
}

.widget-empty i {
    font-size: 1rem;
    margin-bottom: 3px;
    opacity: 0.4;
}

.widget-empty p {
    font-size: 0.75rem;
    margin: 0;
}

/* ===== 빈 상태 ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

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

/* ===== 퀵 액션 버튼 ===== */
.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--page-primary);
    color: white;
    border-radius: 0;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    border: none;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.quick-action-btn:hover {
    transform: translateY(-3px);
    background: var(--page-secondary);
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ===== 탭 메뉴 ===== */
.tab-menu {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 20px;
}

.tab-menu-item {
    padding: 12px 20px;
    text-decoration: none;
    color: #666;
    font-weight: 500;
    font-size: 0.95rem;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-menu-item:hover {
    color: var(--page-primary);
}

.tab-menu-item.active {
    color: var(--page-primary);
    border-bottom-color: var(--page-primary);
    font-weight: 600;
}

/* ===== 검사 카드 (심리검사용) ===== */
.test-card {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 0;
    padding: 16px;
    transition: all 0.2s;
    text-decoration: none;
    display: block;
}

.test-card:hover {
    border-color: var(--page-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.test-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.test-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: var(--page-primary);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.test-card-info {
    flex: 1;
}

.test-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.test-card-subtitle {
    font-size: 0.8rem;
    color: #64748b;
}

.test-card-desc {
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.5;
    margin-bottom: 12px;
}

.test-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

.test-card-meta {
    font-size: 0.75rem;
    color: #94a3b8;
    display: flex;
    gap: 12px;
}

.test-card-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 0;
}

.test-card-status.completed {
    background: #dcfce7;
    color: #16a34a;
}

.test-card-status.pending {
    background: #f1f5f9;
    color: #64748b;
}

/* ===== 반응형 - 태블릿 ===== */
@media (max-width: 1200px) {
    .page-layout {
        padding: 16px;
        gap: 16px;
    }

    .page-sidebar-left {
        width: 180px;
    }

    .page-sidebar-right {
        width: 200px;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .content-grid.three-column,
    .content-grid.four-column {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== 반응형 - 모바일 ===== */
@media (max-width: 992px) {
    .page-layout {
        flex-direction: column;
        gap: 12px;
        padding: 8px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .page-sidebar-left,
    .page-sidebar-right {
        width: 100% !important;
        max-width: 100% !important;
        position: static;
        margin-top: 0;
        box-sizing: border-box;
    }

    .page-sidebar-left {
        order: 1;
    }

    .page-main {
        order: 2;
        width: 100%;
        max-width: 100%;
    }

    .page-sidebar-right {
        order: 3;
    }

    /* 모바일에서 왼쪽 사이드바는 가로 스크롤 탭으로 */
    .sidebar-nav {
        border-radius: 8px;
        position: sticky;
        top: 0;
        z-index: 100;
        background: white;
        width: 100%;
    }

    .sidebar-nav-header {
        display: none;
    }

    .sidebar-nav-list {
        display: flex;
        overflow-x: auto;
        gap: 6px;
        padding: 10px 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        width: 100%;
    }

    .sidebar-nav-list::-webkit-scrollbar {
        display: none;
    }

    .sidebar-nav-item {
        border-bottom: none;
        flex-shrink: 0;
    }

    .sidebar-nav-link {
        padding: 10px 16px;
        border-radius: 20px;
        background: #f1f5f9;
        white-space: nowrap;
        font-size: 0.85rem;
        border-left: none;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .sidebar-nav-link.active {
        background: var(--page-primary);
        color: white;
        border-left: none;
    }

    .sidebar-nav-link i {
        display: none;
    }

    .sidebar-nav-desc {
        display: none;
    }

    /* 모바일에서 오른쪽 사이드바 위젯들 가로 배치 */
    .page-sidebar-right .sidebar-widget-wrapper {
        display: flex;
        flex-direction: row;
        gap: 10px;
        overflow-x: auto;
        padding: 8px 0;
        -webkit-overflow-scrolling: touch;
        border: none;
        background: transparent;
        scrollbar-width: none;
        width: 100%;
    }

    .page-sidebar-right .sidebar-widget-wrapper::-webkit-scrollbar {
        display: none;
    }

    .sidebar-widget {
        min-width: 200px;
        max-width: 280px;
        flex-shrink: 0;
        margin-bottom: 0;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
    }

    .sidebar-widget-header {
        border-radius: 8px 8px 0 0;
    }

    .content-grid.three-column,
    .content-grid.four-column {
        grid-template-columns: 1fr;
    }

    /* 메인 섹션 전체 너비 */
    .main-section {
        width: 100%;
        max-width: 100%;
    }

    /* 스크롤 힌트 표시 (그라데이션) */
    .page-sidebar-left::after,
    .page-sidebar-right::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 20px;
        background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
        pointer-events: none;
    }
}

@media (max-width: 600px) {
    .page-layout {
        padding: 4px;
        width: 100%;
        max-width: 100%;
    }

    .page-sidebar-left,
    .page-sidebar-right,
    .page-main {
        width: 100% !important;
        max-width: 100% !important;
    }

    .main-header {
        margin-bottom: 12px;
    }

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

    .main-subtitle {
        font-size: 0.85rem;
    }

    .section-header {
        padding: 10px 0;
    }

    .section-title {
        font-size: 1rem;
    }

    .content-grid {
        gap: 10px;
        width: 100%;
    }

    .content-card-body {
        padding: 12px;
    }

    .content-card-title {
        font-size: 0.95rem;
    }

    .sidebar-widget {
        min-width: 180px;
    }

    .widget-item-title {
        font-size: 0.65rem;
    }

    .test-card {
        padding: 12px;
    }

    .test-card-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .test-card-title {
        font-size: 0.95rem;
    }

    /* 탭 메뉴 모바일 최적화 */
    .tab-menu {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tab-menu::-webkit-scrollbar {
        display: none;
    }

    .tab-menu-item {
        padding: 10px 14px;
        font-size: 0.85rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* 아이템 리스트 모바일 */
    .item-list-item {
        padding: 10px 12px;
    }

    .item-list-icon {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .item-list-title {
        font-size: 0.9rem;
    }
}

/* 가로 모드(Landscape) 최적화 */
@media (max-height: 500px) and (orientation: landscape) {
    .page-layout {
        padding: 4px 8px;
    }

    .sidebar-nav-list {
        padding: 6px;
    }

    .sidebar-nav-link {
        padding: 8px 12px;
        min-height: 36px;
        font-size: 0.8rem;
    }

    .content-card-body {
        padding: 10px;
    }
}
