/* THIẾT KẾ HỆ THỐNG QUẢN LÝ KHO - PHONG CÁCH PREMIUM */

:root {
    --primary-color: #4361ee;
    --primary-light: #4895ef;
    --secondary-color: #3f37c9;
    --success-color: #10b981;
    /* Green */
    --danger-color: #ef4444;
    /* Red */
    --warning-color: #f59e0b;
    /* Orange */
    --bg-color: #f8f9fa;
    --sidebar-color: #1a1c23;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --card-bg: #ffffff;
    --border-color: #e9ecef;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
    --header-height: 70px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 15px 35px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
}

/* CONTAINER CHÍNH */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR - THANH ĐIỀU HƯỚNG */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-color);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    z-index: 5000;
    /* Sidebar Layer */
    transition: var(--transition);
    top: 0;
    left: 0;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 25px;
    gap: 15px;
}

.logo-icon {
    font-size: 24px;
    color: var(--primary-light);
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
    white-space: nowrap;
    opacity: 1;
    transition: var(--transition);
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    pointer-events: none;
}

/* MENU NAV */
.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-item {
    padding: 15px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: var(--transition);
    border-left: 4px solid transparent;
}

.nav-item i {
    font-size: 18px;
    width: 20px;
}

.nav-item span {
    white-space: nowrap;
    transition: var(--transition);
}

.sidebar.collapsed .nav-item span {
    opacity: 0;
    pointer-events: none;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary-light);
    border-left-color: var(--primary-light);
}

/* USER INFO AT BOTTOM */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.user-details {
    overflow: hidden;
    transition: var(--transition);
}

.sidebar.collapsed .user-details {
    opacity: 0;
    width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: #888;
}

/* LOGOUT BUTTON */
.logout-btn {
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #ff6b6b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
}

.logout-btn:hover {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.3);
}

.logout-btn i {
    font-size: 16px;
}

.sidebar.collapsed .logout-btn span {
    display: none;
}


/* MAIN CONTENT AREA */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed+.main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* TOPBAR */
.topbar {
    height: var(--header-height);
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: var(--shadow);
    z-index: 4000;
    /* Topbar Layer (Above Backdrop) */
    position: sticky;
    top: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 25px;
}

.search-box {
    background-color: #f1f3f5;
    padding: 0 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 300px;
    height: 42px;
    /* Chuẩn hóa chiều cao */
    border: 1px solid transparent;
    transition: var(--transition);
}

.search-box:focus-within {
    background-color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.search-box i {
    color: var(--text-muted);
}

.search-box input {
    border: none !important;
    background: none !important;
    outline: none !important;
    width: 100%;
    font-size: 14px;
    height: 100%;
    padding: 0 !important;
    box-shadow: none !important;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    padding: 5px;
    border-radius: 5px;
    transition: var(--transition);
}

.icon-btn:hover {
    background-color: #f1f3f5;
    color: var(--primary-color);
}

/* BADGES & NOTIFICATIONS */
.notification-btn {
    position: relative;
}

.notification-btn .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: var(--danger-color);
    color: white;
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid white;
    font-weight: 700;
    transition: var(--transition);
    transform: scale(0);
}

.notification-btn .badge.active {
    transform: scale(1);
}

/* NOTIFICATION DROPDOWN */
.notification-dropdown {
    position: absolute;
    top: 60px;
    right: 30px;
    width: 360px;
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: dropdownFadeIn 0.3s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification-dropdown.active {
    display: flex;
}

.notification-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.notification-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.mark-read-btn {
    font-size: 12px;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 600;
}

.notification-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 15px 20px;
    border-bottom: 1px dashed var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    gap: 15px;
}

.notification-item:hover {
    background: #f1f5f9;
}

