/* =========================================
   HARA — 메가메뉴 통합 스타일시트
   최종 업데이트: 2025-12-05 (미사용 스타일 제거)
========================================= */

/* =========================================
   CSS 변수 정의
========================================= */
:root {
    /* 카드 스타일 */
    --card-bg: #ffffff;
    --card-border-color: #e2e8f0;
    --card-border-radius: 18px;
    --card-text-color: #1e3a8a;
    --card-hover-bg: linear-gradient(135deg, #f0f4ff 0%, #fce7f3 100%);
    --card-hover-border-color: #c7d2fe;

    /* 아이콘 & 그라디언트 */
    --icon-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

    /* 전환 효과 */
    --transition-speed: 0.25s ease;

    /* 브랜드 컬러 */
    --primary-color: #667eea;
    --primary-dark: #243aa5;
    --text-dark: #1a202c;
    --text-medium: #2d3748;
    --text-light: #718096;
    --border-color: #e2e8f0;
}

/* =========================================
   메가메뉴 기본 구조
========================================= */
.mega-menu {
    background: #faf9f9;
    border-bottom: 1px solid #d6dfea;
    position: relative;
    z-index: 998;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* 학생 인사말 - 좌측 고정 */
.mega-menu-greeting {
    position: absolute;
    left: 35px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 17px;
    font-weight: 600;
    color: #202241;
    white-space: nowrap;
}

/* 메뉴 리스트 - 화면 전체 기준 정중앙 */
.mega-menu-list {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.mega-menu-item {
    position: relative;
}

.mega-menu-item>a {
    display: block;
    padding: 12px 22px;
    color: #0a0a0a;
    text-decoration: none;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.6;
    transition: all 0.2s ease;
    position: relative;
}

.mega-menu-item>a:hover {
    color: #3d2900;
    background: transparent;
}

/* 메뉴 호버 밑줄 효과 */
.mega-menu-item>a::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 22px;
    right: 22px;
    height: 1px;
    background: #333;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.mega-menu-item>a:hover::after {
    opacity: 1;
}

/* =========================================
   포인트 표시 스타일
========================================= */
.mega-menu-points {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
}

.mega-menu-points .points-link {
    display: flex;
    align-items: center;
    padding: 0;
    color: #2a1515;
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    background: transparent;
    border: none;
    transition: color 0.2s ease;
}

.mega-menu-points .points-link:hover {
    color: #e65100;
    background: transparent;
}

.mega-menu-points .points-link::after {
    display: none !important;
}

.mega-menu-points .points-icon {
    display: none !important;
}

.mega-menu-points .points-text {
    color: inherit;
    line-height: 1;
}

/* =========================================
   간단한 텍스트 드롭다운
========================================= */
.mega-menu-simple-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 0;
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 1000;
    margin-top: 0;
}

.mega-menu-item:hover .mega-menu-simple-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.simple-dropdown-item {
    display: block;
    padding: 2px 20px;
    color: #1a202c;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.simple-dropdown-item:hover {
    background: transparent;
    color: #1a202c;
}

/* 드롭다운 설명 텍스트 */
.simple-dropdown-item .dropdown-desc {
    display: block;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 2px;
    font-weight: 400;
}

/* 섹션 타이틀 */
.dropdown-section-title {
    padding: 8px 16px 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 구분선 */
.dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 8px 16px;
}

/* 개수 표시 */
.dropdown-count {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.simple-dropdown-item:hover .dropdown-count {
    background: #e2e8f0;
    color: #475569;
}

/* 준비중 표시 */
.dropdown-coming-soon {
    color: #94a3b8 !important;
    font-style: italic;
    cursor: not-allowed;
}

.dropdown-coming-soon:hover {
    background: transparent !important;
    color: #94a3b8 !important;
}

/* NEW 배지 */
.dropdown-badge-new {
    display: inline-block;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.7; }
}

/* =========================================
   풀와이드 메가 드롭다운 (진로수업용)
========================================= */
.mega-dropdown-fullwidth {
    position: fixed;
    top: 107px;
    right: 0;
    width: 100vw;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 999;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}

.mega-menu-item.has-mega-dropdown:hover .mega-dropdown-fullwidth {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.mega-dropdown-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 30px 40px;
}

/* 9칼럼 그리드 */
.mega-dropdown-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 20px;
}

.mega-dropdown-column {
    min-width: 0;
}

.mega-column-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
}

.mega-column-title a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.2s ease;
}

.mega-column-title a:hover {
    color: var(--text-medium);
}

