/* ============================================
   FONT - Hỗ trợ tiếng Việt tốt
   ============================================ */
/* Body text - Roboto: hỗ trợ tiếng Việt tốt, dễ đọc */
body {
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 400;
    padding-top: 76px;
    background: #f8f9fa;
    min-height: 100vh;
    line-height: 1.7;
    color: #2c3e50;
}

/* Headings - Nunito: thân thiện, hỗ trợ tiếng Việt */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: 'Nunito', 'Roboto', sans-serif;
    font-weight: 700;
    line-height: 1.4;
    color: #1a252f;
}

h1, .h1 {
    font-weight: 700;
    font-size: 2.25rem;
}

h2, .h2 {
    font-weight: 700;
    font-size: 1.875rem;
}

h3, .h3 {
    font-weight: 600;
    font-size: 1.5rem;
}

/* Navbar - Màu đỏ chủ đạo */
.custom-navbar {
    background: var(--primary-red) !important;
    box-shadow: 0 4px 20px rgba(220, 53, 69, 0.3);
    padding: 0.75rem 0;
    border-bottom: 3px solid var(--primary-red-dark);
}

.navbar-brand {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.nav-link {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    margin: 0 0.25rem;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

/* Cards - Cải thiện giao diện */
.card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    background: #ffffff;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.card-header {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    background: var(--primary-red);
    color: white;
    border: none;
    padding: 1.25rem 1.5rem;
    border-bottom: 3px solid var(--primary-red-dark);
}

.card-title,
.card-header h5,
.card-header h6 {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    color: #1a252f;
}

.card-body {
    padding: 1.5rem;
}

/* Buttons - Cải thiện */
.btn {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    border-radius: 10px;
    padding: 0.65rem 1.5rem;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: var(--primary-red);
    border-color: var(--primary-red);
}

.btn-primary:hover {
    background: var(--primary-red-dark);
    border-color: var(--primary-red-dark);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.btn-success {
    background: #28a745;
    border-color: #28a745;
}

.btn-success:hover {
    background: #218838;
    border-color: #1e7e34;
}

.btn-danger {
    background: #ff6b6b;
    border-color: #ff6b6b;
}

.btn-danger:hover {
    background: #ff5252;
    border-color: #ff5252;
}

.btn-warning {
    background: #ffa726;
    border-color: #ffa726;
    color: #fff;
}

.btn-warning:hover {
    background: #ff9800;
    border-color: #ff9800;
    color: #fff;
}

.btn-info {
    background: #17a2b8;
    border-color: #17a2b8;
}

.btn-info:hover {
    background: #138496;
    border-color: #117a8b;
}

.btn-outline-primary {
    border: 2px solid var(--primary-red);
    color: var(--primary-red);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-red);
    color: white;
    border-color: var(--primary-red);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Tables */
.table {
    font-family: 'Roboto', sans-serif;
}

.table th {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary-red);
    border-bottom: 3px solid var(--primary-red);
    padding: 1rem;
    background-color: var(--light-red-bg);
}

.table td {
    padding: 1rem;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: var(--light-red-bg);
    transform: scale(1.01);
    transition: all 0.2s ease;
    border-left: 3px solid var(--primary-red);
}

/* Forms */
.form-control,
.form-select {
    font-family: 'Roboto', sans-serif;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-red);
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.2);
    transform: translateY(-2px);
    border-width: 2px;
}

