/* ==================== CSS 변수 ==================== */
:root {
    /* Jira 스타일 색상 */
    --primary-color: #0052CC;
    --primary-hover: #0065FF;
    --primary-light: #DEEBFF;
    --danger-color: #DE350B;
    --success-color: #00875A;
    --warning-color: #FF991F;

    /* 네이비 계열 */
    --nav-bg: #0C2340;
    --nav-bg-hover: #13345B;
    --nav-bg-active: #1B4D89;
    --nav-text: #B8C7D9;
    --nav-text-active: #FFFFFF;

    /* 회색 음영 */
    --gray-50: #FAFBFC;
    --gray-100: #F4F5F7;
    --gray-200: #EBECF0;
    --gray-300: #DFE1E6;
    --gray-400: #B3BAC5;
    --gray-500: #6B778C;
    --gray-600: #505F79;
    --gray-700: #42526E;
    --gray-900: #172B4D;

    /* 레이아웃 */
    --header-height: 56px;
    --sidebar-width: 240px;

    /* 그림자 */
    --shadow-sm: 0 1px 2px rgba(9, 30, 66, 0.08);
    --shadow-md: 0 4px 8px -2px rgba(9, 30, 66, 0.13), 0 0 1px rgba(9, 30, 66, 0.2);
    --shadow-lg: 0 8px 16px -4px rgba(9, 30, 66, 0.13), 0 0 1px rgba(9, 30, 66, 0.2);
}

/* ==================== 전역 스타일 ==================== */
* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}

body {
    margin: 0;
    font-family: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    font-size: 14px;
}

/* ==================== 레이아웃 ==================== */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ==================== 사이드바 ==================== */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--nav-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    margin-left: calc(-1 * var(--sidebar-width));
    transition: margin-left 0.2s ease;
    z-index: 1000;
}

.app-sidebar.show {
    margin-left: 0;
}

/* 사이드바 헤더 (로고 영역) */
.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--nav-text-active);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.sidebar-logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: white;
}

/* 사이드바 네비게이션 */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

/* 네비게이션 섹션 라벨 */
.nav-section-label {
    padding: 16px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--nav-text);
    opacity: 0.5;
    letter-spacing: 0.5px;
}

/* 네비게이션 링크 */
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 16px;
    margin: 1px 8px;
    color: var(--nav-text);
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.1s, color 0.1s;
    font-size: 13.5px;
    font-weight: 400;
    position: relative;
}

.nav-link:hover {
    background: var(--nav-bg-hover);
    color: var(--nav-text-active);
}

.nav-link.active {
    background: var(--nav-bg-active);
    color: var(--nav-text-active);
    font-weight: 500;
}

.nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    opacity: 0.8;
}

.nav-link.active i {
    opacity: 1;
}

.nav-label {
    font-size: 13.5px;
}

/* 아코디언 */
.accordion-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 16px;
    margin: 1px 8px;
    color: var(--nav-text);
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.1s, color 0.1s;
    font-size: 13.5px;
    font-weight: 500;
}

.accordion-header:hover {
    background: var(--nav-bg-hover);
    color: var(--nav-text-active);
}

.accordion-header.active {
    color: var(--nav-text-active);
}

.accordion-header .icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    opacity: 0.8;
}

.accordion-header.active .icon {
    opacity: 1;
}

.accordion-header .chevron {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.2s;
    opacity: 0.5;
}

.accordion-header.active .chevron {
    transform: rotate(-180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.accordion-content.open {
    max-height: 500px;
}

.accordion-content .nav-link {
    padding: 6px 16px 6px 48px;
    font-size: 13px;
    margin: 0 8px;
}

/* 사이드바 푸터 */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ==================== 오른쪽 영역 (헤더 + 메인) ==================== */
.app-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* ==================== 헤더 ==================== */
.app-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 100;
    flex-shrink: 0;
}

.header-side {
    flex: 1 1 0;
    min-width: 0;
}

.header-hamburger {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--gray-600);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    transition: background-color 0.1s;
}

.header-hamburger:hover {
    background: var(--gray-100);
}

/* 헤더 액션 버튼 */
.header-action {
    position: relative;
    background: none;
    border: none;
    font-size: 1.15rem;
    color: var(--gray-600);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    transition: background-color 0.1s;
}

.header-action:hover {
    background: var(--gray-100);
}

.header-action .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger-color);
    color: white;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    line-height: 1.4;
}

/* ==================== 사용자 메뉴 ==================== */
.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.1s;
}

.user-menu:hover {
    background: var(--gray-100);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-900);
}

.user-role {
    font-size: 11px;
    color: var(--gray-500);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: white;
    border-radius: 4px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1001;
    border: 1px solid var(--gray-200);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: var(--gray-700);
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.1s;
}

.user-dropdown-item:hover {
    background: var(--gray-50);
}

.user-dropdown-item i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
}

/* ==================== Body ==================== */
.app-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* 사이드바 오버레이 (모바일) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(9, 30, 66, 0.54);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.2s;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* 메인 콘텐츠 */
.app-main {
    flex: 1;
    overflow-y: auto;
    background: var(--gray-100);
    height: 100%;
}

/* ==================== 유틸리티 ==================== */
.cursor-pointer {
    cursor: pointer;
}

/* ==================== 캘린더 ==================== */
.cal-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: white;
}

/* 필터 바 (구분 체크박스) */
.cal-filter-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.cal-filter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    padding: 4px 12px;
    background: var(--gray-100);
    border-radius: 4px;
}

