/* Reset và cơ bản */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f7fa;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.admin-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.admin-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.logo i {
    margin-right: 10px;
    font-size: 1.8rem;
}

.admin-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.back-btn, .logout-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 0.9rem;
}

.back-btn:hover, .logout-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

/* Main Content */
.admin-main {
    padding: 30px 0;
    min-height: calc(100vh - 80px);
}

/* Dashboard Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.stat-info h3 {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.stat-info p {
    color: #666;
    font-size: 0.9rem;
}

/* Management Section */
.management-section {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    overflow: hidden;
}

.section-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: bold;
}

.add-user-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.add-user-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

/* Search and Filter */
.search-filter {
    padding: 25px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
}

.search-box input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.filter-options select {
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.filter-options select:focus {
    outline: none;
    border-color: #667eea;
}

/* Table */
.table-container {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th {
    background: #f8f9fa;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e9ecef;
    white-space: nowrap;
}

.users-table td {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.users-table tbody tr:hover {
    background: #f8f9fa;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-edit, .btn-delete {
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-edit {
    background: #17a2b8;
    color: white;
}

.btn-edit:hover {
    background: #138496;
    transform: translateY(-1px);
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.delete-modal {
    max-width: 400px;
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.close:hover {
    transform: scale(1.2);
}

.modal-body {
    padding: 30px;
}

/* Form */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.cancel-btn, .save-btn, .delete-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cancel-btn {
    background: #6c757d;
    color: white;
}

.cancel-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.save-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.delete-btn {
    background: #dc3545;
    color: white;
}

.delete-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.user-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #667eea;
}

.user-info p {
    margin: 5px 0;
    font-size: 0.9rem;
}

.user-info strong {
    color: #333;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .admin-header .container {
        flex-direction: column;
        gap: 15px;
    }
    
    .admin-nav {
        width: 100%;
        justify-content: space-between;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .search-filter {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-box {
        min-width: auto;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .modal-content {
        margin: 2% auto;
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .users-table {
        font-size: 0.8rem;
    }
    
    .users-table th,
    .users-table td {
        padding: 10px 8px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 5px;
    }
}

@media (max-width: 480px) {
    .admin-main {
        padding: 20px 0;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .stat-info h3 {
        font-size: 1.5rem;
    }
    
    .section-header {
        padding: 20px;
    }
    
    .section-header h2 {
        font-size: 1.3rem;
    }
    
    .add-user-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
    
    .search-filter {
        padding: 20px;
    }
    
    .users-table th,
    .users-table td {
        padding: 8px 5px;
        font-size: 0.75rem;
    }
    
    .btn-edit, .btn-delete {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
    
    .modal-content {
        margin: 1% auto;
        width: 98%;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .form-group input,
    .form-group select {
        padding: 10px;
        font-size: 16px; /* Ngăn zoom trên iOS */
    }
    
    .cancel-btn, .save-btn, .delete-btn {
        padding: 10px 20px;
        font-size: 0.8rem;
    }
}

/* Admin Tabs */
.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: white;
    border-radius: 15px;
    padding: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.admin-tab-btn {
    flex: 1;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    color: #666;
    padding: 15px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
}

.admin-tab-btn:hover {
    background: #e8f5e8;
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
}

.admin-tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Product Management */
.product-subsection {
    margin-bottom: 30px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.subsection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.subsection-header h3 {
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
}

.add-category-btn, .add-product-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 0.9rem;
}

.add-category-btn:hover, .add-product-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Categories Hierarchy */
.categories-hierarchy {
    background: white;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.category-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    position: relative;
}

.category-item:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    border-color: #667eea;
}

.category-content {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.category-content:hover {
    background-color: #f8f9fa;
}

.category-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.category-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.category-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    color: white;
}

.category-name {
    font-weight: 600;
    color: #333;
    font-size: 1.1rem;
}

.category-level {
    background: #f8f9fa;
    color: #666;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.category-actions {
    display: flex;
    gap: 8px;
}

.category-edit, .category-delete, .category-move {
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.category-edit {
    background: #17a2b8;
    color: white;
}

.category-edit:hover {
    background: #138496;
    transform: scale(1.1);
}

.category-delete {
    background: #dc3545;
    color: white;
}

.category-delete:hover {
    background: #c82333;
    transform: scale(1.1);
}

.category-move {
    background: #6c757d;
    color: white;
}

.category-move:hover {
    background: #5a6268;
    transform: scale(1.1);
}

.category-description {
    padding: 0 20px 15px 75px;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
    border-top: 1px solid #f0f0f0;
    margin-top: 10px;
    padding-top: 10px;
}

/* Category indentation for hierarchy */
.category-item[style*="margin-left: 20px"] {
    border-left: 3px solid #667eea;
    background: #f8f9fa;
}

.category-item[style*="margin-left: 40px"] {
    border-left: 3px solid #28a745;
    background: #f0f8f0;
}

.category-item[style*="margin-left: 60px"] {
    border-left: 3px solid #ffc107;
    background: #fffbf0;
}

/* Sort mode */
.categories-hierarchy.sort-mode .category-item {
    cursor: move;
    border: 2px dashed #667eea;
}

.categories-hierarchy.sort-mode .category-item:hover {
    border-color: #28a745;
    background: #f0f8f0;
}

.categories-hierarchy.sort-mode .category-actions {
    display: none;
}

/* Sort controls */
.sort-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.sort-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.sort-btn.active {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.sort-btn i {
    font-size: 1rem;
}

.category-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.category-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.category-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.category-description {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 15px;
}

.category-actions {
    display: flex;
    gap: 8px;
    position: absolute;
    top: 15px;
    right: 15px;
}

.category-edit, .category-delete {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.category-edit {
    background: #17a2b8;
    color: white;
}

.category-edit:hover {
    background: #138496;
    transform: scale(1.1);
}

.category-delete {
    background: #dc3545;
    color: white;
}

.category-delete:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* Products Table */
.products-table {
    width: 100%;
    border-collapse: collapse;
}

.products-table th {
    background: #f8f9fa;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e9ecef;
    white-space: nowrap;
}

.products-table td {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.products-table tbody tr:hover {
    background: #f8f9fa;
}

.product-image {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.product-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.cost-price {
    font-weight: 600;
    color: #dc3545;
    font-size: 1rem;
}

.sell-price {
    font-weight: 600;
    color: #28a745;
    font-size: 1rem;
}

.profit-info {
    text-align: center;
}

.profit-amount {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 2px;
}

.profit-amount.positive {
    color: #28a745;
}

.profit-amount.negative {
    color: #dc3545;
}

.profit-percentage {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 500;
}

.product-description {
    color: #666;
    font-size: 0.9rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Large Modal */
.large-modal {
    max-width: 800px;
}

/* Form Enhancements */
textarea {
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* Sales Management */
.sales-stats {
    display: flex;
    gap: 30px;
    margin-top: 10px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    min-width: 120px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
}

/* Time Filter */
.time-filter {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.filter-group label {
    font-weight: 600;
    color: #333;
    min-width: 150px;
}

.filter-group select {
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
    min-width: 200px;
}

.filter-group select:focus {
    outline: none;
    border-color: #667eea;
}

.custom-date-range {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.date-inputs {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.date-inputs input[type="date"] {
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.date-inputs input[type="date"]:focus {
    outline: none;
    border-color: #667eea;
}

.date-inputs span {
    color: #666;
    font-weight: 500;
}

.apply-filter-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.apply-filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* Orders Table */
.orders-table {
    width: 100%;
    border-collapse: collapse;
}

.orders-table th {
    background: #f8f9fa;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e9ecef;
    white-space: nowrap;
}

.orders-table td {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.orders-table tbody tr:hover {
    background: #f8f9fa;
}

.order-id {
    font-weight: 600;
    color: #667eea;
    font-family: monospace;
}

.customer-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.customer-name {
    font-weight: 600;
    color: #333;
}

.customer-phone {
    color: #666;
    font-size: 0.9rem;
}

.order-items {
    max-width: 200px;
}

.order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f0;
}

.order-item:last-child {
    border-bottom: none;
}

.item-name {
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

.item-quantity {
    color: #666;
    font-size: 0.8rem;
    background: #f8f9fa;
    padding: 2px 8px;
    border-radius: 12px;
}

.order-total {
    font-weight: 600;
    color: #28a745;
    font-size: 1.1rem;
}

.order-date {
    color: #666;
    font-size: 0.9rem;
}

/* Order Status Badges */
.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-processing {
    background: #d1ecf1;
    color: #0c5460;
}

.status-shipped {
    background: #cce5ff;
    color: #004085;
}

.status-delivered {
    background: #d4edda;
    color: #155724;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* Order Modal */
.order-info {
    max-height: 70vh;
    overflow-y: auto;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.order-id, .order-date {
    font-weight: 600;
    color: #333;
}

.customer-info, .order-items, .order-summary, .order-status {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.customer-info h4, .order-items h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
}

.items-list {
    max-height: 200px;
    overflow-y: auto;
}

.order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 5px;
    margin-bottom: 8px;
    border: 1px solid #e9ecef;
}

.order-item:last-child {
    margin-bottom: 0;
}

.item-details {
    flex: 1;
}

.item-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 3px;
}

.item-price {
    color: #666;
    font-size: 0.9rem;
}

.item-quantity {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.order-summary {
    background: #e8f5e8;
    border: 2px solid #28a745;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 1rem;
}

.summary-row.total {
    font-weight: bold;
    font-size: 1.2rem;
    color: #28a745;
    border-top: 2px solid #28a745;
    padding-top: 10px;
    margin-top: 10px;
}

/* Touch-friendly improvements */
@media (max-width: 768px) {
    .back-btn, .logout-btn, .add-user-btn, .btn-edit, .btn-delete, .cancel-btn, .save-btn, .delete-btn, .add-category-btn, .add-product-btn, .category-edit, .category-delete {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .search-box input, .filter-options select {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .modal-content {
        -webkit-overflow-scrolling: touch;
    }
    
    input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"] {
        font-size: 16px;
    }
    
    .admin-tabs {
        flex-direction: column;
        gap: 8px;
    }
    
    .admin-tab-btn {
        padding: 12px 15px;
        font-size: 0.8rem;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .category-card {
        padding: 15px;
    }
    
    .subsection-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .products-table {
        font-size: 0.8rem;
    }
    
    .products-table th,
    .products-table td {
        padding: 10px 8px;
    }
    
    .product-description {
        max-width: 150px;
    }
    
    .large-modal {
        max-width: 95%;
    }
    
    .sales-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .stat-item {
        min-width: auto;
        width: 100%;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .filter-group label {
        min-width: auto;
    }
    
    .filter-group select {
        min-width: auto;
        width: 100%;
    }
    
    .date-inputs {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .date-inputs input[type="date"] {
        width: 100%;
    }
    
    .orders-table {
        font-size: 0.8rem;
    }
    
    .orders-table th,
    .orders-table td {
        padding: 8px 5px;
    }
    
    .order-items {
        max-width: 150px;
    }
    
    .order-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}

/* System Management */
.system-stats {
    display: flex;
    gap: 30px;
    margin-top: 10px;
}

.system-subsection {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
}

.subsection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.subsection-header h3 {
    color: #333;
    font-size: 1.3rem;
    margin: 0;
}

.test-connection-btn, .refresh-settings-btn, .clear-logs-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.test-connection-btn:hover, .refresh-settings-btn:hover, .clear-logs-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

.config-form {
    background: white;
    padding: 25px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.setting-item {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.setting-item:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.setting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.setting-name {
    font-weight: 600;
    color: #333;
    font-size: 1.1rem;
}

.setting-type {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.setting-description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.setting-value {
    width: 100%;
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.setting-value:focus {
    outline: none;
    border-color: #667eea;
}

.log-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.log-controls select {
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    background: white;
    cursor: pointer;
}

.logs-container {
    background: #1e1e1e;
    border-radius: 8px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
}

.logs-list {
    color: #f8f9fa;
}

.log-entry {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 0;
    border-bottom: 1px solid #333;
    font-size: 0.9rem;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-time {
    color: #6c757d;
    min-width: 120px;
}

.log-level {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.8rem;
    min-width: 60px;
    text-align: center;
}

.log-level.info {
    background: #17a2b8;
    color: white;
}

.log-level.warning {
    background: #ffc107;
    color: #212529;
}

.log-level.error {
    background: #dc3545;
    color: white;
}

.log-message {
    flex: 1;
    color: #f8f9fa;
}

.db-operations {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.operation-group {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.operation-group h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.operation-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.operation-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.operation-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.backup-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.restore-btn {
    background: linear-gradient(135deg, #fd7e14 0%, #e83e8c 100%);
}

.optimize-btn {
    background: linear-gradient(135deg, #17a2b8 0%, #6f42c1 100%);
}

.repair-btn {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
}

.restore-warning {
    background: #fff3cd;
    border: 2px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.restore-warning i {
    color: #856404;
    font-size: 1.2rem;
}

.restore-warning p {
    margin: 0;
    color: #856404;
    font-weight: 500;
}

/* Status indicators */
.status-connected {
    color: #28a745;
    font-weight: 600;
}

.status-disconnected {
    color: #dc3545;
    font-weight: 600;
}

.status-connecting {
    color: #ffc107;
    font-weight: 600;
}

/* Responsive for system management */
@media (max-width: 768px) {
    .system-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .stat-item {
        min-width: auto;
        width: 100%;
    }
    
    .subsection-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .db-operations {
        grid-template-columns: 1fr;
    }
    
    .log-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .logs-container {
        max-height: 300px;
    }
    
    .operation-buttons {
        gap: 8px;
    }
    
    .operation-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}

/* Agents Management */
.agents-table {
    width: 100%;
    border-collapse: collapse;
}

.agents-table th {
    background: #f8f9fa;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e9ecef;
    white-space: nowrap;
}

.agents-table td {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.agents-table tbody tr:hover {
    background: #f8f9fa;
}

.agent-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 3px;
}

.business-name {
    font-weight: 500;
    color: #667eea;
    font-size: 0.9rem;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.contact-person {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.phone-number {
    font-weight: 500;
    color: #333;
    font-family: monospace;
    font-size: 0.9rem;
}

.email {
    color: #666;
    font-size: 0.8rem;
}

.zalo {
    color: #0068ff;
    font-size: 0.8rem;
    font-weight: 500;
}

.telegram {
    color: #0088cc;
    font-size: 0.8rem;
    font-weight: 500;
}

.address {
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 3px;
}

.location {
    color: #666;
    font-size: 0.8rem;
}

.commission-rate {
    font-weight: 600;
    color: #28a745;
    font-size: 1rem;
}

.status-suspended {
    background: #fff3cd;
    color: #856404;
}

.add-agent-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.add-agent-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.edit-btn, .delete-btn {
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.edit-btn {
    background: #17a2b8;
    color: white;
}

.edit-btn:hover {
    background: #138496;
    transform: scale(1.1);
}

.delete-btn {
    background: #dc3545;
    color: white;
}

.delete-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* Responsive for agents table */
@media (max-width: 768px) {
    .agents-table {
        font-size: 0.8rem;
    }
    
    .agents-table th,
    .agents-table td {
        padding: 10px 8px;
    }
    
    .agent-name, .business-name {
        font-size: 0.9rem;
    }
    
    .address, .location {
        font-size: 0.75rem;
    }
    
    .commission-rate {
        font-size: 0.9rem;
    }
    
    .edit-btn, .delete-btn {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
}

.username {
    color: #6c757d; /* Gray color */
    font-size: 0.8rem;
    font-weight: 500;
}

.banking-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.bank-name {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.bank-account {
    font-weight: 500;
    color: #333;
    font-family: monospace;
    font-size: 0.9rem;
}

.bank-holder {
    color: #666;
    font-size: 0.8rem;
}

.qr-code {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: #666;
}

.qr-code img {
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.qr-code img:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border-color: #667eea;
}

/* QR Modal styles */
#qrModal .modal-content {
    background: white;
    border-radius: 15px;
    overflow: hidden;
}

#qrModal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#qrModal .modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

#qrModal .modal-body {
    padding: 20px;
    background: #f8f9fa;
}

#qrModal img {
    border: 2px solid #e9ecef;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
