/* 
    Premium ERP Stylesheet for Jsystems HR
    Theme: Modern Clean SaaS — Warm Dark + Indigo
*/

:root {
    --erp-bg-color: #262423;
    --erp-sidebar-bg: #33302E;
    --erp-sidebar-text: #AFA8A3;
    --erp-sidebar-hover: #423E3C;
    --erp-sidebar-active: #818cf8;
    
    --erp-topbar-bg: rgba(51, 48, 46, 0.95);
    
    --erp-card-bg: #33302E;
    --erp-card-shadow: 0px 10px 30px rgba(0, 0, 0, 0.5); 
    --erp-border-radius: 16px;
    
    --erp-text-main: #F2EFE9;
    --erp-text-secondary: #AFA8A3;
    
    --erp-primary: #6366f1;
    --erp-primary-hover: #818cf8;
    --erp-success: #10b981;
    --erp-danger: #ef4444;
    --erp-warning: #f59e0b;
    
    --erp-border: #524C4A;
    
    --erp-glass-bg: rgba(51, 48, 46, 0.65);
    --erp-glass-border: rgba(255, 255, 255, 0.08);
    --erp-glass-blur: blur(16px);
    --font-erp: 'Outfit', 'Noto Sans KR', -apple-system, system-ui, sans-serif;
    --sidebar-width: 280px;
}

/* Global */
*, *::before, *::after { box-sizing: border-box; }

body.erp-body {
    background-color: var(--erp-bg-color);
    color: var(--erp-text-main);
    font-family: var(--font-erp);
    margin: 0;
    overflow-x: hidden;
}

/* Typography Overrides */
.erp-body h1, .erp-body h2, .erp-body h3,
.erp-body h4, .erp-body h5, .erp-body h6 {
    font-weight: 700;
    color: var(--erp-text-main);
    letter-spacing: -0.5px;
}

/* Layout Structure */
.erp-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================
   Sidebar
   ============================ */
.erp-sidebar {
    width: var(--sidebar-width);
    background-color: var(--erp-sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    border-right: 1px solid var(--erp-border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0px 24px rgba(112, 144, 176, 0.08);
    display: flex;
    flex-direction: column;
}

.erp-sidebar-logo {
    padding: 32px 24px;
    font-size: 24px;
    font-weight: 800;
    color: var(--erp-text-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    border-bottom: 1px solid transparent;
}

.erp-sidebar-logo span {
    color: var(--erp-primary);
}

.erp-sidebar-menu {
    padding: 24px 16px;
    flex-grow: 1;
    overflow-y: auto;
}

.erp-sidebar-menu::-webkit-scrollbar { width: 4px; }
.erp-sidebar-menu::-webkit-scrollbar-thumb { background: var(--erp-border); border-radius: 4px; }

.erp-nav-item {
    margin-bottom: 8px;
    list-style: none;
}

.erp-nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--erp-text-secondary);
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 15px;
}

.erp-nav-link i {
    width: 24px;
    margin-right: 12px;
    font-size: 18px;
    text-align: center;
}

.erp-nav-link:hover {
    background-color: var(--erp-sidebar-hover);
    color: var(--erp-sidebar-active);
}

.erp-nav-link.active {
    background-color: var(--erp-sidebar-hover);
    color: var(--erp-sidebar-active);
    font-weight: 700;
    position: relative;
}

.erp-nav-link.active::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 4px;
    background-color: var(--erp-sidebar-active);
    border-radius: 0 4px 4px 0;
}

.erp-sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--erp-border);
}

/* ============================
   Main Content Area
   ============================ */
.erp-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ============================
   Topbar
   ============================ */
.erp-topbar {
    height: 80px;
    background: var(--erp-topbar-bg);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.erp-page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--erp-text-main);
    margin: 0;
}

.erp-user-profile {
    display: flex;
    align-items: center;
    gap: 16px;
}