.notification-item.unread {
    background: #eff6ff;
    border-left: 4px solid var(--primary-color);
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-success {
    background: #dcfce7;
    color: #10b981;
}

.icon-danger {
    background: #fee2e2;
    color: #ef4444;
}

.icon-warning {
    background: #fef3c7;
    color: #f59e0b;
}

.icon-info {
    background: #e0f2fe;
    color: #3b82f6;
}

.notification-info {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.notification-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.notification-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 8px;
}

.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.notification-empty i {
    font-size: 40px;
    margin-bottom: 15px;
    opacity: 0.3;
}

.notification-footer {
    padding: 12px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-muted);
}

/* RESPONSIVE TABLE CONTAINER */
.table-responsive {
    width: 100%;
    margin-bottom: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: white;
}

table {
    width: 100%;
    border-collapse: collapse;
}

/* Ẩn bớt cột trên mobile nếu cần thiết */
@media (max-width: 768px) {
    .badge {
        font-size: 10px;
        padding: 3px 6px;
    }
}

/* SEARCH & FILTER BAR */
.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 20px;
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.header-left {
    display: flex;
    gap: 12px;
    align-items: center;
    flex: 1;
}

.header-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-select {
    height: 42px;
    /* Chuẩn hóa chiều cao */
    padding: 0 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: #fff;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
    cursor: pointer;
}

.filter-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
    height: 42px;
    /* Chuẩn hóa chiều cao */
    padding: 0 20px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #6c757d;
    color: #fff;
    height: 42px;
    padding: 0 20px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
}

.view-toggle {
    display: flex;
    background: #f1f3f5;
    padding: 4px;
    border-radius: 10px;
    gap: 4px;
    height: 42px;
    /* Chuẩn hóa chiều cao */
    align-items: center;
}

