/* ==================================== */
/* 1. Thiết lập chung và Biến (Variables) */
/* ==================================== */
:root {
    /* Colors */
    --primary-color: #007bff; /* Màu xanh dương */
    --secondary-color: #6c757d; /* Màu xám */
    --success-color: #28a745; /* Màu xanh lá */
    --danger-color: #dc3545; /* Màu đỏ */
    --warning-color: #ffc107; /* Màu vàng */

    /* Backgrounds & Borders */
    --light-bg: #f8f9fa; /* Màu nền nhẹ */
    --dark-bg: #343a40; /* Màu nền tối */
    --card-bg: #ffffff;
    --border-color: #dee2e6;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.05);

    /* Typography */
    --text-color: #212529; /* Màu chữ chính */
    --font-family: 'Arial', sans-serif;
}

* {
    /* Sử dụng shorthand margin/padding */
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--light-bg);
    color: var(--text-color);
    line-height: 1.6;
}

/* Ứng dụng chính (Giả lập màn hình di động) */
.app-header, 
.app-footer, 
.main-content {    
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

/* ==================================== */
/* 2. Header */
/* ==================================== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    padding: 15px;
    background-color: var(--primary-color);
    color: white;
    
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-bar input[type="text"] {
    width: 100%; /* Đã thêm để thống nhất với form inputs */
    padding: 5px 10px;
    border: none; /* Đã loại bỏ border cũ, chỉ giữ border-radius */
    border-radius: 20px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.notifications {
    position: relative;
    cursor: pointer;

}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -10px;
    
    /* Gộp padding: 2px 5px; và border-radius: 50%; */
    padding: 2px 5px;
    min-width: 20px;
    
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%; 
    
    font-size: 0.7rem;
    text-align: center;
}

.user-avatar img {
    width: 30px;
    height: 30px;
    object-fit: cover;
    border-radius: 50%;
}

/* ==================================== */
/* 3. Main Content & Tabs */
/* ==================================== */
.main-content {
    /* Sử dụng shorthand padding: 0 0 70px 0; */
    padding-bottom: 70px; /* Khoảng trống cho footer cố định */
}

.main-section {
    padding: 20px 15px;
    display: none;
}

.main-section.active {
    display: block;
}

