/* CSS 변수 정의 */
:root {
    --primaryBlue: #3182F6;
    --contentMain: #333D4B;
    --borderOutline: #E6E8EA;
    --bgTertiary: #F9FAFB;
    --grey200: #E6E8EA;
    --grey500: #8B95A1;
    --grey700: #333D4B;
    --grey800: #1F2937;
    --blue500: #3182F6;
    --blue600: #2563EB;
    --red500: #EF4444;
    --yellow500: #F59E0B;
    --yellow600: #D97706;
    --green500: #10B981;
    --green600: #059669;
}

@font-face {
    font-family: 'Pretendard Variable';
    font-weight: 45 920;
    font-style: normal;
    font-display: swap;
    src: url('./font/pretendardvariable/pretendardvariable.css') format('woff2-variations');
}

body {
    font-family: 'Pretendard Variable', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
}

/* 모바일 햄버거 메뉴 버튼 */
.mobile-menu-btn {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 50;
    padding: 0.5rem;
    border-radius: 0.5rem;
    background-color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    display: none;
}

.mobile-menu-btn:hover {
    background-color: #f9fafb;
}

.mobile-menu-btn .material-icons {
    font-size: 24px;
    color: var(--contentMain);
}

/* 모바일 햄버거 메뉴 버튼 아이콘 */
.mobile-menu-btn i {
    font-size: 24px;
    color: var(--contentMain);
}

/* 사이드바 */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    background-color: white;
    border-right: 1px solid var(--borderOutline);
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    width: 256px;
}

.sidebar.collapsed {
    width: 80px;
}

/* 사이드바 헤더 */
.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--borderOutline);
    background-color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primaryBlue);
    letter-spacing: -0.025em;
}

.sidebar.collapsed .logo-text {
    display: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-close-btn {
    padding: 0.5rem;
    border-radius: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    display: none;
}

.mobile-close-btn:hover {
    background-color: var(--bgTertiary);
}

.mobile-close-btn .material-icons {
    font-size: 20px;
    color: var(--contentMain);
}

/* 모바일 닫기 버튼 아이콘 */
.mobile-close-btn i {
    font-size: 20px;
    color: var(--contentMain);
}

.toggle-btn {
    padding: 0.5rem;
    border-radius: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.toggle-btn:hover {
    background-color: var(--bgTertiary);
}

.toggle-btn .material-icons {
    font-size: 20px;
    color: var(--contentMain);
}

/* 토글 버튼 아이콘 */
.toggle-btn i {
    font-size: 20px;
    color: var(--contentMain);
}

.sidebar.collapsed .toggle-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

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

.nav-menu {
    list-style: none;
    padding: 0 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    width: 100%;
}

.nav-button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px;
    color: var(--contentMain);
}

.nav-button:hover {
    background-color: #eff6ff;
    color: var(--primaryBlue);
}

.nav-button.active {
    background-color: #dbeafe;
    color: var(--primaryBlue);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.sidebar.collapsed .nav-button {
    justify-content: center;
}

.nav-icon {
    font-size: 20px;
    color: #6b7280;
    transition: color 0.2s;
}

.nav-button:hover .nav-icon,
.nav-button.active .nav-icon {
    color: var(--primaryBlue);
}

.nav-label {
    font-size: 1rem;
    font-weight: 500;
    white-space: nowrap;
}

.sidebar.collapsed .nav-label {
    display: none;
}

/* 사이드바 푸터 */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--borderOutline);
    background-color: white;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    background-color: var(--bgTertiary);
    margin-bottom: 0.5rem;
}

.sidebar.collapsed .user-info {
    display: none;
}

.user-icon {
    font-size: 20px;
    color: var(--contentMain);
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--contentMain);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--borderOutline);
    background: none;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
}

.logout-btn:hover {
    background-color: #eff6ff;
}

.sidebar.collapsed .logout-btn {
    display: none;
}

.logout-icon {
    font-size: 20px;
    color: var(--primaryBlue);
}

.logout-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primaryBlue);
}

/* 메인 콘텐츠 */
.main-content {
    margin-left: 256px;
    padding: 1.5rem;
    min-height: 100vh;
    background-color: #f9fafb;
}

