/* ==========================================================
   Cấu trúc chung và vị trí toàn bộ trang web
   ========================================================== */
:root {
    --primary-color: #4a6cff;
    --secondary-color: #6c757d;
    --background-color: #f4f7f9;
    --card-bg-color: #ffffff;
    --text-color: #333333;
    --sidebar-bg-color: #34495e;
    --sidebar-text-color: #ecf0f1;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    overflow-x: hidden;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* ==========================================================
   Sidebar
   ========================================================== */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg-color);
    color: var(--sidebar-text-color);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, transform 0.3s ease;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 1000;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #4a6cff;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-header h2 {
    opacity: 0;
    pointer-events: none;
}

.sidebar-header i.fas {
    font-size: 1.5rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    color: var(--sidebar-text-color);
}

.sidebar.collapsed .sidebar-header i.fas {
    opacity: 1;
}

.sidebar-menu {
    list-style: none;
    flex-grow: 1;
}

.sidebar-menu li {
    position: relative;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--sidebar-text-color);
    text-decoration: none;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.sidebar-menu a:hover,
.sidebar-menu li.active a {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-menu a i {
    font-size: 1.2rem;
    width: 30px;
}

.sidebar-menu a span {
    display: block;
    margin-left: 10px;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-menu a span {
    opacity: 0;
    pointer-events: none;
}

/* ==========================================================
   Nội dung chính và Header
   ========================================================== */
.main-content {
    flex-grow: 1;
    padding: 20px;
    margin-left: 250px;
    transition: margin-left 0.3s ease;
    position: relative;
}

.sidebar.collapsed + .main-content {
    margin-left: 60px;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: var(--card-bg-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    margin-bottom: 20px;
}

.main-header button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-left h1 {
    font-size: 1.5rem;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-right .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-info i.fas {
    font-size: 1.5rem;
    color: var(--primary-color);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info p {
    font-weight: bold;
}

/* ==========================================================
   Dashboard và các bảng dữ liệu
   ========================================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background-color: var(--card-bg-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid black;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-5px);
}

.card-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.card-details h3 {
    font-size: 1.1rem;
    color: var(--secondary-color);
}

.card-details p {
    font-size: 2.5rem;
    font-weight: bold;
    margin-top: 5px;
}

.dashboard-chart {
    background-color: var(--card-bg-color);
    border: 2px solid black;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.dashboard-chart h2 {
    margin-bottom: 10px;
}

.chart-placeholder {
    height: 300px;
    background-color: #f0f0f0;
    border: 2px solid black;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--secondary-color);
}

.search-bar {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

.search-bar input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
}

.search-bar button {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-bar button:hover {
    background-color: #3b59d8;
}

.table-container {
    overflow-x: auto;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.file-table th, .file-table td {
    padding: 12px;
    border: 1px solid #000000;
    text-align: left;
}

.file-table th {
    background-color: var(--primary-color);
    color: #fff;
}

.file-table tbody tr:hover {
    background-color: #f1f1f1;
}

.file-table .action-buttons button,
.table-container > button {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.table-container > button {
    margin-top: 20px;
}

.permissions {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.permissions input,
.permissions select {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
}

.permissions button {
    background-color: #28a745;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.permissions button:hover {
    background-color: #218838;
}

.dynamic-content {
    background-color: var(--card-bg-color);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 500px;
}

/* ==========================================================
   Custom Modal
   ========================================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: fadeIn 0.3s ease-out;
}

.modal-content h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.modal-content p {
    margin-bottom: 25px;
    color: var(--text-color);
}

.modal-content button {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.modal-content button:hover {
    background-color: #3b59d8;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================
   Thiết kế Responsive và các lớp tiện ích
   ========================================================== */
@media (max-width: 768px) {
    .sidebar {
        width: 250px;
        transform: translateX(-100%);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar.active + .main-content {
        margin-left: 0;
    }

    .sidebar-header h2 {
        opacity: 1;
    }
    .sidebar-menu a span {
        display: block;
        opacity: 1;
    }
}

.section.hidden,
.hidden {
    display: none;
}