/* app.css - Global Styles and Variables */
* {
    box-sizing: border-box; /* Đảm bảo padding và border được tính vào width/height */
}

/* --- Base Body and HTML Styles --- */
:root {
    --primary-color: #007bff; /* Màu chủ đạo */
    --secondary-color: #6c757d; /* Màu chữ phụ */
    --light-color: #d9ecee; /* Đã điều chỉnh để có độ tương phản tốt hơn */
    --border-color: #dee2e6; /* Màu đường viền */
    --background-color: #f8f9fa; /* Màu nền nhẹ */
    --main-color: #f0f1f2;
    --header-height: 60px;
    --footer-height: 60px;
    --header-background-color: #007000;   
    --footer-background-color: #006789;
    --sidebar-width-desktop: 250px;
    --font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --modal-background: rgba(0, 0, 0, 0.6);
    --modal-content-bg: #fff;
    --modal-header-footer-bg: #7f8f9f;
    --modal-border-color: #dee2e6;
    --modal-text-color: #f1f2f3;
    --modal-title-color: #a1b2c3;
    --modal-close-color: #000;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --btn-action-color: green;
    --text-dark: #333;
    --text-light: #fff;
    --spacing-xs: 8px;
    --transition-duration: 0.3s;

    --radius-sm: 5px;
    --radius-md: 8px;

    --spacing-sm: 10px;
    --spacing-md: 20px;
    --transition-duration: 0.2s;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    background-color: var(--background-color); /* Sử dụng biến màu nền */
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body.no-scroll {
    overflow: hidden;
}

/* =================================================================== */
/* --- Main Content Layout --- */
/* =================================================================== */
.main-content {
    flex-grow: 1;
    padding: auto;
    margin: auto;
    width: calc(100% - var(--sidebar-width-desktop));
    transition: margin-left 0.3s ease-in-out;
    padding-top: calc(var(--header-height) + 20px);
    padding-bottom: var(--footer-height);
}

/* Sửa đổi để hiệu ứng transition hoạt động */
.main-section {
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
    position: relative; /* Dùng relative để tab-pane nằm trong luồng */
    height: 100%;
}
.main-section.active {
    display: block;
    opacity: 1;
    visibility: visible;
}

/* --- Cải thiện CSS cho Tab Buttons và Tab Panes --- */
.tab-buttons {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem; /* Tăng khoảng cách dưới */
    padding: 0 10px;
    background-color: #fff; /* Nền trắng cho thanh tab */
    border-radius: 8px 8px 0 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* Thêm đổ bóng nhẹ */
}

.tab-buttons::-webkit-scrollbar {
    display: none; /* Dành cho Chrome, Safari và Opera */
}

/* Tối ưu hóa các nút tab */
.tab-button {
    flex-shrink: 0;
    padding: 14px 20px; /* Tăng padding để nút lớn hơn */
    margin-right: 15px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600; /* Tăng độ đậm của chữ */
    color: var(--secondary-color);
    position: relative;
    transition: color 0.3s ease;
}

.tab-button:hover:not(.active) {
    color: var(--primary-color);
    background-color: #f1f3f5; /* Thêm hiệu ứng hover nhẹ */
}

/* Đảm bảo hiệu ứng chỉ hiển thị trên nút tab */
.tab-button::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 3px; /* Tăng độ dày của đường gạch chân */
    background-color: transparent;
    transition: background-color 0.3s ease;
}

.tab-button.active {
    color: var(--primary-color);
}
.tab-button.active::after {
    background-color: var(--primary-color);
}

