/* css/style.css */
:root {
    --primary-color: #4CAF50; /* Green */
    --secondary-color: #2196F3; /* Blue */
    --accent-color: #FFC107; /* Amber */
    --danger-color: #F44336; /* Red */
    --text-color: #333;
    --bg-color: #f4f7f6;
    --sidebar-bg: #2c3e50; /* Dark Blue Gray */
    --sidebar-text: #ecf0f1;
    --sidebar-hover: #34495e;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    min-height: 100vh;
}

.container {
    display: flex;
    width: 100%;
}

/* Sidebar styles */
.sidebar {
    width: 250px;
    background-color: #2c3e50; /* 어두운 배경 */
    color: #ecf0f1; /* 밝은 텍스트 */
    padding: 20px;
    box-sizing: border-box;
    height: 100vh; /* 전체 높이 */
    position: fixed; /* 스크롤 시 고정 */
    left: 0;
    top: 0;
    overflow-y: auto; /* 메뉴가 많아지면 스크롤 가능 */
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

.sidebar-header h3 {
    margin: 0;
    color: #ecf0f1;
    font-size: 1.5em;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu li a {
    display: block;
    color: #ecf0f1;
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.sidebar-menu li a:hover {
    background-color: #34495e; /* 호버 시 배경색 변경 */
}

.sidebar-menu li.active a {
    background-color: #1abc9c; /* 현재 활성화된 메뉴 */
    color: #fff;
    font-weight: bold;
}

.sidebar-menu li a i {
    margin-right: 10px;
    width: 20px; /* 아이콘 너비 고정 */
    text-align: center;
}

.sidebar-menu .menu-heading {
    font-size: 0.9em;
    color: #bdc3c7; /* 회색 텍스트 */
    padding: 15px 15px 5px;
    margin-top: 15px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
    margin-bottom: 5px;
}

/* 메인 콘텐츠 영역이 사이드바와 겹치지 않도록 조정 */
.main-content {
    margin-left: 250px; /* 사이드바 너비만큼 왼쪽 여백 */
    padding: 20px;
}

/* 반응형 디자인 (선택 사항) */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        box-shadow: none;
        padding: 10px 0;
    }
    .sidebar-menu {
        display: flex; /* 가로로 정렬 */
        flex-wrap: wrap; /* 공간 부족 시 다음 줄로 */
        justify-content: center;
    }
    .sidebar-menu li {
        margin: 5px;
    }
    .sidebar-menu li a {
        padding: 8px 12px;
        font-size: 0.9em;
    }
    .sidebar-menu .menu-heading {
        display: none; /* 모바일에서는 섹션 헤딩 숨기기 */
    }
    .main-content {
        margin-left: 0;
        padding-top: 10px;
    }
}

/* Main content styles */
.main-content {
    margin-left: 250px; /* Space for sidebar */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease-in-out;
}

.main-content.full-width {
    margin-left: 0;
}

.header-bar {
    background-color: #fff;
    padding: 15px 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 999;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.8em;
    cursor: pointer;
    color: var(--text-color);
    display: none; /* Mobile only */
}

.user-info {
    font-size: 0.9em;
    color: var(--text-color);
}

.user-info .logout-btn {
    margin-left: 15px;
    padding: 8px 15px;
    background-color: var(--danger-color);
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.user-info .logout-btn:hover {
    background-color: #c0392b;
}

.content-area {
    padding: 20px;
    flex-grow: 1;
}

/* Form and table styles */
.form-container, .list-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: calc(100% - 22px); /* Adjust for padding and border */
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box; /* Include padding and border in width */
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #45a049;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #1976D2;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

table th, table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

table tr:nth-child(even) {
    background-color: #f9f9f9;
}

table.dashboard th {
    background-color: transparent !important;
    font-weight: bold;
}

table.dashboard tr:nth-child(even) {
    background-color: transparent !important;
}

.search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: flex-end;
}

.search-form input, .search-form select {
    flex: 1;
    min-width: 150px;
}

.search-form button {
    flex-shrink: 0;
}

.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.pagination a, .pagination span {
    display: inline-block;
    padding: 8px 16px;
    margin: 0 4px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: var(--text-color);
    border-radius: 4px;
}

.pagination a:hover {
    background-color: #f2f2f2;
}

.pagination .current {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Dashboard styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.dashboard-box {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    color: white; /* Default text color for boxes */
}

.dashboard-box h4 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2em;
    color: white;
}

.dashboard-box ul {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.dashboard-box ul li {
    margin-bottom: 5px;
}

.dashboard-box table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.dashboard-box table th,
.dashboard-box table td {
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px;
    text-align: left;
    font-size: 0.9em;
    color: white;
}

.dashboard-box.incoming { background-color: #3498db; } /* Blue */
.dashboard-box.outgoing { background-color: #e74c3c; } /* Red */
.dashboard-box.expiring { background-color: #f39c12; } /* Orange */
.dashboard-box.low-stock { background-color: #c0392b; } /* Darker Red */
.dashboard-box.out-of-stock { background-color: #7f8c8d; } /* Gray */

/* Responsive design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-250px);
        box-shadow: none; /* Hide shadow when hidden */
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .close-btn {
        display: block;
    }

    .sidebar-header h3 {
        padding-right: 30px; /* Make space for close button */
    }

    .dashboard-grid {
        grid-template-columns: 1fr; /* Stack boxes on mobile */
    }
}