.tab-buttons {
    display: flex;
    justify-content: space-around;
    
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.tab-button {
    flex-grow: 1;
    padding: 10px 15px;
    
    border: none;
    background: none;
    border-bottom: 3px solid transparent; /* Đã chuyển lên trên */
    
    cursor: pointer;
    font-size: 1rem;
    color: var(--secondary-color);
    
    transition: all 0.3s ease;
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: bold;
}

.tab-pane {
    padding: 15px 0;
    display: none;
}

.tab-pane.active {
    display: block;
}

/* ==================================== */
/* 4. Cards & Forms */
/* ==================================== */
.card {
    padding: 15px;
    margin-bottom: 20px;
    
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.card-header {
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--light-bg);
    
    font-weight: bold;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: -10px;
}

.col-md-6 {
    padding: 10px;
    width: 50%;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Gộp tất cả input, select, và search-bar input vào cùng một bộ chọn */
.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

/* Buttons (Đã sắp xếp lại thuộc tính) */
.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    
    cursor: pointer;
    font-size: 1rem;
    
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-warning {
    background-color: var(--warning-color);
    color: var(--text-color);
}

.btn-block {
    display: block;
    width: 100%;
}

/* Utility Classes (Sắp xếp lại) */
.mt-2 {
    margin-top: 10px;
}

.text-center {
    text-align: center;
}

.message {
    padding: 10px;
    margin-bottom: 15px;
    
    background-color: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    
    text-align: center;
}

.hide {
    display: none !important;
}

/* ==================================== */
/* 5. Profile Section */
/* ==================================== */
.profile-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.profile-avatar {
    position: relative;
    margin-right: 15px;
}

.profile-avatar .avatar {
    width: 70px;
    height: 70px;
    border: 3px solid var(--primary-color);
    border-radius: 50%;
}

.status-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    
    width: 15px;
    height: 15px;
    
    border: 2px solid var(--card-bg);
    border-radius: 50%;
}

.online-status {
    background-color: var(--success-color);
}

.profile-info h3 {
    margin: 0;
    font-size: 1.2rem;
}

.profile-info p {
    margin: 3px 0;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

/* Gộp các tiêu đề section */
.balance-section h4, 
.profile-details h4, 
.transactions-section h4 {
    padding-bottom: 10px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    color: var(--primary-color);
}

.balance-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.balance-item {
    padding: 10px;
    background-color: var(--light-bg);
    border-radius: 4px;
}

.balance-item .label {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.balance-item .value {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-color);
}

.balance-actions {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.btn-deposit, .btn-withdraw, .btn-transfer {
    flex-grow: 1;
    font-size: 0.9rem; /* Đặt font-size chung cho nhóm button */
    color: white; /* Đặt color chung cho nhóm */
}

.btn-deposit {
    background-color: var(--success-color);
}

.btn-withdraw {
    background-color: var(--danger-color);
}

.btn-transfer {
    background-color: var(--warning-color);
    color: var(--dark-bg); /* Màu chữ khác biệt */
}

.profile-details .detail-group p {
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.profile-details .icon {
    margin-right: 8px;
    color: var(--primary-color);
}

/* ==================================== */
/* 6. Transactions Table */
/* ==================================== */
.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    align-items: flex-end;
}

.filter-controls .form-group {
    flex: 1 1 auto;
    min-width: 120px;
    margin-bottom: 0;
}

.transaction-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.transaction-table th, .transaction-table td {
    padding: 8px;
    border: 1px solid var(--border-color); /* Gộp border */
    text-align: left;
    font-size: 0.85rem;
}

.transaction-table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid var(--primary-color);
    background-color: white;
    color: var(--primary-color);
    cursor: pointer;
    border-radius: 4px;
}

/* ==================================== */
/* 7. Footer Nav */
/* ==================================== */
.app-footer {
    position: fixed;
    bottom: 0;    
    left: 0;
    right: 0;    
    z-index: 10;    
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

.app-footer-nav {
    display: flex;
    justify-content: space-around;
    
    max-width: 500px;
    margin: 0 auto;
}

.app-footer-nav button {
    flex-grow: 1;
    padding: 10px;
    
    border: none;
    background: none;
    color: var(--secondary-color);
    
    display: flex;
    flex-direction: column;
    align-items: center;
    
    font-size: 0.75rem;
    
    /* === Các Thay Đổi Quan Trọng === */
    cursor: pointer; /* Thêm để rõ ràng là một nút */
    -webkit-tap-highlight-color: transparent; /* Loại bỏ độ trễ và highlight khi chạm trên di động */
    user-select: none; /* Ngăn chọn văn bản */
    transition: color 0.2s ease-in-out; /* Làm mượt mà hơn */
    /* will-change: color; (Tùy chọn, nếu muốn tối ưu hóa hiệu suất) */
}

/* Kèm theo trạng thái tương tác để tăng phản hồi (đã đề xuất ở câu trả lời trước) */
.app-footer-nav button:hover, 
.app-footer-nav button:focus {
    color: var(--primary-color);
    outline: none;
}

.app-footer-nav button .material-icons {
    font-size: 24px;
    margin-bottom: 2px;
}

.app-footer-nav button.active {
    color: var(--primary-color);
}

/* ==================================== */
/* 8. Modals & Notifications */
/* ==================================== */

/* --- Modal Overlay --- */
.modal {
    /* Position */
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
    
    /* Box Model */
    width: 100%;
    height: 100%;
    overflow: auto;
    display: none; /* Mặc định ẩn */
    
    /* Color */
    background-color: rgba(0, 0, 0, 0.4);
}

/* --- Modal Content --- */
.modal-content {
    /* Position & Animation */
    position: relative;
    margin: 15% auto; /* Đã tối ưu hóa shorthand margin */
    animation-name: animatetop;
    animation-duration: 0.4s;
    
    /* Box Model */
    width: 90%;
    max-width: 400px;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #888;
    
    /* Color */
    background-color: #fefefe;
}

@keyframes animatetop {
    from {
        top: -300px;
        opacity: 0;
    }
    to {
        top: 0;
        opacity: 1;
    }
}

/* --- Modal Header --- */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    padding-bottom: 10px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

/* --- Close Button --- */
.close-button {
    float: right;
    cursor: pointer;
    
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
}

.close-button:hover,
.close-button:focus {
    color: var(--danger-color);
    text-decoration: none;
}

/* --- Notification Container --- */
.notification-container {
    /* Position */
    position: fixed;
    top: 70px; /* Dưới header */
    right: 15px;
    z-index: 1;
    display: none; /* Mặc định ẩn */
    
    /* Box Model */
    width: 300px;
    padding: 0; /* Đã thêm padding: 0 để kiểm soát padding bên trong body/header/footer */
    border-radius: 8px;
    border: 1px solid var(--border-color);
    
    /* Color & Shadow */
    background-color: var(--card-bg);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    
    font-weight: bold;
}

.notification-body {
    max-height: 300px;
    overflow-y: auto;
    
    padding: 10px 15px;
}

.notification-item {
    padding: 10px 0;
    border-bottom: 1px dotted var(--border-color);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item strong {
    display: block;
    margin-bottom: 3px;
    
    color: var(--primary-color);
}

.notification-item p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.notification-footer {
    padding: 10px 15px;
    border-top: 1px solid var(--border-color);
    text-align: right;
}