.sidebar.collapsed + .main-content {
    margin-left: 80px;
}

/* 사이드바가 있을 때 메인 콘텐츠 조정 */
body.has-sidebar {
    padding-left: 0;
}

body.has-sidebar.sidebar-collapsed {
    padding-left: 0;
}

/* 페이지 콘텐츠가 직접 렌더링될 때의 스타일 - 사이드바 상태에 따라 유동적 조정 */
body.has-sidebar > div:not(.sidebar) {
    padding-left: 256px;
    padding-top: 1rem;
    padding-right: 1rem;
    padding-bottom: 1rem;
}

body.has-sidebar.sidebar-collapsed > div:not(.sidebar) {
    padding-left: 80px;
    padding-top: 1rem;
    padding-right: 1rem;
    padding-bottom: 1rem;
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

.content-wrapper h1 {
    color: var(--contentMain);
    margin-bottom: 1rem;
}

.content-wrapper p {
    color: #6b7280;
    line-height: 1.6;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }

    .mobile-close-btn {
        display: block;
    }

    .toggle-btn {
        display: none;
    }

    .sidebar {
        /* transform: translateX(-100%); 애니메이션 제거 */
        width: 256px;
    }

    .sidebar.mobile-open {
        /* transform: translateX(0); 애니메이션 제거 */
    }

    .sidebar.collapsed {
        width: 256px;
    }

    .sidebar.collapsed .logo-text,
    .sidebar.collapsed .nav-label,
    .sidebar.collapsed .user-info,
    .sidebar.collapsed .logout-btn {
        display: block;
    }

    .sidebar.collapsed .nav-button {
        justify-content: flex-start;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    .sidebar.collapsed + .main-content {
        margin-left: 0;
    }

    /* 모바일에서 body 패딩 제거 */
    body.has-sidebar {
        padding-left: 0;
    }

    body.has-sidebar.sidebar-collapsed {
        padding-left: 0;
    }

    /* 모바일에서 페이지 콘텐츠 마진 제거 */
    body.has-sidebar > div:not(.sidebar) {
        margin-left: 0;
    }

    body.has-sidebar.sidebar-collapsed > div:not(.sidebar) {
        margin-left: 0;
    }
}

/* 스크롤바 스타일링 */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 2px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background-color: #9ca3af;
}

/* 로딩 애니메이션 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* 스피너 로딩 애니메이션 */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primaryBlue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 도트 로딩 애니메이션 */
.loading-dots {
    display: flex;
    gap: 8px;
}

.loading-dots .dot {
    width: 12px;
    height: 12px;
    background-color: var(--primaryBlue);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
}

.loading-dots .dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dots .dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dots .dot:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* 펄스 로딩 애니메이션 */
.loading-pulse {
    width: 50px;
    height: 50px;
    background-color: var(--primaryBlue);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.5;
    }
    100% {
        transform: scale(0.8);
        opacity: 1;
    }
}

/* 바 로딩 애니메이션 */
.loading-bars {
    display: flex;
    gap: 4px;
    align-items: end;
}

.loading-bars .bar {
    width: 6px;
    background-color: var(--primaryBlue);
    animation: bar-loading 1.2s ease-in-out infinite;
}

.loading-bars .bar:nth-child(1) { height: 20px; animation-delay: 0s; }
.loading-bars .bar:nth-child(2) { height: 30px; animation-delay: 0.1s; }
.loading-bars .bar:nth-child(3) { height: 40px; animation-delay: 0.2s; }
.loading-bars .bar:nth-child(4) { height: 30px; animation-delay: 0.3s; }
.loading-bars .bar:nth-child(5) { height: 20px; animation-delay: 0.4s; }

@keyframes bar-loading {
    0%, 40%, 100% {
        transform: scaleY(0.4);
    }
    20% {
        transform: scaleY(1);
    }
}

/* 로딩 텍스트 */
.loading-text {
    margin-top: 20px;
    font-size: 16px;
    color: #666;
    text-align: center;
}

/* 로딩 애니메이션 컨테이너 */
.loading-container {
    text-align: center;
}

/* 버튼 로딩 상태 */
.btn.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 페이지 로딩 */
.page-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.page-loading.hide {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
} 