@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

:root {
    /* Brand Colors based on Logo */
    --primary-navy: #2e3b55;
    /* Deep Navy */
    --primary-cyan: #29b6f6;
    /* Bright Cyan */

    /* Neutral Colors */
    --bg-body: #f8f9fa;
    --bg-white: #ffffff;
    --text-main: #1e293b;
    --text-sub: #64748b;
    --border-color: #e2e8f0;

    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --sidebar-width: 250px;
    --header-height: 64px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0.7;
    }

    to {
        opacity: 1;
    }
}

/* Layout */
#app {
    display: flex;
    width: 100%;
}

.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: 100vh;
    z-index: 50;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo-img {
    height: 32px;
    object-fit: contain;
}

.nav-menu {
    padding: 1.5rem 1rem;
    list-style: none;
    flex: 1;
}

.nav-item {
    margin-bottom: 0.5rem;
}

/* Sidebar: Submenu (예: 이폼싸인 > 수신함/계정) */
.nav-link-group {
    cursor: default;
}

.nav-submenu {
    list-style: none;
    margin-top: 0.5rem;
    padding-left: 1.25rem;
}

.nav-submenu .nav-item {
    margin-bottom: 0.5rem;
}

.nav-submenu .nav-link {
    padding: 0.8rem 1rem;
    font-size: 0.92rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-sub);
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background-color: #f0f9ff;
    color: var(--primary-navy);
}

.nav-link i {
    width: 24px;
    margin-right: 0.75rem;
    text-align: center;
}

.user-info-mini {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background-color: var(--primary-navy);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Header */
.top-header {
    height: var(--header-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-navy);
}

/* Components */
.card {
    background: var(--bg-white);
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    font-size: 0.95rem;
    gap: 0.5rem;
}

.btn-primary {
    background-color: #292664;
    color: white;
}

.btn-primary:hover {
    background-color: #1f1d4d;
}

.btn-outline {
    background-color: white;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: var(--bg-body);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-cyan);
    box-shadow: 0 0 0 3px rgba(41, 182, 246, 0.1);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 1rem;
    background-color: #f8fafc;
    color: var(--text-sub);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-master {
    background: #e0e7ff;
    color: #4338ca;
}

.badge-admin {
    background: #dcfce7;
    color: #15803d;
}

.badge-office {
    background: #f3f4f6;
    color: #4b5563;
}

.badge-danger {
    background: #fee2e2;
    color: #dc2626;
}

/* Login Page 전용 레이아웃 */
body.login-page {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    /* 세로 가운데 */
    justify-content: center;
    /* 가로 가운데 */
    background-color: #f1f5f9;
}

/* 기존 login-container는 카드 감싸는 래퍼 정도만 */
.login-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 로그인 카드 자체 */
.login-card {
    width: 100%;
    max-width: 400px;
    background: white;
    padding: 2.5rem;
    border-radius: 1.5rem;
    box-shadow: var(--shadow-md);
    text-align: center;
}

/* 로고 영역 센터 정렬 */
.login-logo {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 2rem;
}

.notice-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    display: inline-block;
}

.notice-badge.unread {
    background: #29b6f6;
    color: #ffffff;
}

.notice-badge.read {
    background: #bdbdbd;
    color: #ffffff;
}

/* 서브메뉴가 있는 항목의 레이아웃 */
.nav-link-group {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center;
    cursor: pointer;
    width: 100%;
}

/* 화살표 아이콘을 오른쪽 끝으로 밀기 */
.arrow-icon {
    margin-left: auto;
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

/* 기본적으로 서브메뉴는 숨김 */
.nav-submenu {
    display: none !important;
    list-style: none;
    padding-left: 20px;
}

/* 부모 리스트 아이템에 .open 클래스가 붙었을 때만 서브메뉴 노출 */
.nav-item.open .nav-submenu {
    display: block !important;
}

/* 부모 리스트 아이템에 .open 클래스가 붙었을 때 화살표 회전 */
.nav-item.open .arrow-icon {
    transform: rotate(180deg);
}

.mobile-header {
    display: none;
}

@media (max-width:768px) {

    .sidebar {
        display: none !important;
    }

    /* ✅ 사이드바 없으니 margin-left 제거 */
    .main-wrapper {
        margin-left: 0 !important;
    }

    /* ✅ 전체 콘텐츠 75% 크기 + 가운데 정렬 */
    .container {
        transform: scale(0.75);
        transform-origin: top center;
        width: calc(100% / 0.75);
        /* scale 보정: 실제 너비를 1/0.75로 늘려야 가로가 꽉 참 */
        margin-left: calc((100% - 100% / 0.75) / 2);
        /* 가운데 정렬 */
        padding: 1rem;
    }

    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 16px;
        background: #fff;
        border-bottom: 1px solid var(--border-color);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        height: 56px;
    }

    /* ✅ fixed 헤더 높이만큼 콘텐츠 밀어내기 */
    .main-wrapper {
        padding-top: 56px;
    }

    /* ✅ 모바일에선 데스크톱 헤더 숨김 (mobile-header가 대신함) */
    .top-header {
        display: none;
    }

    .mobile-header .title {
        font-weight: 900;
        font-size: 16px;
    }

    .mobile-user {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: var(--primary-cyan);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 800;
    }

    .mobile-drawer {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        height: 100%;
        background: #fff;
        padding: 24px 18px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        transition: .25s;
        z-index: 1200;
        box-shadow: 4px 0 20px rgba(0, 0, 0, .08);
    }

    .mobile-drawer.active {
        left: 0;
    }

    .drawer-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .35);
        display: none;
        z-index: 1100;
    }

    .drawer-overlay.active {
        display: block;
    }

    .mobile-drawer a {
        padding: 12px;
        border-radius: 10px;
        font-weight: 800;
        text-decoration: none;
        color: var(--text-main);
        border: 1px solid var(--border-color);
    }

    .mobile-drawer a.active {
        background: #f0f9ff;
        border-color: rgba(41, 182, 246, .3);
    }

    .drawer-user {
        display: flex;
        gap: 12px;
        align-items: center;
        margin-bottom: 14px;
    }

    .drawer-avatar {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        background: var(--primary-cyan);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 900;
    }

    .drawer-logout {
        margin-top: auto;
    }

}