/* Tối ưu hóa Tab Panes: Đơn giản, đáng tin cậy */
.tab-pane {
    display: none;
    padding: 1.5rem; /* Tăng padding nội dung tab */
    background-color: var(--background-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.tab-pane.active {
    display: block;
}

/* =================================================================== */
/* --- Media Query cho thiết bị di động --- */
/* =================================================================== */
@media (max-width: 768px) {
    /* Điều chỉnh body để không có margin/padding thừa */
    body {
        margin-left: 0;
    }

    /* Điều chỉnh header trên mobile */
    .app-header {
        padding: 10px 15px;
    }
    .header-search {
        margin: 0 10px;
    }
    .header-brand .logo {
        font-size: 1.4em;
    }

    /* Điều chỉnh main-content để nội dung không bị che khuất */
    .main-content {
        /* Bỏ margin-left và padding-left/right để nội dung tràn màn hình */       
        width: 100%;
        /* Đảm bảo nội dung bắt đầu ngay dưới header và trên footer */
        padding-top: calc(var(--header-height) + 10px);
        padding-bottom: calc(var(--footer-height) + 10px);
    }
}

@media (max-width: 500px) {
    /* Điều chỉnh font-size tổng thể để dễ đọc hơn */
    body {
        font-size: 14px;
    }
    .header-auth-controls #loginBtn
    {
        display: none;
    }
    .header-auth-controls #signupBtn
    {
        display: none;
    }
   
}

/* =================================================================== */
/* --- Header Styles --- */
/* =================================================================== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: var(--header-background-color);
    color: var(--main-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    height: var(--header-height);
    position: fixed; /* Sửa thành fixed để header luôn ở trên cùng */
    width: 100%;
    top: 0;
    z-index: 1000;
}

.header-brand .logo {
    font-size: 1.8em;
    font-weight: bold;    
}

/* Search bar in header */
.header-search {
    display: flex;
    align-items: center;
    position: relative;
    flex-grow: 1;
    margin: 0 20px; /* Thêm margin để khoảng cách tốt hơn */
}

.header-search input {
    padding: 8px 12px;
    padding-right: 35px;
    border: 1px solid #ced4da;
    border-radius: 20px;
    font-size: 0.9em;
    outline: none;
    transition: border-color 0.2s;
    width: 100%; /* Đảm bảo input chiếm hết không gian */
}

.header-search input:focus {
    border-color: var(--primary-color);
}

.header-search .fa-search {
    position: absolute;
    right: 12px;
    color: var(--secondary-color);
}

/* Notifications in header */
.header-notifications {
    position: relative;
    cursor: pointer;
    margin-right: 15px; /* Thêm khoảng cách */
}

.header-notifications .fa-bell {
    font-size: 1.4em;   
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -10px;
    background-color: var(--danger-color);
    color: white;
    font-size: 0.7em;
    padding: 3px 6px;
    border-radius: 50%;
    line-height: 1;
}

/* Authentication controls (Login/Signup buttons) */
.header-auth-controls {
    display: flex;
    align-items: center;
}

.nav-group {
    display: flex;
    align-items: center;
}

.nav-group .nav-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s;
    margin-left: 10px;
}

.nav-group .nav-button:hover {
    background-color: #0056b3;
}

/* --- Profile Dropdown in Header --- */
/* Thiết lập ngữ cảnh định vị cho dropdown */
#profileNav {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: 15px;
}

/* Kiểu cho profileLink (kích hoạt dropdown) */
#profileLink {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
    cursor: pointer;
    padding: 5px 0;
}

#profileLink .user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
    border: 1px solid #ddd;
}

#profileLink .username-display {
    font-weight: 500;
    margin-right: 5px;
}

#profileLink .dropdown-icon {
    font-size: 0.8em;
    color: var(--secondary-color);
    transition: transform 0.2s;
}

/* Hiệu ứng xoay icon khi dropdown mở */
#profileNav.show #profileLink .dropdown-icon {
    transform: rotate(180deg);
}

/* Định vị tuyệt đối cho dropdown menu */
#profileDropdown.dropdown-menu {
    position: absolute;
    top: calc(var(--header-height) + 5px); /* Điều chỉnh vị trí dưới header */
    right: 0;
    min-width: 180px;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