.form-label {
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

/* Badges */
.badge {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

/* Alerts */
.alert {
    font-family: 'Roboto', sans-serif;
    border-radius: 12px;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1rem 1.5rem;
}

/* Modal */
.modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
}

.modal-body {
    font-family: 'Roboto', sans-serif;
}

/* Mobile card layout */
.table-card-header h6 {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
}

.table-card-label {
    font-family: 'Roboto', sans-serif;
    font-weight: 600;
}

.table-card-value {
    font-family: 'Roboto', sans-serif;
}

/* Footer */
footer {
    font-family: 'Roboto', sans-serif;
    background: #2c3e50;
    color: white;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* Other elements */
strong, b {
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
}

.list-group-item {
    font-family: 'Roboto', sans-serif;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border: 1px solid #e0e0e0;
}

.nav-tabs .nav-link {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    border-radius: 10px 10px 0 0;
}

.nav-tabs .nav-link.active {
    background: var(--primary-red);
    color: white;
    border-color: var(--primary-red);
    border-bottom: 3px solid var(--accent-orange);
}

.progress {
    font-family: 'Roboto', sans-serif;
    border-radius: 10px;
    height: 10px;
}

.progress-bar {
    background: var(--primary-red);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.pagination {
    font-family: 'Roboto', sans-serif;
}

.breadcrumb {
    font-family: 'Roboto', sans-serif;
}

.input-group-text {
    font-family: 'Roboto', sans-serif;
    background: #f8f9fa;
    border-radius: 10px 0 0 10px;
}

small, .small {
    font-family: 'Roboto', sans-serif;
}

code, pre, kbd, samp {
    font-family: 'Courier New', Courier, monospace;
}

/* Tối ưu cho mobile */
@media (max-width: 768px) {
    body {
        padding-top: 70px;
        font-size: 14px;
    }
    
    /* Navbar mobile */
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-nav {
        padding: 0.5rem 0;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .navbar-nav .nav-link:last-child {
        border-bottom: none;
    }
    
    .navbar-nav .nav-link i {
        width: 24px;
        margin-right: 0.5rem;
    }
    
    /* Dropdown menu mobile */
    .dropdown-menu {
        border: none;
        box-shadow: none;
        background-color: rgba(0, 0, 0, 0.1);
    }
    
    .dropdown-item {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }
    
    /* Cards mobile */
    .card {
        margin-bottom: 1rem;
        border-radius: 16px;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Buttons mobile */
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
        border-radius: 8px;
        min-height: 44px; /* Touch target size */
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        min-height: 48px;
    }
    
    .btn-sm {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
        min-height: 36px;
    }
    
    /* Tables mobile - will be replaced by card layout */
    .table-responsive {
        border-radius: 8px;
        overflow-x: visible;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.6rem 0.5rem;
        word-wrap: break-word;
    }
    
    /* Table borderless on mobile - stack layout */
    .table-borderless {
        width: 100%;
    }
    
    .table-borderless tr {
        display: block;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid #e9ecef;
    }
    
    .table-borderless tr:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }
    
    .table-borderless th.d-none,
    .table-borderless td.d-md-none {
        display: block;
        width: 100%;
        font-weight: 600;
        color: #495057;
        margin-bottom: 0.25rem;
        padding: 0;
    }
    
    .table-borderless th:not(.d-none),
    .table-borderless td:not(.d-md-none) {
        display: block;
        width: 100%;
        padding: 0.25rem 0;
        border: none;
    }
    
    .table-borderless th:not(.d-none) {
        font-weight: 600;
        color: #495057;
        margin-bottom: 0.25rem;
    }
    
    /* Forms mobile */
    .form-control,
    .form-select {
        padding: 0.75rem;
        font-size: 1rem;
        border-radius: 8px;
        min-height: 44px; /* Touch target */
    }
    
    .form-label {
        font-size: 0.95rem;
        font-weight: 500;
        margin-bottom: 0.5rem;
    }
    
    /* Headings mobile */
    h1 {
        font-size: 1.75rem;
        font-weight: 600;
    }
    
    h2 {
        font-size: 1.5rem;
        font-weight: 600;
    }
    
    h3 {
        font-size: 1.25rem;
        font-weight: 600;
    }
    
    h4, h5 {
        font-size: 1.1rem;
        font-weight: 600;
    }
    
    /* Badges mobile */
    .badge {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        font-weight: 500;
    }
    
    /* Alerts mobile */
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        border-radius: 8px;
    }
    
    /* Modal mobile */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-content {
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }
    
    .modal-footer {
        padding: 0.75rem 1rem;
    }
    
    /* Container padding mobile */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Spacing mobile */
    .mb-4 {
        margin-bottom: 1.5rem !important;
    }
    
    .mt-4 {
        margin-top: 1.5rem !important;
    }
    
    /* List groups mobile */
    .list-group-item {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Nav tabs mobile */
    .nav-tabs .nav-link {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    
    /* Cards grid mobile */
    .row > [class*='col-'] {
        margin-bottom: 1rem;
    }
}

/* Tối ưu cho tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    body {
        font-size: 15px;
    }
    
    .btn {
        min-height: 42px;
    }
    
    .form-control,
    .form-select {
        min-height: 42px;
    }
}

/* Desktop - giữ nguyên nhưng dùng font Comfortaa */
@media (min-width: 1025px) {
    body {
        font-size: 16px;
    }
}

/* Font weights đã được định nghĩa ở trên với font families cụ thể */

/* Smooth transitions */
.nav-link,
.btn,
.dropdown-item {
    transition: all 0.2s ease;
}

/* Better touch targets for mobile */
@media (max-width: 768px) {
    a, button, input, select, textarea {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    /* Increase spacing between clickable elements */
    .btn + .btn {
        margin-left: 0.5rem;
    }
    
    /* Better form spacing */
    .mb-3 {
        margin-bottom: 1.25rem !important;
    }
}

/* Fixed navbar shadow - đã được định nghĩa trong .custom-navbar */

/* Custom scrollbar for mobile */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
    
    ::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    
    ::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 3px;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: #555;
    }
}

/* QR Scanner mobile optimization */
@media (max-width: 768px) {
    #video {
        width: 100% !important;
        max-width: 100% !important;
        height: auto;
    }
    
    #scanner-container {
        padding: 0.5rem;
    }
}

/* Table responsive improvements - Mobile Card Layout */
@media (max-width: 768px) {
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        overflow-x: visible;
    }
    
    /* Mobile Card Layout Styles */
    .table-mobile-card {
        display: block;
    }
    
    .table-mobile-card .table-card {
        background: white;
        border: 1px solid #e0e0e0;
        border-radius: 16px;
        padding: 1.25rem;
        margin-bottom: 1rem;
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);
        transition: all 0.3s ease;
    }
    
    .table-mobile-card .table-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    }
    
    .table-mobile-card .table-card-header {
        border-bottom: 2px solid #e9ecef;
        padding-bottom: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .table-mobile-card .table-card-header h6 {
        font-size: 0.95rem;
        font-weight: 600;
        color: #212529;
    }
    
    .table-mobile-card .table-card-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .table-mobile-card .table-card-row:last-of-type {
        border-bottom: none;
    }
    
    .table-mobile-card .table-card-label {
        font-weight: 600;
        color: #495057;
        flex: 0 0 40%;
        font-size: 0.85rem;
        display: flex;
        align-items: center;
        gap: 0.25rem;
    }
    
    .table-mobile-card .table-card-value {
        flex: 1;
        text-align: right;
        font-size: 0.85rem;
        word-break: break-word;
    }
    
    .table-mobile-card .table-card-value a {
        text-decoration: none;
    }
    
    .table-mobile-card .table-card-actions {
        display: flex;
        gap: 0.5rem;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid #e9ecef;
    }
    
    .table-mobile-card .table-card-actions .btn {
        flex: 1;
        min-width: 0;
    }
    
    /* Hide desktop table on mobile */
    .table-responsive .table {
        display: none !important;
    }
    
    /* Show mobile card view */
    .table-responsive .table-mobile-card {
        display: block !important;
    }
}