/* ✅ 테이블 행 등장 애니메이션 */
@keyframes rowFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.table tbody tr {
    animation: rowFadeIn 0.2s ease-out both;
}

.table tbody tr:nth-child(1) {
    animation-delay: 0.03s;
}

.table tbody tr:nth-child(2) {
    animation-delay: 0.06s;
}

.table tbody tr:nth-child(3) {
    animation-delay: 0.09s;
}

.table tbody tr:nth-child(4) {
    animation-delay: 0.12s;
}

.table tbody tr:nth-child(5) {
    animation-delay: 0.15s;
}

.table tbody tr:nth-child(6) {
    animation-delay: 0.18s;
}

.table tbody tr:nth-child(7) {
    animation-delay: 0.21s;
}

.table tbody tr:nth-child(8) {
    animation-delay: 0.24s;
}

.table tbody tr:nth-child(9) {
    animation-delay: 0.27s;
}

.table tbody tr:nth-child(10) {
    animation-delay: 0.30s;
}

.table tbody tr:nth-child(n+11) {
    animation-delay: 0.33s;
}

.table-responsive {
    overflow-x: auto;
    overflow-y: hidden;
}

/* =============================================
   Flatpickr — shadcn/ui 스타일 달력 테마
   ============================================= */

/* 캘린더 전체 */
.flatpickr-calendar {
    font-family: "Pretendard Variable", Pretendard, sans-serif !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 14px !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .07), 0 10px 24px -4px rgba(0, 0, 0, .1) !important;
    padding: 12px !important;
}

/* 화살표 제거 */
.flatpickr-calendar.arrowTop::before,
.flatpickr-calendar.arrowTop::after,
.flatpickr-calendar.arrowBottom::before,
.flatpickr-calendar.arrowBottom::after {
    display: none !important;
}

/* 헤더 월/년 */
.flatpickr-months {
    background: transparent !important;
    padding: 0 0 8px 0 !important;
    align-items: center !important;
}

.flatpickr-months .flatpickr-month {
    background: transparent !important;
}

.flatpickr-current-month {
    font-size: .92rem !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    padding: 0 !important;
}

.flatpickr-current-month select,
.flatpickr-current-month input.numInput {
    color: #1e293b !important;
    font-weight: 700 !important;
    font-size: .92rem !important;
}

/* 이전/다음 버튼 */
.flatpickr-prev-month,
.flatpickr-next-month {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    width: 28px !important;
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    top: 2px !important;
    padding: 0 !important;
    transition: background .15s !important;
}

.flatpickr-prev-month:hover,
.flatpickr-next-month:hover {
    background: #f1f5f9 !important;
}

.flatpickr-prev-month svg,
.flatpickr-next-month svg {
    fill: #64748b !important;
    width: 13px !important;
    height: 13px !important;
}

/* 요일 헤더 */
.flatpickr-weekdays {
    background: transparent !important;
    margin-bottom: 2px !important;
}

span.flatpickr-weekday {
    background: transparent !important;
    color: #94a3b8 !important;
    font-size: .78rem !important;
    font-weight: 600 !important;
}

/* 날짜 셀 */
.flatpickr-day {
    border-radius: 8px !important;
    border: none !important;
    font-size: .85rem !important;
    font-weight: 500 !important;
    color: #1e293b !important;
    height: 36px !important;
    line-height: 36px !important;
    max-width: 36px !important;
    transition: background .12s, color .12s !important;
}

.flatpickr-day:hover {
    background: #f1f5f9 !important;
    color: #1e293b !important;
}

/* 선택된 날짜 — 채워진 원 */
.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.selected:focus {
    background: #292664 !important;
    border-color: #292664 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
}

/* 오늘 날짜 — 밑줄 도트 스타일 */
.flatpickr-day.today {
    border: none !important;
    position: relative;
    font-weight: 700 !important;
    color: #292664 !important;
}

.flatpickr-day.today::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #292664;
}

.flatpickr-day.today.selected::after {
    background: #fff;
}

.flatpickr-day.today:hover {
    background: #f1f5f9 !important;
}

/* 비활성/다른 달 */
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: #cbd5e1 !important;
}

.flatpickr-day.flatpickr-disabled {
    color: #e2e8f0 !important;
    cursor: not-allowed !important;
}

/* input */
.flatpickr-input {
    cursor: pointer !important;
}

.flatpickr-input.active,
.flatpickr-input:focus {
    outline: none !important;
    border-color: #292664 !important;
    box-shadow: 0 0 0 3px rgba(41, 38, 100, .1) !important;
}

/* ── 대시보드 숫자 카운트업 애니메이션 ── */
.stat-number {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.stat-number.stat-loaded {
    opacity: 1;
    transform: translateY(0);
}