/* Khi JavaScript thêm class 'show' */
#profileDropdown.dropdown-menu.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Kiểu cho các mục trong dropdown */
.dropdown-menu .dropdown-item {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #333;
    white-space: nowrap;
    transition: background-color 0.2s;
    border: none;
    width: 100%;
    text-align: left;
    background: none;
    cursor: pointer;
}

.dropdown-menu .dropdown-item:hover {
    background-color: var(--light-bg);
    color: var(--primary-color);
}

/* Kiểu riêng cho nút đăng xuất */
.dropdown-menu .logout-button {
    border-top: 1px solid #eee;
    font-weight: bold;
    color: var(--danger-color);
}

.dropdown-menu .logout-button:hover {
    background-color: #ffebeb;
    color: var(--danger-color);
}

/* =================================================================== */
/* CSS cho nút toggle thông tin nhạy cảm */
/* =================================================================== */
/* CSS cho các container chứa thông tin và nút */
.user-info-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs); /* Sử dụng biến cho khoảng cách */
    margin-bottom: var(--spacing-xs);
    font-size: 1rem;
    color: var(--text-color);
}

/* Ẩn thông tin ban đầu */
.user-info-item span {
    font-weight: bold;
}

/* CSS cho từng nút toggle thông tin */
.btn-toggle-info {
    border: none;
    background-color: transparent;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
    transition: color var(--transition-duration) ease; /* Thêm hiệu ứng chuyển đổi */
}

/* Hiệu ứng khi di chuột vào */
.btn-toggle-info:hover {
    color: var(--primary-color);
}

/* =================================================================== */
/* --- Modal Styles đã được tối ưu hóa --- */
/* =================================================================== */
.modal {
    display: flex; /* Giữ display:flex để căn giữa, nhưng ẩn nó bằng visibility/opacity */
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-background);
    
    /* Các thuộc tính cho hiệu ứng transition */
    visibility: hidden; /* Mặc định ẩn, không thể tương tác */
    opacity: 0; /* Mặc định trong suốt */
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

/* Modal Overlay - Trạng thái khi hiển thị */
.modal.show {
    justify-content: center; /* Căn giữa theo chiều ngang */
    align-items: center;   /* Căn giữa theo chiều dọc */
    visibility: visible;
    opacity: 1;
}

/* Modal Dialog - Container chính cho nội dung modal */
.modal-dialog {
    position: relative;
    width: 95%;
    max-width: 500px;
    
    /* Thêm hiệu ứng trượt nhẹ */
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Áp dụng hiệu ứng trượt vào khi modal hiển thị */
.modal.show .modal-dialog {
    transform: scale(1);
}

/* Kích thước lớn hơn cho modal-dialog */
.modal-dialog.modal-xl {
    max-width: 900px;
}

/* Modal Content - Khung chứa nội dung */
.modal-content {
    background-color: var(--modal-content-bg);
    border: 1px solid var(--modal-border-color);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    max-height: 95vh;
    overflow-y: auto; /* Cho phép cuộn khi nội dung quá dài */
}

/* Modal Header - Phần đầu modal */
.modal-header {
    background-color: var(--modal-header-footer-bg);
    padding: 10px 20px;
    border-bottom: 1px solid var(--modal-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--modal-title-color);
}

.modal-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 600;
}

/* Nút đóng modal */
.close-button {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--modal-close-color);
    background-color: transparent;
    border: none;

    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
    transition: color 0.2s ease;
}

.close-button:hover {
    color: #000;
}

/* Modal Body - Phần thân modal */
.modal-body {
    padding: 25px;
    flex-grow: 1;
}

/* Modal Footer - Phần chân modal */
.modal-footer {
    background-color: var(--modal-header-footer-bg);
    padding: 20px 25px;
    border-top: 1px solid var(--modal-border-color);
    display: flex;
    justify-content: flex-end;
    gap: 15px; /* Giảm khoảng cách giữa các nút */
}


