/* Import font Roboto */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700&display=swap');

/* Reset font cho toàn bộ website */
* {
    font-family: 'Roboto', sans-serif;
}

/* Thêm vào phần đầu file, sau phần reset */
body {
    overflow-x: hidden; /* Ngăn scroll ngang khi menu mở */
}

/* Thêm nút toggle menu */
.menu-toggle {
    display: none; /* Ẩn mặc định trên desktop */
    position: fixed;
    top: 10px;
    right: 10px; /* Thay đổi từ left thành right */
    z-index: 1070;
    background: #2c3e50;
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.menu-toggle:hover {
    background: #3498db;
}

/* Sidebar styles */
.sidebar {
    min-height: 100vh;
    background: #2c3e50;
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    z-index: 1060;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    overflow-y: auto;
    font-family: 'Roboto', sans-serif;
    transition: transform 0.3s ease, visibility 0.3s ease;
    visibility: hidden;
}

/* Brand/Logo area */
.sidebar .navbar-brand {
    color: #ecf0f1;
    padding: 15px 20px;
    margin-bottom: 0;
    display: block;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    background: rgba(0,0,0,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Roboto', sans-serif;
}

/* Navigation menu */
.sidebar .nav {
    padding: 10px 0;
    margin-bottom: 60px; /* Để không bị user-info che */
}

/* Menu items */
.sidebar .nav-item {
    margin: 2px 0;
}

/* All menu links - đồng nhất font size và padding */
.sidebar .nav-link {
    color: #b8c7ce;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 400;
    font-family: 'Roboto', sans-serif;
    border: none;
    border-left: 3px solid transparent;
    border-radius: 0;
    white-space: nowrap;
    width: 100%;
}

/* Icons in menu */
.sidebar .nav-link i {
    width: 20px;
    margin-right: 10px;
    font-size: 14px;
    text-align: center;
    color: #8aa4af;
    transition: all 0.3s ease;
}

/* Hover effect */
.sidebar .nav-link:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
    border-left-color: #3498db;
}

.sidebar .nav-link:hover i {
    color: #3498db;
}

/* Active state */
.sidebar .nav-link.active {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
    border-left-color: #3498db;
}

.sidebar .nav-link.active i {
    color: #3498db;
}

/* Submenu */
.submenu {
    background: rgba(0,0,0,0.1);
    padding: 5px 0;
}

.submenu .nav-link {
    padding: 8px 20px 8px 53px; /* 53px = 20px + 20px(icon) + 13px */
    font-size: 14px;
    color: #b8c7ce;
}

/* Dropdown arrow */
.nav-link.dropdown-toggle::after {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.3s;
    opacity: 0.5;
}

.nav-link.dropdown-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

/* User info section */
.user-info {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 250px;
    background: rgba(0,0,0,0.2);
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.05);
    font-family: 'Roboto', sans-serif;
}

.user-info .fw-medium {
    color: #ecf0f1;
    font-size: 14px;
    font-weight: 500;
}

.user-info .small {
    color: #95a5a6;
    font-size: 12px;
    font-weight: 400;
}

/* Logout button */
.btn-outline-light {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    color: #b8c7ce;
    transition: all 0.3s ease;
    margin-top: 10px;
    font-size: 14px;
    padding: 8px 15px;
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
}

.btn-outline-light:hover {
    background: #3498db;
    border-color: #3498db;
    color: #fff;
}

/* Main content */
.main-content {
    margin-left: 250px;
    padding: 20px;
    background: #f5f6fa;
    min-height: 100vh;
    font-family: 'Roboto', sans-serif;
    transition: margin-left 0.3s ease;
}

