/* 메인 스타일 */
:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --sidebar-width: 260px;
    --header-height: 70px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    display: flex;
    min-height: 100vh;
}

/* 사이드바 */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: all 0.3s ease;
}

/* 사이드바 축소 상태 */
.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-header h1,
.sidebar.collapsed .sidebar-header .version,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .user-name,
.sidebar.collapsed .user-role,
.sidebar.collapsed .btn-change-password span,
.sidebar.collapsed .btn-logout span {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

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

.sidebar.collapsed .nav-item i {
    margin-right: 0;
}

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

.sidebar.collapsed .sidebar-footer .user-info {
    justify-content: center;
}

.sidebar.collapsed .btn-change-password,
.sidebar.collapsed .btn-logout {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .btn-change-password i,
.sidebar.collapsed .btn-logout i {
    margin-right: 0;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.sidebar-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.sidebar-header .version {
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--gray-700);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.nav-item i {
    width: 20px;
    margin-right: 12px;
    font-size: 16px;
}

.nav-item:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--gray-200);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.btn-change-password {
    width: 100%;
    padding: 10px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    margin-bottom: 8px;
}

.btn-change-password:hover {
    background: var(--gray-100);
    border-color: var(--primary);
}

.btn-logout {
    width: 100%;
    padding: 10px;
    background: var(--gray-100);
    border: none;
    border-radius: 6px;
    color: var(--gray-700);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-logout:hover {
    background: var(--gray-200);
}

/* 메인 컨텐츠 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* 사이드바 축소 시 메인 컨텐츠 */
body:has(.sidebar.collapsed) .main-content {
    margin-left: 70px;
}

/* 헤더 */
.header {
    height: var(--header-height);
    background: white;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* 모바일 네비게이션 버튼 */
.mobile-nav-btn {
    display: none;
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 12px;
    transition: all 0.2s;
}

.mobile-nav-btn:active {
    transform: scale(0.95);
    background: var(--gray-50);
}

.mobile-nav-btn i {
    font-size: 18px;
    color: var(--gray-700);
}

.header-title {
    flex: 1;
}

.header-title h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 2px;
}

.header-subtitle {
    font-size: 13px;
    color: var(--gray-500);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.notification-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    color: white;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
}

.notification-btn i {
    color: white;
    font-size: 18px;
}

.notification-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.notification-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    width: 360px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    max-height: 500px;
    display: flex;
    flex-direction: column;
}

.notification-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header span {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.notification-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.btn-mark-read,
.btn-mark-all-read {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-mark-read:hover,
.btn-mark-all-read:hover {
    background: var(--gray-100);
}

.notification-list {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

.notification-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.2s;
}

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

.notification-item.unread {
    background: #f0f4ff;
}

.notification-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.notification-item-message {
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.notification-item-time {
    font-size: 12px;
    color: var(--gray-400);
}

.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--gray-400);
    font-size: 14px;
}

.notification-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--gray-200);
    text-align: center;
    color: var(--primary);
    text-decoration: none;
    display: block;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.notification-footer:hover {
    background: var(--gray-50);
}

/* 컨텐츠 */
.content {
    flex: 1;
    padding: 32px;
}

/* 대시보드 */
.dashboard {
    max-width: 1400px;
    margin: 0 auto;
}

.welcome-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 16px;
    padding: 32px;
    color: white;
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
}

.welcome-content h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.welcome-content p {
    font-size: 16px;
    opacity: 0.9;
}

.welcome-date {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 500;
}

/* 통계 카드 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-icon.blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.stat-icon.green {
    background: linear-gradient(135deg, #10b981, #059669);
}

.stat-icon.purple {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.stat-icon.orange {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-label {
    font-size: 14px;
    color: var(--gray-500);
    margin-top: 4px;
}

/* 섹션 */
.section {
    margin-bottom: 32px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 20px;
    margin-top: 32px;
}

/* 빠른 접근 */
.quick-access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.quick-access-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    text-decoration: none;
    color: var(--gray-700);
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.quick-access-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    color: var(--primary);
}

.quick-access-card i {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

.quick-access-card span {
    font-size: 14px;
    font-weight: 500;
}

/* 정보 카드 */
.info-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 14px;
    color: var(--gray-600);
    font-weight: 500;
}

.info-value {
    font-size: 14px;
    color: var(--gray-900);
    font-weight: 600;
}

/* 공지사항 리스트 */
.announcement-list {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.announcement-item {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.2s;
}

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

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

.announcement-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.announcement-important {
    color: var(--warning);
}

.announcement-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900);
    flex: 1;
}

.announcement-date {
    font-size: 13px;
    color: var(--gray-500);
}

/* 최근 알림 목록 */
.notification-list-box {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.notification-list-box .notification-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.2s;
}

.notification-list-box .notification-item:hover {
    background: var(--gray-50);
}

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

.notification-list-box .notification-item.unread {
    background: #f0f4ff;
}

.notification-list-box .notification-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.notification-list-box .notification-item-message {
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.notification-list-box .notification-item-time {
    font-size: 12px;
    color: var(--gray-400);
}

.announcement-author {
    font-size: 13px;
    color: var(--gray-600);
}

.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--gray-400);
    font-size: 14px;
}

/* 토스트 알림 */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--success);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.error {
    background: var(--danger);
}

.toast.warning {
    background: var(--warning);
}

.toast.info {
    background: var(--info);
}

/* 관리자 전용 요소 숨김 */
body:not(.admin) .admin-only {
    display: none !important;
}

/* 일반 직원 전용 요소 숨김 (관리자일 때) */
body.admin .user-only {
    display: none !important;
}

/* 반응형 디자인 */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    /* 모바일 네비게이션 버튼 표시 */
    .mobile-nav-btn {
        display: flex;
    }
    
    .header {
        padding: 0 16px;
    }
    
    .header-title h2 {
        font-size: 18px;
    }
    
    .header-subtitle {
        font-size: 12px;
    }
    
    .content {
        padding: 16px;
    }
    
    .welcome-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-access-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .notification-dropdown {
        width: calc(100vw - 32px);
        right: -16px;
    }
    
    /* 모바일에서 테이블 가로 스크롤 활성화 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
    
    .employees-table {
        min-width: 800px;
    }
    
    /* 모바일에서도 PC 레이아웃 유지 */
    body {
        touch-action: manipulation;
        -webkit-text-size-adjust: 100%;
    }
}

@media (max-width: 480px) {
    .quick-access-grid {
        grid-template-columns: 1fr;
    }
}