.view-btn,
.tab-btn {
    height: 100%;
    padding: 0 16px;
    border-radius: 7px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.view-btn.active,
.tab-btn.active {
    background: #fff;
    color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.tab-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
}

.tab-btn.active {
    background: #fff;
    color: var(--primary-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* VIEWPORT CONTAINER */
.module-container {
    padding: 30px;
    flex: 1;
    position: relative;
}

/* LOADING OVERLAY */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(248, 249, 250, 0.8);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(67, 97, 238, 0.1);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

/* THÀNH PHẦN UI CHI TIẾT */

/* Grid thông số */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.grid-row {
    display: grid;
    gap: 25px;
    margin-bottom: 25px;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 992px) {
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    /* border-left: 4px solid var(--primary-color); removed as user request */
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-label {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
}

.stat-card i {
    font-size: 40px;
    color: rgba(67, 97, 238, 0.1);
}

/* DASHBOARD ENHANCEMENTS */
.progress-container {
    width: 100%;
    background: #edf2f7;
    border-radius: 10px;
    height: 8px;
    margin-top: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.8s ease-in-out;
}

.alert-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    /* border-left: 4px solid var(--danger-color); removed */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.alert-item.warning {
    border-left-color: var(--warning-color, #ff9800);
}

.alert-info h5 {
    font-size: 14px;
    margin-bottom: 2px;
}

.alert-info p {
    font-size: 12px;
    color: var(--text-muted);
}

/* Card và Layout */
.card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    /* border-left: 4px solid var(--primary-color); removed */
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

.card h3 {
    margin-bottom: 20px;
    font-size: 18px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Bảng dữ liệu */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 15px;
    background-color: #f8f9fa;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

tr:hover {
    background-color: #fcfcfc;
}

th.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 25px;
    transition: var(--transition);
}

th.sortable:hover {
    background-color: #f1f3f5;
    color: var(--primary-color);
}

th.sortable::after {
    content: '\f0dc';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.2;
    font-size: 0.8em;
}

th.sortable.asc::after {
    content: '\f0de';
    opacity: 1;
    color: var(--primary-color);
}

th.sortable.desc::after {
    content: '\f0dd';
    opacity: 1;
    color: var(--primary-color);
}

/* CARD VIEW DESIGN */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.product-card {
    background: #fff;
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    /* border-left: 4px solid var(--primary-color); removed */
    position: relative;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-light);
}

.product-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.product-code {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(67, 97, 238, 0.1);
    padding: 4px 8px;
    border-radius: 5px;
}

.product-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 15px;
    height: 48px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
}

.p-stat-item {
    display: flex;
    flex-direction: column;
}

.p-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.p-stat-value {
    font-weight: 700;
    font-size: 15px;
}

.product-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ACTION BUTTONS */
.action-btns {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: #fff;
}

.btn-edit {
    background-color: var(--warning-color);
}

.btn-edit:hover {
    background-color: #e67e22;
    transform: scale(1.1);
}

.btn-info {
    background-color: var(--primary-light);
}

.btn-info:hover {
    background-color: var(--primary-color);
    transform: scale(1.1);
}

.btn-warning {
    background-color: #f1c40f;
}

.btn-warning:hover {
    background-color: #f39c12;
    transform: scale(1.1);
}

.btn-delete {
    background-color: var(--danger-color);
}

.btn-delete:hover {
    background-color: #d81b60;
    transform: scale(1.1);
}

/* MODAL STYLES */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    /* Modal Layer (Highest) */
    padding: 20px;
    /* Thêm padding để tránh sát lề trên mobile */
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    /* Responsive Fix */
    max-height: 90vh;
    /* Giới hạn chiều cao */
    display: flex;
    flex-direction: column;
    /* End Responsive Fix */
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-lg {
    max-width: 1000px !important;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-accent {
    border-top: 6px solid var(--primary-color) !important;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 15px;
    flex-shrink: 0;
    /* Không co lại */
}

/* Thêm Class modal-body để scroll */
.modal-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    /* Quan trọng cho Firefox/Flex logic */
    padding-right: 5px;
    /* Tránh scrollbar che nội dung */
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* CHUẨN HÓA INPUT & SELECT TOÀN HỆ THỐNG */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    width: 100%;
    height: 42px;
    /* Chiều cao chuẩn 42px đồng bộ với Header */
    padding: 8px 15px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    outline: none;
    font-size: 14px;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #ffffff;
    color: var(--text-main);
    display: block;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

textarea {
    height: auto;
    min-height: 100px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
    background-color: #fff;
}

input:disabled,
select:disabled,
input[readonly] {
    background-color: #f5f7f9 !important;
    color: #a0aec0 !important;
    cursor: not-allowed !important;
    border-color: #e2e8f0 !important;
}

/* Kiểu riêng cho Select (Dropdown) */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%234361ee' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}

/* Kiểu riêng cho Date Input */
input[type="date"] {
    position: relative;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: 500;
}

/* Chỉnh lại form-group để không bị đè style */
.form-group input,
.form-group select {
    margin-top: 5px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
    /* Giảm margin chút cho cân đối với padding */
    padding-top: 10px;
    border-top: 1px solid transparent;
    /* Chuẩn bị cho trường hợp cần border */
    flex-shrink: 0;
    /* Không bị co lại */
}

.btn-secondary {
    background: #eee;
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

/* Conflict badge styles removed */
/* Hiệu ứng chuyển động */
.fadeIn {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}


/* RESPONSIVE DESIGN */
@media (max-width: 1024px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
    }

    .sidebar .logo-text,
    .sidebar .nav-item span,
    .sidebar .user-details {
        display: none;
    }

    .main-content {
        margin-left: var(--sidebar-collapsed-width);
    }

    .search-box {
        width: 200px;
    }
}

@media (max-width: 768px) {

    /* SIDEBAR MOBILE: Mặc định ẨN */
    aside.sidebar,
    aside.sidebar.collapsed {
        position: fixed;
        top: 0;
        left: 0;
        width: 260px;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 5000;
        box-shadow: none;
    }

    /* SIDEBAR MOBILE: HIỆN khi có class mobile-open */
    aside.sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
    }

    /* Hiển thị đầy đủ text trên mobile */
    .logo-text,
    .nav-item span,
    .user-details,
    .logout-btn span {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* NÚT TOGGLE MOBILE - TÁCH RIÊNG, LUÔN Ở TRÊN CÙNG */
    .mobile-menu-toggle {
        display: flex !important;
        position: fixed !important;
        top: 12px !important;
        left: 12px !important;
        z-index: 999999 !important;
        /* CỰC CAO - KHÔNG GÌ CHE ĐƯỢC */
        width: 48px !important;
        height: 48px !important;
        border-radius: 50% !important;
        background: var(--primary-color) !important;
        color: white !important;
        border: none !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 20px !important;
        cursor: pointer !important;
        box-shadow: 0 4px 16px rgba(67, 97, 238, 0.5) !important;
        transition: all 0.2s !important;
        pointer-events: auto !important;
        /* LUÔN NHẬN CLICK */
    }

    .mobile-menu-toggle:active {
        transform: scale(0.95) !important;
    }

    .mobile-menu-toggle:hover {
        box-shadow: 0 6px 20px rgba(67, 97, 238, 0.7) !important;
    }

    /* Ẩn nút toggle desktop */
    .topbar .icon-btn {
        display: none !important;
    }

    .topbar {
        padding-left: 70px !important;
        /* Nhường chỗ cho nút toggle */
        padding-right: 15px !important;
    }

    .page-title {
        font-size: 16px !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .search-box {
        display: none !important;
    }
}

/* Ẩn nút toggle mobile trên desktop */
.mobile-menu-toggle {
    display: none;
}

/* FINANCE MODULE SPECIFIC UI */
.table-slim th,
.table-slim td {
    padding: 8px 12px;
    font-size: 13px;
}

.debt-pay-input {
    width: 120px !important;
    height: 32px !important;
    padding: 4px 8px !important;
    border-radius: 6px !important;
    font-weight: 700;
    color: var(--primary-color);
}

.tx-header-form {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
}

/* UTILITY CLASSES FOR ACCENT BORDERS - Disabled per user request */
/*
.border-left-primary { border-left: 4px solid var(--primary-color) !important; }
.border-left-success { border-left: 4px solid var(--success-color) !important; }
.border-left-danger { border-left: 4px solid var(--danger-color) !important; }
.border-left-warning { border-left: 4px solid var(--warning-color) !important; }
.border-left-info { border-left: 4px solid var(--primary-light) !important; }
*/

/* RESPONSIVE GRID UTILITIES */
.grid-row {
    display: grid;
    gap: 25px;
    width: 100%;
}

.grid-2-1 {
    grid-template-columns: 2fr 1fr;
}

.grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.grid-2 {
    grid-template-columns: 1fr 1fr;
}

.grid-cols-2 {
    grid-template-columns: 1fr 1fr;
}

.grid-cols-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.grid-cols-4 {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

@media (max-width: 768px) {

    .grid-2-1,
    .grid-3,
    .grid-2,
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    .module-container {
        padding: 10px !important;
    }

    /* MODULE HEADER RESPONSIVE */
    .module-header {
        flex-direction: column !important;
        gap: 15px !important;
        padding: 10px !important;
    }

    .module-header .header-left,
    .module-header .header-right {
        width: 100% !important;
        gap: 10px !important;
        padding: 10px !important;
    }

    /* 1. Phần bên trái (Tabs / Title) */
    .module-header .header-left {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    /* 2. Phần bên phải (Search + Buttons) */
    .module-header .header-right {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        justify-content: space-between !important;
    }

    /* 3. Ô TÌM KIẾM - LUÔN ƯU TIÊN LÊN ĐẦU & FULL WIDTH */
    /* Selector này bao gồm cả ô tìm kiếm nằm trong header-left (cũ) và header-right (mới) */
    .module-header input[type="text"],
    .module-header .search-box,
    .module-header .grid-row.grid-2-1 {
        width: 100% !important;
        order: -1 !important;
        /* Lên đầu tiên */
        margin-bottom: 5px !important;
        display: flex !important;
    }

    /* Fix css cho ô tìm kiếm cũ đang nằm trong grid */
    .module-header .grid-row.grid-2-1 i {
        display: none !important;
        /* Ẩn icon cũ nếu lộn xộn */
    }

    .module-header .grid-row.grid-2-1 input {
        border-radius: 6px !important;
        margin: 0 !important;
    }

    /* 4. CÁC NÚT BẤM - TO RÕ & CO GIÃN HỢP LÝ */
    .tab-btn,
    .view-btn,
    .btn-primary,
    .btn-secondary {
        height: 40px !important;
        /* Chiều cao chuẩn dễ bấm */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 13px !important;
        white-space: nowrap !important;
        padding: 0 16px !important;
    }

    /* Các nhóm nút Toggle View */
    .view-toggle {
        display: inline-flex !important;
        background: #f1f3f5 !important;
        padding: 3px !important;
        border-radius: 8px !important;
        gap: 2px !important;
        align-items: center !important;
    }

    .view-toggle button {
        border: none !important;
        background: transparent !important;
        border-radius: 6px !important;
        cursor: pointer !important;
        font-weight: 500 !important;
        color: #666 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        height: 32px !important;
    }

    .view-toggle button.active {
        background: #fff !important;
        color: var(--primary-color) !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
        font-weight: 600 !important;
    }

    /* Tab Button (Có Text) - Giãn rộng */
    .view-toggle .tab-btn {
        padding: 0 20px !important;
        min-width: 90px !important;
        flex: 1 !important;
        /* Giãn đều nếu cần */
    }

    /* View Button (Icon) - Gọn gàng */
    .view-toggle .view-btn {
        padding: 0 10px !important;
        width: 36px !important;
        /* Cố định chiều rộng icon */
        flex: 0 0 auto !important;
        /* Không giãn */
    }

    /* 5. NHÓM CÔNG CỤ (TOOLS GROUP) */
    /* 5. NHÓM CÔNG CỤ (TOOLS GROUP) - FIX LẠI CHO ĐẸP */
    .tools-group {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        background: #fff !important;
        padding: 4px 8px !important;
        border-radius: 8px !important;
        border: 1px solid #eee !important;
        height: 40px !important;
        box-sizing: border-box !important;
        margin-bottom: 5px !important;
        /* Tách biệt với nút thêm mới */
    }

    /* View Toggle trong mobile */
    .tools-group .view-toggle {
        display: flex !important;
        background: #f3f4f6 !important;
        padding: 2px !important;
        border-radius: 6px !important;
        height: 32px !important;
        /* Nhỏ hơn container */
        align-items: center !important;
    }

    .tools-group .view-btn {
        height: 28px !important;
        padding: 0 10px !important;
        font-size: 12px !important;
    }

    /* Icon Buttons trong mobile */
    .tools-group .icon-btn,
    .tools-group label.icon-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
        border-radius: 6px !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .tools-group button,
    .tools-group label {
        flex: 0 0 auto !important;
    }

    /* Chỉnh lại header-left để chứa Search & Filter */
    .module-header .header-left {
        gap: 10px !important;
    }

    /* Search box luôn ở trên cùng trong header-left */
    .module-header .header-left .search-box {
        width: 100% !important;
        order: -1 !important;
    }

    /* Select filter full width */
    .module-header .header-left .filter-select {
        width: 100% !important;
        height: 40px !important;
    }

    /* Nút Thêm mới (Add Product) */
    #btn-add-product {
        width: 100% !important;
        /* Full width dòng cuối cùng */
        margin-top: 5px !important;
        justify-content: center !important;
    }

    /* FIX OVERFLOW CONTAINER */
    .main-content {
        overflow-x: hidden !important;
        /* Ngăn scroll ngang toàn trang */
        width: 100% !important;
    }

    .module-container {
        padding: 10px !important;
        /* Padding nhỏ hơn trên mobile */
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .module-content {
        width: 100% !important;
        overflow-x: hidden !important;
    }

    /* Card adjustments */
    .card {
        margin-bottom: 10px !important;
        padding: 12px !important;
    }
}


/* SUMMARY CARDS */
.summary-card {
    background: var(--bg-light);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

/* QUICK FILTER BUTTONS */
.btn-filter {
    background: #f8f9fa !important;
    border: 1px solid #e9ecef !important;
    padding: 6px 14px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    color: #495057 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.btn-filter:hover {
    background: #e2e6ea !important;
    color: #333 !important;
}

.btn-filter.active {
    background: var(--primary-color) !important;
    color: #fff !important;
    border-color: var(--primary-color) !important;
}

/* Date Range Inputs */
.date-range-group {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    background: #fff !important;
    padding: 4px !important;
    border-radius: 8px !important;
    border: 1px solid #eee !important;
}

.date-range-group input[type="date"] {
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
    height: 32px !important;
    font-size: 13px !important;
    color: #555 !important;
    width: 130px !important;
}

/* TABLE INPUT OPTIMIZATIONS */
.table-input th,
.table-input td {
    padding: 8px;
    vertical-align: middle;
}

.input-cell {
    height: 36px !important;
    padding: 4px 8px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
    margin: 0 !important;
}

/* SUMMARY SECTION RESPONSIVE */
.tx-summary-section {
    width: 100%;
}

.tx-fixed-summary {
    background: #fff;
    border-top: 1px solid #ddd;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

@media (max-width: 768px) {

    .table-input th,
    .table-input td {
        padding: 4px;
    }

    .input-cell {
        height: 32px !important;
        padding: 2px 5px !important;
        font-size: 12px !important;
    }

    .tx-summary-section {
        justify-content: center !important;
    }

    .summary-card {
        padding: 0 !important;
        width: 100% !important;
    }

    .tx-fixed-summary {
        padding: 10px 15px !important;
    }

    .summary-card span {
        font-size: 13px !important;
    }

    #tx-total,
    #tx-debt {
        font-size: 1.2rem !important;
    }
}

@media (max-width: 768px) {

    .table-input th,
    .table-input td {
        padding: 4px;
    }

    .input-cell {
        height: 32px !important;
        padding: 2px 5px !important;
        font-size: 12px !important;
    }

    .tx-summary-section {
        justify-content: center !important;
        /* Căn giữa trên mobile */
    }

    .summary-card {
        padding: 15px !important;
        /* Giảm padding trên mobile */
    }

    .summary-card span {
        font-size: 14px !important;
    }

    #tx-total,
    #tx-debt {
        font-size: 1.2rem !important;
    }
}

.date-range-group button {
    height: 32px !important;
    width: 32px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
}

@media (max-width: 768px) {
    .btn-filter {
        flex: 1 !important;
        text-align: center !important;
    }

    .date-range-group {
        width: 100% !important;
        justify-content: space-between !important;
    }

    .date-range-group input[type="date"] {
        width: 42% !important;
        /* Chia đôi trừ nút refresh */
    }
}

/* DASHBOARD REDESIGN COMPONENTS - PREMIUM FIX */
.stats-grid-6 {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    margin-bottom: 25px;
    width: 100%;
}

.stat-card-small {
    background: #ffffff;
    padding: 20px 15px;
    border-radius: 14px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid #eef0f7;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
    position: relative;
    overflow: hidden;
}

.stat-card-small::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    transition: all 0.3s ease;
}

.stat-card-small:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
    border-color: #d1d9ff;
}

.stat-card-small:hover::before {
    background: var(--primary-color);
}

.stat-card-small .stat-label {
    font-size: 11px;
    color: #8c98a5;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 5px;
    letter-spacing: 0.8px;
}

.stat-card-small .stat-value {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 2px;
    color: #2d3436;
}

.stat-card-small i {
    font-size: 24px;
    position: absolute;
    top: 20px;
    right: 15px;
    opacity: 0.15;
}

.dashboard-listbox {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid #f0f2f5;
    border-radius: 12px;
    padding: 10px;
    background: #fbfcfe;
}

.list-item-minimal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: #ffffff;
    margin-bottom: 8px;
    border-radius: 10px;
    border: 1px solid #edf0f5;
    font-size: 14px;
    transition: all 0.2s ease;
}

.list-item-minimal:hover {
    background: #f8faff;
    transform: translateX(5px);
    border-color: #e0e6ff;
}

.list-item-minimal:last-child {
    margin-bottom: 0;
}

.product-rank {
    width: 30px;
    height: 30px;
    background: #f1f3f9;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: #adb5bd;
    margin-right: 12px;
}

.product-rank.top-1 {
    background: #fff9db;
    color: #f08c00;
    box-shadow: inset 0 0 0 1px #ffec99;
}

.product-rank.top-2 {
    background: #e9ecef;
    color: #495057;
    box-shadow: inset 0 0 0 1px #dee2e6;
}

.product-rank.top-3 {
    background: #fff5f5;
    color: #fa5252;
    box-shadow: inset 0 0 0 1px #ffc9c9;
}

.text-profit {
    color: #0ca678 !important;
}

.text-receivable {
    color: #339af0 !important;
}

.text-payable {
    color: #fa5252 !important;
}

/* Responsive adjustments */
@media (max-width: 1600px) {
    .stats-grid-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .stats-grid-6 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .stats-grid-6 {
        grid-template-columns: 1fr;
    }
}

/* PREMIUM LOW STOCK ALERT UI */
.low-stock-alert-card {
    background: #fff;
    border-radius: 20px !important;
    box-shadow: 0 10px 40px rgba(220, 38, 38, 0.08) !important;
}

.alert-premium-header {
    background: #fffafa;
    padding: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ffebeb;
}

.alert-icon-circle {
    width: 60px;
    height: 60px;
    background: #fee2e2;
    color: #ef4444;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.btn-import-now {
    background: #ef4444;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 8px 15px rgba(239, 68, 68, 0.25);
    transition: all 0.3s ease;
}

.btn-import-now:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 20px rgba(239, 68, 68, 0.35);
}

.alert-premium-body {
    padding: 15px 25px 25px;
    max-height: 400px;
    overflow-y: auto;
}

/* Custom Scrollbar for Alert Body */
.alert-premium-body::-webkit-scrollbar {
    width: 6px;
}

.alert-premium-body::-webkit-scrollbar-track {
    background: #fffafa;
}

.alert-premium-body::-webkit-scrollbar-thumb {
    background: #fee2e2;
    border-radius: 10px;
}

.alert-premium-body::-webkit-scrollbar-thumb:hover {
    background: #fecaca;
}

.dashboard-listbox {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.dashboard-listbox::-webkit-scrollbar {
    width: 6px;
}

.dashboard-listbox::-webkit-scrollbar-thumb {
    background: #f1f5f9;
    border-radius: 10px;
}

.alert-premium-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid #f8fafc;
    transition: all 0.2s ease;
}

.alert-premium-item:last-child {
    border-bottom: none;
}

.alert-premium-item .item-index {
    width: 32px;
    height: 32px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
}

.alert-premium-item .item-name {
    font-weight: 700;
    color: #1e293b;
    font-size: 15px;
    margin-bottom: 2px;
}

.alert-premium-item .item-sku {
    font-size: 12px;
    color: #94a3b8;
    font-family: monospace;
}

.alert-premium-item .item-stock-status {
    color: #ef4444;
    font-weight: 800;
    font-size: 16px;
}

.alert-premium-item .item-min-level {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 600;
}

.chart-bar {
    transition: all 0.3s ease;
    cursor: pointer;
}

.chart-bar:hover {
    filter: brightness(1.2);
    transform: translateY(-2px);
}