/* IAN Accounting System - Premium & Minimal Design */

@charset "UTF-8";

:root {
    /* 1. 세련된 컬러 팔레트 (Premium Navy & Soft Blue) */
    --primary-color: #0f172a;
    /* 다크 네이비 (메인 브랜드 컬러) */
    --primary-light: #334155;
    /* 라이트 네이비 */
    --primary-accent: #3b82f6;
    /* 포인트 블루 (버튼, 링크 등) */

    --secondary-color: #64748b;
    /* 차분한 그레이 블루 */

    /* 2. 현대적인 그레이스케일 */
    --bg-body: #f1f5f9;
    /* 아주 옅은 블루 그레이 배경 */
    --bg-white: #ffffff;
    --border-color: #e2e8f0;
    /* 옅은 테두리 */

    --text-primary: #1e293b;
    /* 짙은 네이비 (본문) */
    --text-secondary: #64748b;
    /* 중간 회색 (보조 텍스트) */
    --text-light: #94a3b8;
    /* 옅은 회색 */
    --text-white: #ffffff;

    /* 3. 상태 컬러 (채도를 낮춰 고급스럽게) */
    --success: #059669;
    --error: #dc2626;
    --warning: #d97706;
    --info: #2563eb;

    /* 4. 디자인 토큰 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --shadow-float: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    --font-size-xs: 0.75rem;
    /* 12px */
    --font-size-sm: 0.875rem;
    /* 14px */
    --font-size-base: 1rem;
    /* 16px */
    --font-size-lg: 1.125rem;
    /* 18px */
    --font-size-xl: 1.25rem;
    /* 20px */
    --font-size-2xl: 1.5rem;
    /* 24px */
    --font-size-3xl: 2rem;
    /* 32px */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.02em;
    /* 현대적인 자간 */
}

a {
    color: inherit;
    text-decoration: none;
}

/* ============================================
   레이아웃
   ============================================ */
.layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-container {
    flex: 1;
    max-width: 1600px;
    /* 너무 넓지 않게 제한 */
    width: 100%;
    margin: 0 auto;
    padding: 40px var(--spacing-lg);
    /* 상하 여백 넉넉하게 */
}

/* ============================================
   네비게이션 바 (슬림 & 다크)
   ============================================ */
.top-navbar {
    background: var(--primary-color);
    color: var(--text-white);
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
    overflow: visible;
}

.navbar-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    position: relative;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.5px;
}

.brand-logo {
    width: 32px;
    height: 32px;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 24px;
    flex-wrap: nowrap;
    flex: 1;
    max-width: calc(100% - 400px);
}

.nav-link {
    padding: 8px 12px;
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    font-weight: 600;
}

/* 기존 삼각형 제거 */
.nav-link.active::after {
    display: none;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
}

.user-role {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-left: 6px;
}

.btn-logout {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #94a3b8;
    border-radius: 4px;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-logout:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

/* 드롭다운 */
.nav-dropdown {
    position: relative;
}

.nav-dropdown .nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    background: white;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: 8px;
    min-width: 200px;
    display: none;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.nav-dropdown.dropdown-open .dropdown-menu {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.dropdown-item {
    display: block;
    padding: 10px 14px;
    color: var(--text-primary);
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

.dropdown-item:hover {
    background: var(--bg-body);
    color: var(--primary-accent);
}

/* ============================================
   페이지 헤더
   ============================================ */
.page-header {
    margin-bottom: 40px;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.03em;
}

.page-description {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ============================================
   카드 UI (핵심)
   ============================================ */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    /* 기본은 옅게 */
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
    /* 헤더 배경 침범 방지 */
}

.card:hover {
    box-shadow: var(--shadow-md);
    /* 호버 시 살짝 떠오르는 효과는 아주 미세하게 */
    /* transform: translateY(-2px); */
}

/* 카드 헤더 현대화 */
.card-header {
    background: transparent;
    /* 흰색 배경 유지 */
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 24px;
}

/* ============================================
   통계 카드 (Stats)
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
    font-family: inherit;
    /* Courier New 제거하고 기본 폰트 사용 */
}

/* ============================================
   버튼 (Buttons)
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 42px;
    padding: 0 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid transparent;
    transition: all 0.2s;
    letter-spacing: -0.01em;
    cursor: pointer;
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: var(--primary-accent);
    /* 포인트 블루 */
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: white;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-body);
    border-color: #cbd5e1;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    height: 32px;
    padding: 0 12px;
    font-size: 0.85rem;
}