/* =================================================================== */
/* --- Common UI Components --- */
/* =================================================================== */
/* Forms */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: bold;
    color: var(--text-dark);
}

.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select,
.form-group textarea {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-sizing: border-box; /* Đảm bảo padding và border không làm tăng kích thước */
}

.form-group .otp-input-group {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    margin-top: var(--spacing-sm);
}

.form-group .otp-input {
    width: 40px;
    height: 40px;
    text-align: center;
    font-size: 18px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

/* Buttons */
.btn {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    border: none;
    transition: background-color var(--transition-duration) ease, transform 0.1s ease, box-shadow var(--transition-duration) ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: translateY(0);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--text-light);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-light);
}

.btn-success {
    background-color: var(--success-color);
    color: var(--text-light);
}

.btn-danger {
    background-color: var(--danger-color);
    color: var(--text-light);
}

.btn-warning {
    background-color: var(--warning-color);
    color: var(--text-dark);
}

.btn-info {
    background-color: var(--info-color);
    color: var(--text-light);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    display: block;
    text-align: center;
}

/* Cards */
.card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    background-color: #fff;
}

.card-header {
    font-weight: bold;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

/* Alerts / Messages */
.alert {
    padding: 10px 15px;
    margin-bottom: 15px;
    border-radius: 5px;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.alert.show {
    opacity: 1;
    visibility: visible;
}

/* Alert Types */
.alert.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.alert.alert-danger .icon {
    color: #721c24;
}

.alert.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.alert.alert-success .icon {
    color: #155724;
}

.alert.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}
.alert.alert-info .icon {
    color: #0c5460;
}

/* Icon in alert */
.alert .icon {
    font-size: 1.2em;
}

/* =================================================================== */
/* --- Loading Indicator --- */
/* =================================================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =================================================================== */
/* --- Footer Styles --- */
/* =================================================================== */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--footer-height);
    background-color: var(--footer-background-color);
    color: var(--main-color);
    box-shadow: 0 -2px 4px rgba(0,0,0,0.05);
    z-index: 999;
}

.footer-navbar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
}

.footer-navbar button {

    border: none;
    background: none;
    color: var(--main-color);
    font-size: 1.2em;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.footer-navbar button.active {
    color: var(--primary-color);
}

.footer-navbar button i {
    font-size: 1.2em;
}

/* ========================================================== */
/* QUẢN LÝ PHẦN TỬ QUÉT MÃ QR                       */
/* ========================================================== */

#qrcodeSection {
    padding: 20px;
    background-color: #f9f9f9;
    min-height: 80vh;
    display: none; /* Mặc định ẩn, sẽ hiển thị bằng JS */
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

#qrcodeSection.active {
    display: block;
    opacity: 1;
}

#qrcodeSection h2 {
    text-align: center;
    color: #333;
    margin-bottom: 25px;
    font-size: 1.8em;
    font-weight: 600;
}

.qr-scanner-container {
    max-width: 500px;
    margin: 0 auto;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.qr-video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px 12px 0 0;
    transform: scaleX(-1); /* Lật ngang video để người dùng thấy hình ảnh phản chiếu */
}

.qr-result-container {
    padding: 15px;
    background-color: #fff;
    border-top: 1px solid #e0e0e0;
}

#qr-result {
    font-weight: bold;
    color: #007bff;
    font-size: 1.1em;
}

/* Kiểu cho các nút */
#qrcodeSection .btn-group {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

#qrcodeSection .btn {
    padding: 12px 25px;
    font-size: 1em;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#startScanBtn.btn-primary {
    background-color: #007bff;
    color: #fff;
}

#startScanBtn.btn-primary:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

#stopScanBtn.btn-secondary {
    background-color: #dc3545;
    color: #fff;
}

#stopScanBtn.btn-secondary:hover {
    background-color: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