.mega-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 18px;
    padding: 0 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}

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

.mega-column-list li {
    margin: 0;
    padding: 0;
}

.mega-column-list li a {
    display: block;
    padding: 6px 0;
    color: var(--text-medium);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.mega-column-list li a:hover {
    color: var(--text-medium);
    padding-left: 0;
    background: transparent;
}

/* =========================================
   메가메뉴 내 사이드바 토글 버튼
========================================= */
.mega-menu-sidebar-toggle {
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    padding: 0;
}

.mega-menu-sidebar-toggle .sidebar-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.mega-menu-sidebar-toggle .sidebar-toggle:hover {
    background: transparent;
}

.mega-menu-sidebar-toggle .hamburger-icon {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 16px;
}

.mega-menu-sidebar-toggle .hamburger-icon span {
    display: block;
    height: 2px;
    width: 100%;
    background: #5a3d00;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mega-menu-sidebar-toggle .sidebar-toggle:hover .hamburger-icon span {
    background: #3d2900;
}

/* =========================================
   리스트 마커 제거
========================================= */
.mega-menu ul,
.mega-menu ol,
.mega-menu li {
    list-style: none !important;
    list-style-type: none !important;
}

.mega-menu-simple-dropdown ul,
.mega-menu-simple-dropdown li {
    list-style: none !important;
    list-style-type: none !important;
}

.mega-menu li::before,
.mega-menu li::after,
.mega-menu li::marker {
    display: none !important;
    content: none !important;
}

.mega-menu-simple-dropdown li::before,
.mega-menu-simple-dropdown li::after,
.mega-menu-simple-dropdown li::marker {
    display: none !important;
    content: none !important;
}

.mega-column-list li::before,
.mega-column-list li::after,
.mega-column-list li::marker {
    display: none !important;
    content: none !important;
}

.mega-menu input[type="radio"],
.mega-menu input[type="checkbox"] {
    display: none !important;
}

/* =========================================
   접근성 (Accessibility)
========================================= */
.mega-menu-item>a:focus,
.simple-dropdown-item:focus,
.main-card:focus {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

.mega-menu-item>a:focus:not(:focus-visible),
.simple-dropdown-item:focus:not(:focus-visible),
.main-card:focus:not(:focus-visible) {
    outline: none;
}

/* =========================================
   유틸리티 클래스 (global.css에서 공통 정의)
========================================= */
.gradient-text {
    background: var(--icon-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* =========================================
   포인트 (네비 우측)
========================================= */
.mega-menu-point {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
}

.mega-point-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    color: #333 !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    text-decoration: none;
    transition: color 0.2s ease;
}

.mega-point-btn:hover {
    color: #FF6B35 !important;
    background: transparent !important;
}

.mega-point-btn::after {
    display: none !important;
}

.mega-point-btn i {
    font-size: 14px;
    color: #FF6B35;
}

/* =========================================
   반응형 디자인
========================================= */

/* 태블릿 (1200px 이하) */
@media (max-width: 1200px) {
    .mega-dropdown-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 15px;
    }

    .mega-dropdown-inner {
        padding: 25px 30px;
    }

    .mega-column-title {
        font-size: 12px;
    }

    .mega-column-list li a {
        font-size: 11px;
        padding: 5px 0;
    }
}

/* 태블릿 세로 (992px 이하) */
@media (max-width: 992px) {
    .mega-dropdown-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    .mega-dropdown-inner {
        padding: 20px;
    }
}

/* 태블릿/모바일 (768px 이하) */
@media (max-width: 768px) {
    .mega-menu {
        padding: 0;
        position: relative;
        display: flex;
        align-items: center;
    }

    .mega-dropdown-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .mega-dropdown-inner {
        padding: 15px;
    }

    .mega-column-title {
        font-size: 11px;
        padding-bottom: 8px;
        margin-bottom: 10px;
    }

    .mega-column-list li a {
        font-size: 11px;
        padding: 6px 0;
        min-height: 36px;
        display: flex;
        align-items: center;
    }

    .mega-menu-points .points-text {
        display: none;
    }

    .mega-menu-points .points-link {
        padding: 8px 12px;
        min-height: 44px;
    }

    /* 포인트: 우측 고정, 스크롤 영역 밖 */
    .mega-menu-points,
    .mega-menu-point {
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        flex-shrink: 0;
        z-index: 10;
        background: #faf9f9;
    }

    .mega-menu-greeting {
        display: none;
    }

    /* 메뉴 리스트: 스크롤 가능 영역 */
    .mega-menu-list {
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding: 0 8px;
        padding-right: 80px; /* 포인트 영역 확보 */
        gap: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex: 1;
    }

    .mega-menu-list::-webkit-scrollbar {
        display: none;
    }

    .mega-menu-item {
        flex-shrink: 0;
    }

    .mega-menu-item>a {
        padding: 12px 14px;
        font-size: 13px;
        white-space: nowrap;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .mega-menu-item>a::after {
        left: 14px;
        right: 14px;
    }

    /* 교사 사이드바 토글: 좌측 고정, 스크롤 영역 밖 */
    .mega-menu-sidebar-toggle,
    .mega-menu-teacher-btn {
        position: absolute;
        left: 8px;
        top: 50%;
        transform: translateY(-50%);
        padding: 0;
        flex-shrink: 0;
        z-index: 10;
        background: #faf9f9;
    }

    .mega-menu-sidebar-toggle .hamburger-icon {
        width: 20px;
        gap: 4px;
    }

    .mega-menu-sidebar-toggle .hamburger-icon span {
        height: 2.5px;
    }

    /* 교사 버튼 있을 때 메뉴 리스트 왼쪽 패딩 */
    .mega-menu.has-teacher-btn .mega-menu-list {
        padding-left: 50px;
    }

    /* 풀와이드 드롭다운 모바일 조정 */
    .mega-dropdown-fullwidth {
        top: auto;
        position: fixed;
        left: 0;
        right: 0;
        max-height: 60vh;
    }

    /* 간단한 드롭다운 모바일 조정 */
    .mega-menu-simple-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        border-radius: 16px 16px 0 0;
        max-height: 60vh;
        overflow-y: auto;
        padding: 20px 0;
    }

    .mega-menu-item:hover .mega-menu-simple-dropdown {
        transform: none;
    }

    .simple-dropdown-item {
        padding: 12px 20px;
        font-size: 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* 작은 모바일 (480px 이하) */
@media (max-width: 480px) {
    .mega-dropdown-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .mega-dropdown-column {
        border-bottom: 1px solid #e2e8f0;
        padding-bottom: 12px;
    }

    .mega-dropdown-column:last-child {
        border-bottom: none;
    }

    .mega-menu-points,
    .mega-menu-point {
        right: 4px;
    }

    .mega-menu-list {
        padding: 0 4px;
        padding-right: 70px;
    }

    .mega-menu.has-teacher-btn .mega-menu-list {
        padding-left: 44px;
    }

    .mega-menu-sidebar-toggle,
    .mega-menu-teacher-btn {
        left: 4px;
    }

    .mega-menu-item>a {
        padding: 10px;
        font-size: 12px;
    }

    .mega-menu-item>a::after {
        left: 10px;
        right: 10px;
    }
}

/* 가로 모드(Landscape) 모바일 */
@media (max-height: 500px) and (orientation: landscape) {
    .mega-menu-simple-dropdown {
        max-height: 80vh;
    }

    .mega-dropdown-fullwidth {
        max-height: 80vh;
    }
}

/* =========================================
   교사 사이드바 토글 버튼 (좌측 고정)
========================================= */
.mega-menu-teacher-btn {
    position: absolute;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
}

.sidebar-toggle-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sidebar-toggle-btn .toggle-bar {
    display: block;
    height: 2px;
    background: #4361ee;
    border-radius: 1px;
    transition: all 0.3s ease;
}

.sidebar-toggle-btn .toggle-bar:nth-child(1) {
    width: 20px;
}

.sidebar-toggle-btn .toggle-bar:nth-child(2) {
    width: 15px;
}

.sidebar-toggle-btn .toggle-bar:nth-child(3) {
    width: 10px;
}

/* 호버 효과 */
.sidebar-toggle-btn:hover .toggle-bar {
    background: #3a0ca3;
}

.sidebar-toggle-btn:hover .toggle-bar:nth-child(1) {
    width: 20px;
}

.sidebar-toggle-btn:hover .toggle-bar:nth-child(2) {
    width: 20px;
}

.sidebar-toggle-btn:hover .toggle-bar:nth-child(3) {
    width: 20px;
}

/* 사이드바 열렸을 때 - 화살표 왼쪽 방향 */
.sidebar-toggle-btn.active .toggle-bar:nth-child(1) {
    width: 10px;
}

.sidebar-toggle-btn.active .toggle-bar:nth-child(2) {
    width: 15px;
}

.sidebar-toggle-btn.active .toggle-bar:nth-child(3) {
    width: 20px;
}