.erp-user-name {
    font-weight: 600;
    color: var(--erp-text-main);
    font-size: 14px;
}

/* ============================
   Content Container
   ============================ */
.erp-content {
    padding: 32px;
    flex-grow: 1;
}

/* ============================
   Cards & Widgets
   ============================ */
.glass-card {
    background: var(--erp-glass-bg) !important;
    backdrop-filter: var(--erp-glass-blur);
    -webkit-backdrop-filter: var(--erp-glass-blur);
    border: 1px solid var(--erp-glass-border) !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4) !important;
}

.erp-card {
    background: var(--erp-card-bg);
    border-radius: var(--erp-border-radius);
    padding: 24px;
    box-shadow: var(--erp-card-shadow);
    border: none;
    margin-bottom: 24px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.erp-card:hover {
    box-shadow: 0px 24px 50px rgba(112, 144, 176, 0.18);
}

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

.erp-card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--erp-text-main);
    margin: 0;
}

/* ============================
   Premium Tables
   ============================ */
.erp-table-wrapper {
    overflow-x: auto;
}

.erp-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.erp-table th {
    font-weight: 600;
    color: var(--erp-text-secondary);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    padding: 16px;
    border-bottom: 1px solid var(--erp-border);
    text-align: left;
}

.erp-table td {
    padding: 16px;
    border-bottom: 1px solid var(--erp-border);
    color: var(--erp-text-main);
    font-size: 14px;
    font-weight: 500;
    vertical-align: middle;
}

.erp-table tbody tr:hover td {
    background-color: rgba(67, 24, 255, 0.02);
}

/* ============================
   Badges / Status
   ============================ */
.erp-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    display: inline-block;
}

.erp-badge-success { background: rgba(5, 205, 153, 0.1); color: var(--erp-success); }
.erp-badge-warning { background: rgba(255, 206, 32, 0.1); color: #d4a700; }
.erp-badge-danger  { background: rgba(238, 93, 80, 0.1); color: var(--erp-danger); }
.erp-badge-primary { background: rgba(67, 24, 255, 0.1); color: var(--erp-primary); }

/* ============================
   Buttons
   ============================ */
.erp-btn {
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
}

.erp-btn-primary {
    background-color: var(--erp-primary);
    color: #fff;
    box-shadow: 0 10px 20px rgba(67, 24, 255, 0.2);
}

.erp-btn-primary:hover {
    background-color: var(--erp-primary-hover);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 14px 24px rgba(67, 24, 255, 0.3);
}

.erp-btn-outline {
    background-color: transparent;
    color: var(--erp-primary);
    border: 1px solid var(--erp-primary);
}

.erp-btn-outline:hover {
    background-color: var(--erp-primary);
    color: #fff;
}

/* ============================
   Forms
   ============================ */
.erp-form-control {
    background: #33302E;
    border: 1px solid var(--erp-border);
    border-radius: 12px;
    padding: 14px 20px;
    color: var(--erp-text-main);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
}

.erp-form-control:focus {
    outline: none;
    border-color: var(--erp-primary);
    box-shadow: 0 0 0 3px rgba(67, 24, 255, 0.1);
}

.erp-form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--erp-text-main);
    font-weight: 600;
    font-size: 14px;
}

/* ============================
   RESPONSIVE — Desktop (992px+)
   ============================ */
@media (min-width: 992px) {
    .erp-bottom-nav { display: none !important; }
}

/* ============================
   RESPONSIVE — Mobile / Tablet (max 991px)
   ============================ */