.cal-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--gray-700);
    cursor: pointer;
    user-select: none;
}

.cal-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 네비게이션 바 */
.cal-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
    gap: 16px;
    flex-wrap: wrap;
}

.cal-nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cal-today-label {
    font-size: 13px;
    color: var(--gray-600);
    white-space: nowrap;
}

.cal-nav-arrow {
    background: none;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--gray-600);
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
}

.cal-nav-arrow:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.cal-month-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
    margin-left: 4px;
}

.cal-nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* 등록 버튼들 */
.cal-reg-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    border: none;
    border-radius: 4px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: filter 0.15s;
    white-space: nowrap;
}

.cal-reg-btn:hover {
    filter: brightness(0.9);
}

.cal-reg-btn i {
    font-size: 10px;
}

.cal-reg-schedule { background: #2962FF; }
.cal-reg-education { background: #FF6D00; }
.cal-reg-vacation { background: #00C853; }
.cal-reg-holiday { background: #9C27B0; }

/* 바디 */
.cal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.cal-grid-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

/* 컬럼 헤더 (주 + 요일) */
.cal-col-header {
    display: grid;
    grid-template-columns: 40px repeat(7, minmax(0, 1fr));
    border-bottom: 2px solid var(--gray-200);
    flex-shrink: 0;
}

.cal-wk-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-400);
    background: var(--gray-50);
    border-right: 1px solid var(--gray-200);
}

.cal-weekday {
    padding: 10px 0;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    background: var(--gray-50);
}

.cal-weekday-sun { color: #DE350B; }
.cal-weekday-sat { color: var(--primary-color); }

/* 주별 행 */
.cal-row {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
}

/* 주차 번호 */
.cal-wk-num {
    width: 40px;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-400);
    background: var(--gray-50);
    border-right: 1px solid var(--gray-200);
}

/* 7일 그리드 컨테이너 (플랫 그리드 - dense 패킹) */
.cal-row-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-auto-rows: min-content;
    grid-auto-flow: row dense;
    min-width: 0;
}

.cal-day-hdr {
    padding: 4px 8px 2px;
    border-right: 1px solid var(--gray-100);
}

.cal-day-other .cal-day-n { color: var(--gray-300); }
.cal-day-today-cell { background: #F0F4FF; }

.cal-day-n {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    line-height: 1;
}

.cal-today-n {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: var(--primary-color);
    color: white !important;
    border-radius: 50%;
    font-weight: 600;
}

.cal-sun { color: #DE350B; }
.cal-sat { color: var(--primary-color); }

/* 여러 날 스팬 바 */
.cal-span-bar {
    padding: 0 4px 0 12px;
    border-radius: 0;
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    height: 20px;
    line-height: 20px;
    margin: 1px 0;
    transition: filter 0.1s;
}

.cal-span-bar:hover {
    filter: brightness(0.92);
}

.cal-span-holiday {
    background: #FFEBE6;
    color: #BF2600;
    font-weight: 700;
}

.cal-span-vacation {
    background: #E3FCEF;
    color: #006644;
}

.cal-span-military {
    background: #E3FCEF;
    color: #006644;
}

.cal-span-highlight {
    background: #DEEBFF;
    color: #0747A6;
}

/* 단일 이벤트 아이템 */
.cal-ev {
    display: flex;
    align-items: center;
    padding: 0 4px 0 4px;
    border-radius: 0;
    font-size: 12px;
    height: 20px;
    line-height: 20px;
    margin: 1px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: background 0.1s;
}

.cal-ev:hover {
    background: var(--gray-100);
}

/* 이벤트 세로 바 */
.cal-ev-dot {
    width: 3px;
    min-height: 12px;
    border-radius: 1px;
    flex-shrink: 0;
    margin-right: 5px;
}

.cal-ev-dot-schedule { background: #2962FF; }
.cal-ev-dot-education { background: #FF6D00; }
.cal-ev-dot-vacation { background: #00C853; }

.cal-ev-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--gray-700);
    font-size: 12px;
}

.cal-ev-vacation {
    background: #E3FCEF;
}

.cal-ev-vacation .cal-ev-dot { background: transparent; }
.cal-ev-vacation .cal-ev-label { color: #006644; }
.cal-ev-education .cal-ev-label { color: #E65100; }
.cal-ev-schedule .cal-ev-label { color: var(--gray-700); }

/* 더보기 */
.cal-ev-more {
    font-size: 10px;
    color: var(--primary-color);
    cursor: pointer;
    padding: 1px 4px;
    font-weight: 500;
}

.cal-ev-more:hover { text-decoration: underline; }

/* 우측 사이드바 */
.cal-sidebar {
    width: 240px;
    min-width: 240px;
    border-left: 1px solid var(--gray-200);
    background: var(--gray-50);
    flex-direction: column;
    overflow-y: auto;
}

.cal-sidebar-title {
    padding: 16px 20px;
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-900);
    border-bottom: 1px solid var(--gray-200);
}

.cal-sidebar-card {
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    transition: background 0.1s;
}

.cal-sidebar-card:hover { background: white; }

.cal-sidebar-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.cal-sidebar-card-date {
    font-size: 11px;
    color: var(--gray-500);
    line-height: 1.4;
}

/* ==================== 반응형 ==================== */
@media (max-width: 1024px) {
    .user-info {
        display: none;
    }

    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1000;
        margin-left: 0;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .app-sidebar.show {
        transform: translateX(0);
    }
}