/* Desktop - show table, hide mobile cards */
@media (min-width: 769px) {
    .table-responsive .table {
        display: table !important;
    }
    
    .table-responsive .table-mobile-card {
        display: none !important;
    }
}

/* ============================================
   COLOR PALETTE - Màu đỏ chủ đạo với màu phối hợp
   ============================================ */
:root {
    --primary-red: #dc3545;
    --primary-red-dark: #c82333;
    --primary-red-light: #ff6b6b;
    --accent-orange: #ffa726;
    --accent-orange-dark: #ff9800;
    --accent-coral: #ff7675;
    --success-green: #28a745;
    --info-blue: #17a2b8;
    --warning-orange: #ffa726;
    --danger-red: #ff6b6b;
    --light-red-bg: #fff5f5;
    --dark-gray: #2c3e50;
    --medium-gray: #6c757d;
    --light-gray: #f8f9fa;
}

/* ============================================
   ADDITIONAL UI IMPROVEMENTS
   ============================================ */

/* Container improvements */
.container {
    max-width: 1200px;
}

/* Card variations */
.card.bg-primary,
.card.bg-success,
.card.bg-warning,
.card.bg-info {
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Statistics cards */
.card.text-white {
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card.text-white:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.card.text-white.bg-success {
    background: var(--success-green) !important;
    border-left: 4px solid #34ce57;
}

.card.text-white.bg-warning {
    background: var(--accent-orange) !important;
    border-left: 4px solid var(--accent-orange-dark);
}

.card.text-white.bg-info {
    background: var(--info-blue) !important;
    border-left: 4px solid #20c997;
}

.card.text-white.bg-primary {
    background: var(--primary-red) !important;
    border-left: 4px solid var(--accent-orange);
}

.card.text-white.bg-danger {
    background: var(--danger-red) !important;
    border-left: 4px solid var(--accent-coral);
}

/* Dropdown improvements */
.dropdown-menu {
    border-radius: 12px;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.dropdown-item {
    border-radius: 8px;
    padding: 0.65rem 1rem;
    transition: all 0.2s ease;
    font-family: 'Roboto', sans-serif;
}

.dropdown-item:hover {
    background: var(--primary-red);
    color: white;
    transform: translateX(5px);
    border-left: 3px solid var(--accent-orange);
}

/* Table improvements */
.table-responsive {
    border-radius: 16px;
    overflow: hidden;
}

/* Form improvements */
.form-check-input:checked {
    background-color: #dc3545;
    border-color: #dc3545;
}

.form-check-input:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* List group improvements */
.list-group-item {
    transition: all 0.2s ease;
}

.list-group-item:hover {
    background-color: var(--light-red-bg);
    transform: translateX(5px);
    border-left: 3px solid var(--primary-red);
}

/* Nav tabs improvements */
.nav-tabs {
    border-bottom: 2px solid #e0e0e0;
}

.nav-tabs .nav-link {
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover:not(.active) {
    background-color: var(--light-red-bg);
    border-color: #e0e0e0 #e0e0e0 #e0e0e0;
    color: var(--primary-red);
    border-bottom: 2px solid var(--primary-red-light);
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Selection color */
::selection {
    background: var(--primary-red);
    color: white;
}

::-moz-selection {
    background: var(--primary-red);
    color: white;
}

/* Link colors */
a {
    color: var(--primary-red);
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-red-dark);
}

/* Badge colors */
.badge.bg-primary {
    background-color: var(--primary-red) !important;
}

.badge.bg-danger {
    background-color: var(--danger-red) !important;
}

.badge.bg-warning {
    background-color: var(--accent-orange) !important;
}

/* Alert colors */
.alert-primary {
    background-color: var(--light-red-bg);
    border-color: var(--primary-red);
    color: var(--primary-red-dark);
    border-left: 4px solid var(--primary-red);
}

.alert-danger {
    background-color: #ffe5e5;
    border-color: var(--danger-red);
    color: #c92a3d;
    border-left: 4px solid var(--danger-red);
}

/* Loading animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card,
.alert {
    animation: fadeIn 0.5s ease-out;
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .modal {
        display: none !important;
    }
    
    body {
        padding-top: 0;
        background: white;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