@media (max-width: 991px) {
    .erp-sidebar {
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }
    .erp-sidebar.show {
        transform: translateX(0);
    }
    .erp-main {
        margin-left: 0;
        padding-bottom: 70px;
    }
    .erp-topbar {
        padding: 0 10px;
        height: 56px;
        gap: 6px;
    }
    .erp-topbar > div:first-child {
        min-width: 0;
        flex: 1;
        overflow: hidden;
    }
    .erp-page-title {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
    }
    .erp-content {
        padding: 12px;
    }
    .erp-card {
        padding: 14px;
        margin-bottom: 12px;
        border-radius: 12px;
    }
    .erp-user-name { display: none; }

    /* 언어 버튼: 텍스트 숨기고 아이콘만 */
    .erp-lang-text { display: none !important; }
    #erpLangDropdown {
        padding: 5px 7px !important;
        font-size: 1rem !important;
        min-width: 34px;
        border-radius: 50% !important;
    }

    .erp-user-profile { gap: 6px; flex-shrink: 0; }
}

/* ============================
   모바일 하단 네비게이션 바 (앱 스타일)
   ============================ */
.erp-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--erp-sidebar-bg);
    border-top: 1px solid var(--erp-border);
    z-index: 1100;
    align-items: center;
    justify-content: space-around;
    padding: 0 4px;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.45);
}

@media (max-width: 991px) {
    .erp-bottom-nav { display: flex; }
}

.erp-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--erp-text-secondary);
    font-size: 10px;
    font-weight: 500;
    padding: 5px 8px;
    border-radius: 12px;
    transition: all 0.2s ease;
    min-width: 50px;
    gap: 2px;
    line-height: 1.2;
}

.erp-bottom-nav-item i {
    font-size: 21px;
    line-height: 1;
}

.erp-bottom-nav-item.active,
.erp-bottom-nav-item:hover {
    color: var(--erp-primary);
    background: rgba(99, 102, 241, 0.12);
}

/* 중앙 강조 버튼 (TimeClock) */
.erp-bottom-nav-center {
    background: var(--erp-primary) !important;
    color: #fff !important;
    border-radius: 50% !important;
    width: 52px;
    height: 52px;
    min-width: 52px;
    padding: 0 !important;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.5);
    margin-top: -10px;
    font-size: 9px;
}
.erp-bottom-nav-center i { font-size: 23px; }
.erp-bottom-nav-center:hover,
.erp-bottom-nav-center.active {
    background: var(--erp-primary-hover) !important;
    color: #fff !important;
}

/* ============================
   모바일 카드형 테이블 변환 (max 768px)
   ============================ */
@media (max-width: 768px) {

    .mobile-card-table thead { display: none !important; }
    .mobile-card-table tbody tr {
        display: block;
        background: rgba(255,255,255,0.04);
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 14px;
        border: 1px solid var(--erp-border);
    }
    .mobile-card-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border: none !important;
        font-size: 13px;
    }
    .mobile-card-table tbody td::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--erp-text-secondary);
        flex-shrink: 0;
        margin-right: 8px;
    }
    .mobile-card-table tbody td.action-cell {
        border-top: 1px solid var(--erp-border) !important;
        margin-top: 6px;
        padding-top: 10px;
        justify-content: flex-end;
    }
    .mobile-card-table tbody td.action-cell::before { content: '' !important; }

    /* 날짜 필터 폼: 세로 정렬 */
    .erp-search-form .row { flex-direction: column; }
    .erp-search-form .row > [class*="col-"] {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
        margin-bottom: 8px;
    }
    .erp-search-form .erp-btn { width: 100%; }

    /* 카드 제목 크기 */
    .erp-card-title { font-size: 15px; }

    /* 주간 날짜 범위 줄바꿈 */
    h4.erp-card-title .fs-6 {
        display: block;
        margin-left: 0 !important;
        margin-top: 4px;
        font-size: 11px !important;
    }

    /* 프로필 텍스트 오버플로우 방지 */
    .erp-card .d-flex.justify-content-between .fw-bold {
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 58%;
        text-align: right;
        white-space: nowrap;
    }
}

/* ============================
   Sidebar Overlay
   ============================ */
.erp-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.erp-sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Calendar icon white for dark theme */
::-webkit-calendar-picker-indicator {
    filter: invert(1);
}