/* Các lớp trạng thái */
.status-success {
    color: #28a745;
    font-weight: bold;
}

.status-error {
    color: #dc3545;
    font-weight: bold;
}

/* ========================================================== */
/* STYLE CHO KHUNG QUÉT VÀ HIỆU ỨNG           */
/* ========================================================== */

/* Lớp phủ cho video và khung quét */
.qr-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    pointer-events: none; /* Đảm bảo không chặn các sự kiện chuột */
}

/* Khung viền cho khung quét */
.qr-scanner-frame {
    width: 70%;
    height: 70%;
    border: 3px solid #00f081; /* Màu xanh lá cây nổi bật */
    box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.6); /* Lớp phủ mờ xung quanh */
    position: relative; /* Quan trọng để định vị tia quét */
    overflow: hidden; /* Đảm bảo tia quét không tràn ra ngoài */
}

/* Tia quét động */
.qr-scanner-frame::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #00f081;
    animation: scan-line 2s infinite linear; /* Hiệu ứng tia quét di chuyển */
}

@keyframes scan-line {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(100%);
    }
}

/* =================================================================== */
/* --- Panel Styles --- */
/* =================================================================== */
/* Accordion styles */
.accordion {
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    padding: 12px 15px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 1.1em;
    transition: 0.4s;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion:hover {
    background-color: #004494; /* Màu tối hơn khi hover */
}

.accordion:after {
    content: '\02795'; /* Unicode character for "plus" sign (+) */
    font-size: 0.8em;
    color: white;
    float: right;
    margin-left: 5px;
    transition: transform 0.3s ease;
}

.accordion.active:after {
    content: "\2796"; /* Unicode character for "minus" sign (-) */
    transform: rotate(180deg);
}

.panel {
    padding: 0 18px;
    background-color: white;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

.panel .container {
    padding-top: var(--padding-base); /* Để nội dung không bị dính vào cạnh */
    padding-bottom: var(--padding-base);
}

/* ======================== */
/* PROFILE SECTION STYLES */
/* ======================== */
#profileSection {
    padding: 20px;
}


/* ======================== */
/* ACCOUNT OVERVIEW TAB   */
/* ======================== */
.profile-account {
    display: flex;

    align-items: center;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.profile-avatar {
    position: relative; /* Đã thêm để làm gốc định vị cho status-badge */
}

.profile-avatar .avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--header-color);
    object-fit: cover;

}

.status-badge {

    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color); /* Đã thêm để làm nổi bật hơn */
}
.online-status {
    background-color: var(--success-color);
}
.profile-info {
    flex-grow: 1;
}

.profile-info p {
    margin: 5px 0;
    font-size: 0.9rem;
}
.profile-info strong {
    color: var(--secondary-color);
}
.profile-info .balance-item {
    padding: 10px;
    background-color: var(--bg-color);
    border-radius: 5px;
    margin-top: 10px;
}

/* ======================== */
/* BALANCE TAB            */
/* ======================== */
.balance-section {
    padding: 0;
}
.balance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}
.balance-item {
    background-color: var(--bg-color);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
}

.balance-item .label {
    font-size: 0.8rem;
    color: var(--secondary-color);
    margin-bottom: 5px;
}

.balance-item .value {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--dark-color);
}
.balance-actions {
    display: flex;

    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}
.btn .btn-login {
    background-color: var(--btn-action-color);
    color: var(--light-color);    
}

.btn-otp {
    background-color: var(--btn-action-color);
    color: var(--light-color);
}

.btn-primary {
    background-color: var(--btn-action-color);
    color: var(--light-color);
}

.btn-secondary {
    background-color: var(--btn-action-color);
    color: var(--light-color);
}

.btn-deposit {
    background-color: var(--success-color);
    color: var(--light-color);
}

.btn-withdraw {
    background-color: var(--warning-color);
    color: var(--dark-color);
}