/* ============================================
   폼 입력 (Inputs)
   ============================================ */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-control,
input[type="text"],
input[type="date"],
input[type="number"],
input[type="email"],
select,
textarea {
    width: 100%;
    height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    vertical-align: middle;
    display: inline-block;
    box-sizing: border-box;
}

textarea {
    height: auto !important;
    min-height: 120px;
    padding: 12px;
    line-height: 1.6;
    display: block;
}

select {
    height: 44px !important;
    padding: 0 36px 0 12px !important;
    line-height: 44px !important;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    /* 부드러운 링 효과 */
}

/* ============================================
   테이블 (Modern Table)
   ============================================ */
.table-container {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: separate;
    /* collapse 대신 separate 사용 */
    border-spacing: 0;
}

thead th {
    background: #f8fafc;
    /* 아주 연한 배경 */
    color: var(--text-secondary);
    font-weight: 600;
    padding: 14px 16px;
    font-size: 0.85rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

tbody td {
    padding: 16px;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background-color: #f8fafc;
    /* 호버 시 아주 연하게 */
}

/* ============================================
   필터 바 (Filter Bar)
   ============================================ */
.filter-bar {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 24px;
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

/* ============================================
   유틸리티 (Utilities)
   ============================================ */
.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 8px;
}

.gap-4 {
    gap: 16px;
}

.text-red {
    color: var(--error);
}

.text-blue {
    color: var(--primary-accent);
}

.text-gray {
    color: var(--text-secondary);
}

/* 아이콘 정렬 */
span[class*="icon"],
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

/* 이모지 정렬 개선 */
.btn span,
.form-label span,
.dropdown-item span {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

/* ============================================
   모바일 반응형 (Mobile Responsive)
   ============================================ */
.mobile-menu-toggle {
    display: none;
    margin-right: 16px;
}

#mobile-menu-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: white;
    border-radius: 2px;
    transition: all 0.3s;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 1024px) {
    .navbar-container {
        padding: 0 16px;
        justify-content: space-between;
    }

    .mobile-menu-toggle {
        display: block;
        order: 1; /* 맨 왼쪽 */
    }

    .navbar-brand {
        order: 2; /* 가운데 또는 왼쪽 */
        margin-right: auto;
        font-size: 1rem;
    }
    
    .navbar-brand span {
        display: none; /* 모바일에서 긴 텍스트 숨김 (로고만 표시 추천) */
    }
    
    /* 로고 텍스트가 필요하다면 아래 .navbar-brand span 설정을 해제하세요 */
    /*
    .navbar-brand span {
        display: block;
        font-size: 0.9rem;
    }
    */

    .navbar-user {
        order: 3; /* 오른쪽 */
        gap: 8px;
    }

    .user-name, .user-role {
        display: none; /* 모바일에서 사용자 이름/권한 숨김 */
    }

    .navbar-menu {
        position: fixed;
        top: 60px; /* 헤더 높이만큼 띄움 */
        left: 0;
        width: 100%;
        background: var(--primary-color);
        flex-direction: column;
        align-items: flex-start;
        padding: 0;
        margin: 0;
        max-width: none;
        box-shadow: 0 10px 10px -5px rgba(0,0,0,0.2);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
        z-index: 999;
    }

    .navbar-menu.active {
        max-height: 500px; /* 충분한 높이 */
        overflow-y: auto;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .nav-item {
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    .nav-link {
        display: block;
        padding: 16px 20px;
        font-size: 1rem;
        border-radius: 0;
    }
    
    .dropdown-menu {
        position: static;
        background: rgba(0,0,0,0.2);
        box-shadow: none;
        border: none;
        width: 100%;
        padding: 0;
        display: block; /* 항상 펼쳐두거나 토글 */
        opacity: 1;
        visibility: visible;
        border-radius: 0;
        min-width: auto;
    }

    .dropdown-item {
        padding: 12px 30px; /* 들여쓰기 */
        color: #cbd5e1;
    }
    
    .dropdown-item:hover {
        background: rgba(255,255,255,0.05);
        color: white;
    }

    /* 테이블 가로 스크롤 */
    .table-responsive, .card-body {
        overflow-x: auto;
    }
    
    .main-container {
        padding: 24px 16px;
    }
}