/* ===== 전역 ===== */
body {
    font-family: 'Segoe UI', 'Malgun Gothic', sans-serif;
    background-color: #f2faf6;
    color: #333;
}

/* ===== 사이드바 ===== */
#sidebar {
    width: 240px;
    min-height: 100vh;
    background: #2e7d5a;
    color: #fff;
    transition: width 0.25s ease;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
}

.sidebar-brand i {
    font-size: 1.4rem;
    color: #ffd166;
}

.sidebar-brand:hover {
    color: #c8f0dc;
}

.sidebar-divider {
    border-color: rgba(255, 255, 255, 0.2);
}

#sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

#sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

#sidebar .nav-link.active {
    background: #4aba85;
    color: #fff;
}

.logout-link {
    color: rgba(255, 255, 255, 0.65) !important;
    font-size: 0.85rem;
    border-radius: 8px;
    padding: 0.5rem 0.9rem;
}

.logout-link:hover {
    background: rgba(231, 76, 60, 0.25) !important;
    color: #e74c3c !important;
}

/* 사이드바 접힘 */
#wrapper.sidebar-collapsed #sidebar {
    width: 64px;
}

#wrapper.sidebar-collapsed #sidebar .nav-link span,
#wrapper.sidebar-collapsed .sidebar-brand span,
#wrapper.sidebar-collapsed .logout-link span {
    display: none;
}

#wrapper.sidebar-collapsed #sidebar .nav-link {
    justify-content: center;
    padding: 0.6rem;
}

/* ===== 상단 네비바 ===== */
.top-navbar {
    background: #fff;
    border-bottom: 1px solid #d4ede2;
    padding: 0.6rem 1rem;
}

.sidebar-toggle {
    background: #f2faf6;
    border: 1px solid #b8ddc9;
    color: #2e7d5a;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background: #d9f0e5;
}

/* ===== 메인 콘텐츠 ===== */
.main-content {
    min-height: calc(100vh - 58px - 56px);
}

.main-footer {
    background: #fff;
    border-top: 1px solid #d4ede2;
    display: flex;
    align-items: center;
}

/* ===== 비로그인 센터 레이아웃 ===== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2e7d5a 0%, #4aba85 100%);
}

/* ===== 카드 ===== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e4f3ec;
    border-radius: 12px 12px 0 0 !important;
    font-weight: 600;
    color: #2e7d5a;
    padding: 1rem 1.25rem;
}

/* ===== 테이블 ===== */
.table thead th {
    background: #f2faf6;
    font-size: 0.85rem;
    font-weight: 600;
    color: #3a7a5e;
    border-bottom: 2px solid #b8ddc9;
}

.table tbody td {
    font-size: 0.9rem;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: #e8f7ef;
}

/* ===== 폼 ===== */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #b8ddc9;
    font-size: 0.9rem;
}

.form-control:focus, .form-select:focus {
    border-color: #4aba85;
    box-shadow: 0 0 0 0.2rem rgba(74, 186, 133, 0.2);
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
}

/* ===== 버튼 ===== */
.btn-primary {
    background-color: #2e7d5a;
    border-color: #2e7d5a;
    border-radius: 8px;
}

.btn-primary:hover {
    background-color: #246a4c;
    border-color: #246a4c;
}

.btn-primary:focus, .btn-primary:active {
    background-color: #246a4c;
    border-color: #246a4c;
    box-shadow: 0 0 0 0.2rem rgba(74, 186, 133, 0.35);
}

/* ===== 반응형 ===== */
@media (max-width: 768px) {
    /* 모바일: 사이드바 기본 숨김, 토글 시 오버레이로 표시 */
    #sidebar {
        position: fixed;
        z-index: 1050;
        transform: translateX(-100%);
        width: 240px !important;
        box-shadow: 4px 0 12px rgba(0,0,0,0.2);
    }

    #wrapper.sidebar-open #sidebar {
        transform: translateX(0);
    }

    /* 사이드바 열릴 때 배경 어둡게 */
    #sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1040;
    }

    #wrapper.sidebar-open #sidebar-overlay {
        display: block;
    }

    #page-content-wrapper {
        width: 100%;
    }

    .main-content {
        padding: 1rem !important;
    }
}