.btn-transfer {
    background-color: var(--info-color);
    color: var(--primary-color);
}
.btn:hover {
    opacity: 0.9;
}

.btn-block {
    width: 50%;
}

/* ======================== */
/* PROFILE DETAILS TAB    */
/* ======================== */
.profile-details {
    padding: 0;
}
.profile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 15px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .profile-avatar {
        margin-bottom: 10px;
    }

    .profile-avatar .avatar {
        width: 80px;
        height: 80px;
    }

    .status-badge {
        bottom: 0;
        right: 0;
    }

    .balance-grid, .profile-grid {
        grid-template-columns: 1fr; /* Stack on small screens */
    }

    .balance-actions, .profile-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}
.profile-card {
    background-color: var(--background-color);
    padding: 15px;
    border-radius: 8px;
}
.profile-card h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--header-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}
.profile-card p {
    margin: 5px 0;
    font-size: 0.9rem;
}
.profile-card strong {
    color: var(--secondary-color);
}
.profile-actions {
    margin-top: 20px;
    text-align: center;
}
.btn-edit-profile {
    background-color: var(--info-color);
    color: var(--primary-color);
}

/* ======================== */
/* TRANSACTIONS TAB       */
/* ======================== */
.transactions-section {
    padding: 0;
}
.transaction-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.transaction-list li {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.transaction-list li:last-child {
    border-bottom: none;
}

/* ======================== */
/* ACCORDION STYLES       */
/* ======================== */
.accordion {
    background-color: var(--primary-color);
    color: var(--dark-color);
    cursor: pointer;
    padding: 18px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 1rem;
    transition: 0.4s;
    font-weight: bold;
}
.accordion:after {
    content: '\25BC'; /* Biểu tượng mũi tên xuống */
    font-size: 1.2rem;
    color: #777;
    float: right;
    margin-left: 5px;
    transform: rotate(-90deg);
    transition: transform 0.4s ease;
}
.accordion.active:after {
    transform: rotate(0deg);
}
.panel {
    padding: 0 18px;
    background-color: var(--primary-color);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
}

/* ======================== */
/* Notification message Style */
/* ======================== */
.container-msg {
    display: flex;
    align-items: center; /* Căn chỉnh các phần tử theo chiều dọc */
    gap: 10px; /* Thêm khoảng cách giữa các phần tử */
}

.container-msg img {
    /* Đảm bảo hình ảnh không bị co dãn */
    flex-shrink: 0;
}

.container-msg p {
    flex-grow: 1; /* Cho phép thẻ p chiếm hết không gian còn lại */
    display: flex;
    justify-content: space-between; /* Đẩy "time-right" về phía cuối */
    align-items: center;
    margin: 0;
}

.container-msg .time-right {
    margin-left: 10px;
}



/* =================================================================== */
/* --- Full Transactions Table Styles --- */
/* =================================================================== */
.transaction-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 0.9em;
}

.transaction-table th, .transaction-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.transaction-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.transaction-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.transaction-table tr:hover {
    background-color: #f1f1f1;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 10px;
}

.pagination button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.pagination button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.pagination span {
    padding: 8px 15px;
    font-weight: bold;
    color: #333;
}

/* Filter Controls */
.filter-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 8px;
    background-color: #fdfdfd;
}

.filter-controls label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 0.9em;
}

.filter-controls select,
.filter-controls input[type="date"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 0.9em;
}

.filter-actions {
    grid-column: 1 / -1; /* Span all columns */
    display: flex;
    justify-content: flex-end; /* Align to the right */
    gap: 10px;
    margin-top: 10px;
}

/* =================================================================== */
/* --- Utility Classes --- */
/* =================================================================== */
.text-center { text-align: center; }
.float-right { float: right; } /* Sử dụng cẩn thận với flexbox/grid */
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 15px; }

/* =================================================================== */
/* --- Keyframe Animations --- */
/* =================================================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}