/* Card styles */
.card {
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card-body {
    padding: 20px;
}

/* Dashboard stats */
.stats-card h2 {
    color: #0d6efd;
    font-size: 2.5rem;
    margin: 15px 0;
}

/* Utility classes */
.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

/* Table styles */
.table img {
    border-radius: 4px;
}

.table td {
    vertical-align: middle;
}

/* Button styles */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn-sm i {
    font-size: 0.75rem;
}

/* Form đơn hàng */
.order-form {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.order-form .section-title {
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 2px solid #3498db;
    margin-bottom: 20px;
}

/* Trường input chỉ đọc */
.form-control[readonly] {
    background-color: #f8f9fa;
    border-color: #e9ecef;
    cursor: not-allowed;
}

/* Danh sách sản phẩm */
.product-list {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    background: #f8f9fa;
}

.product-item {
    background: #fff;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Các trường tính toán */
.calculation-field {
    font-weight: 500;
    background-color: #e9ecef !important;
}

/* Nút thêm/xóa sản phẩm */
.btn-add-product {
    color: #3498db;
    border-color: #3498db;
}

.btn-add-product:hover {
    background-color: #3498db;
    color: #fff;
}

.btn-remove-product {
    padding: 4px 8px;
    border-radius: 4px;
}

/* Trường giảm giá */
.discount-input {
    position: relative;
}

.input-group .discount-type {
    min-width: 50px;
    width: 50px !important;
    flex: 0 0 auto;
    padding: 0.375rem 0.5rem;
}

.input-group .product-discount {
    border-right: 0;
}

/* Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

/* Responsive styles - Sửa lại hoàn toàn phần media queries */
@media (max-width: 768px) {
    /* Hiện nút toggle menu */
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .col-4 {
        width: 100%;
    }
    .product-list .text-muted {
        display: none;
    }
    .mb-sl, .mb-gia, .mb-giamgia, .mb-tensp {
        display: inline;
        align-items: center;
        gap: 5px;
    }
    .mb-4 .col {
        flex: 1 0 50%;
    }
    .mb-sl::before {
        content: "SL:";
        font-size: 14px;
        color: #6c757d;
        width: 50px;
    }
    .mb-gia::before {
        content: "Giá:";
        font-size: 14px;
        color: #6c757d;
        width: 50px;
    }
    .mb-giamgia::before {
        content: "Giảm:";
        font-size: 14px;
        color: #6c757d;
        width: 50px;
    }
    .mb-tensp::before {
        content: "Tên:";
        font-size: 14px;
        color: #6c757d;
        width: 50px;
    }
    

    /* Điều chỉnh sidebar */
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        position: fixed;
        z-index: 1050;
    }

    /* Khi sidebar được mở */
    .sidebar.show {
        transform: translateX(0);
    }

    /* Điều chỉnh main content */
    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    /* Overlay khi menu mở */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
    }

    .sidebar-overlay.show {
        display: block;
    }

    /* Điều chỉnh các bảng */
    .table-responsive {
        margin: 0 -20px;
        padding: 0 20px;
        width: calc(100% + 40px);
    }

    /* Điều chỉnh form và card */
    .card {
        margin: 0 -20px 20px;
        border-radius: 0;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    /* Điều chỉnh modal */
    .modal-dialog {
        margin: 0.5rem;
    }

    /* Điều chỉnh dropdown menu */
    .dropdown-menu {
        position: fixed !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        margin: 0;
        border-radius: 15px 15px 0 0;
        max-height: 80vh;
        transform: none !important;
    }

    /* Điều chỉnh các button group */
    .btn-group {
        display: flex;
        width: 100%;
    }

    .btn-group .btn {
        flex: 1;
    }

    /* Cải thiện form filter */
    .filter-form .row {
        margin: 0 -5px;
    }

    .filter-form .col-md-1,
    .filter-form .col-md-2,
    .filter-form .col-md-3 {
        padding: 0 5px;
        margin-bottom: 10px;
    }

    /* Cải thiện hiển thị bảng */
    .table {
        font-size: 13px;
    }

    .table td, .table th {
        padding: 0.5rem;
    }

    /* Thêm bottom navigation bar */
    .bottom-nav {
        display: block;
    }

    .main-content {
        padding-bottom: 70px; /* Tăng padding bottom để không bị che bởi bottom nav */
    }

    /* Ẩn các menu này trong sidebar trên mobile */
    .mobile-hidden {
        display: none;
    }
}

/* Animation cho menu */
@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes slideOut {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}

/* Thêm class animation */
.sidebar.sliding-in {
    animation: slideIn 0.3s forwards;
}

.sidebar.sliding-out {
    animation: slideOut 0.3s forwards;
}

/* Card titles */
.card-title {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
}

/* Table content */
.table {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
}

/* Form controls */
.form-control {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
}

/* Buttons */
.btn {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 400;
}

/* Thêm vào cuối file */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1050;
    display: none;
}

.search-results.show {
    display: block;
}

.product-search-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.product-search-item:hover {
    background-color: #f8f9fa;
}

.product-search-item .product-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.product-search-item .product-info {
    display: flex;
    gap: 10px;
    font-size: 0.85em;
    color: #6c757d;
}

.product-search-item .product-price {
    color: #dc3545;
    font-weight: 500;
}

.selected-product {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

.product-search-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.product-search-item:last-child {
    border-bottom: none;
}

.product-search-item:hover {
    background-color: #f8f9fa;
}

.product-search-item .product-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.product-search-item .product-info {
    display: flex;
    gap: 10px;
    font-size: 0.85em;
    color: #6c757d;
}

.product-search-item .product-price {
    color: #dc3545;
    font-weight: 500;
}

#product_search_results {
    position: absolute;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 5px;
    z-index: 1050;
    display: none;
}

#product_search_results.show {
    display: block;
}

/* Thêm vào cuối file */
.modal-product-search {
    position: relative;
}

.modal-product-search .dropdown-menu {
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
}

.batch-list {
    max-height: 400px;
    overflow-y: auto;
}

.store-group {
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.store-group .store-name {
    color: #0d6efd;
    margin-bottom: 1rem;
}

.batch-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.batch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.batch-info {
    font-size: 0.875rem;
    color: #6c757d;
}

.selected-batches {
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.batch-quantity-input {
    width: 100px;
}

.product-total {
    font-weight: bold;
    color: #198754;
}

/* Thêm transition cho mượt hơn */
.sidebar.show {
    visibility: visible;
    transform: translateX(0);
}

@media (min-width: 769px) {
    .sidebar {
        visibility: visible;
        transform: none;
    }
}

/* Bottom Navigation Bar */
.bottom-nav {
    display: none; /* Ẩn mặc định trên desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1060;
    padding: 8px 0 5px;
}

.bottom-nav-menu {
    display: flex;
    justify-content: space-around;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.bottom-nav-item {
    flex: 1;
    text-align: center;
}

.bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #6c757d;
    text-decoration: none;
    font-size: 12px;
    padding: 5px;
}

.bottom-nav-link i {
    font-size: 20px;
    margin-bottom: 3px;
}

.bottom-nav-link.active {
    color: #3498db;
}

/* Thêm hiệu ứng hover cho bottom nav */
.bottom-nav-link:hover {
    color: #3498db;
}

/* Thêm hiệu ứng active state rõ ràng hơn */
.bottom-nav-link.active {
    color: #3498db;
    position: relative;
}

.bottom-nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    background: #3498db;
    border-radius: 50%;
}

/* Hiển thị bottom nav trên mobile */
@media (max-width: 768px) {
    .bottom-nav {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
        padding-bottom: 70px; /* Tăng padding bottom để không bị che bởi bottom nav */
    }

    /* Ẩn các menu này trong sidebar trên mobile */
    .mobile-hidden {
        display: none;
    }
}

/* Style cho toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1060;
}

/* Tùy chỉnh style cho Toastr */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1060;
}

#toast-container .toast {
    opacity: 1;
    margin-bottom: 10px;
}

#toast-container > div {
    opacity: 1;
    margin-bottom: 10px;
    padding: 15px 15px 15px 50px;
    width: 300px;
}

.toast-success {
    background-color: #51A351;
}

.toast-error {
    background-color: #BD362F;
}

.toast-info {
    background-color: #2F96B4;
}

.toast-warning {
    background-color: #F89406;
}