/* style.css */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* --- PANEL BÊN PHẢI --- */
.right-controls {
    position: fixed;
    top: 20px; right: 20px;
    width: 320px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 90vh;
}

/* Nút chụp ảnh */
.capture-button {
    background-color: #007bff; color: white;
    border: none; border-radius: 8px;
    padding: 12px; font-weight: 600; cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.capture-button:hover { background-color: #0056b3; transform: translateY(-2px); }

/* Panel Nhập liệu */
.control-panel {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.5);
    overflow-y: auto;
    flex-grow: 1;
}

/* --- GRID CHỌN NGÂN HÀNG --- */
.bank-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #f9f9f9;
}

.bank-grid::-webkit-scrollbar { width: 6px; }
.bank-grid::-webkit-scrollbar-track { background: #f1f1f1; }
.bank-grid::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.bank-option {
    display: flex!important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.bank-option:hover { border-color: #007bff; transform: translateY(-1px); }

.bank-option input[type="radio"] { display: none; }

.bank-option img {
    width: 30px; height: 30px;
    object-fit: contain; margin-bottom: 5px;
}

.bank-option span {
    font-size: 10px; font-weight: 600; color: #555;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    width: 100%;
}

.bank-option:has(input:checked) {
    border-color: #007bff;
    background-color: #e7f1ff;
    box-shadow: 0 0 0 1px #007bff;
}

/* Form input styling */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #444; margin-bottom: 5px; }
.form-control {
    width: 100%; padding: 8px 12px;
    border: 1px solid #ddd; border-radius: 6px;
    font-size: 14px; outline: none; background: white;
}
.form-control:focus { border-color: #007bff; }

/* --- THẺ CARD --- */
.card {
    background: linear-gradient(135deg, #2E8B57 0%, #228B22 100%);
    border-radius: 24px; padding: 30px;
    width: 700px; height: 420px;
    color: white; position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    display: flex; flex-direction: column; justify-content: space-between;
    transition: transform 0.3s ease;
    margin-right: 340px;
    overflow: hidden; /* Đảm bảo overlay không bị tràn ra ngoài border-radius */
}

/* Hiệu ứng bóng sáng nhẹ ở góc */
.card::before {
    content: ''; position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: linear-gradient(45deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
    border-radius: 24px; pointer-events: none;
    z-index: 100; /* Nằm trên overlay nhưng dưới content */
}

/* SỬA Ở ĐÂY: Lớp phủ lưới trắng - dùng class thay vì pseudo-element */
.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Dùng đường dẫn tương đối để tránh lỗi CORS khi chụp ảnh */
    background: url("img/luoi-trang.png");
    background-repeat: no-repeat;
    background-size: cover;
    z-index: 99;
    border-radius: 24px;
    opacity: 0.4;
    pointer-events: none; /* Cho phép click xuyên qua */
}

.card-header { display: flex; align-items: center; gap: 20px; z-index: 9999; }
.logo {
    width: 70px; height: 70px; background: white;
    border-radius: 14px; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.logo img { width: 85%; height: 85%; object-fit: contain; }
.bank-name { font-size: 32px; font-weight: bold; text-shadow: 2px 2px 4px rgba(0,0,0,0.3); }

.card-content { display: flex; justify-content: space-between; align-items: flex-end; z-index: 9999;}
.card-info { flex: 1; text-align: left; }
.amount-display {
    font-size: 38px; font-weight: 800; margin-bottom: 10px;
    color: #ffd700; text-shadow: 2px 2px 4px rgba(0,0,0,0.4);
}
.account-name { font-size: 24px; font-weight: bold; text-transform: uppercase; margin-bottom: 5px; }
.account-number { font-size: 32px; font-weight: bold; margin-bottom: 5px; letter-spacing: 2px; }
.transfer-text { font-size: 18px; opacity: 0.9; font-style: italic; }

.qr-code {
    width: 250px; height: 250px; background: white;
    border-radius: 16px; padding: 10px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}
.qr-code img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }

/* Responsive */
@media (max-width: 1100px) {
    body { flex-direction: column; justify-content: flex-start; padding-top: 20px; }
    .right-controls { position: relative; top: 0; right: 0; width: 100%; max-width: 600px; margin-bottom: 30px; }
    .card { width: 100%; max-width: 600px; height: auto; padding: 30px; margin-right: 0; margin-bottom: 50px; }
    .bank-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 600px) {
    .bank-name { font-size: 22px; }
    .amount-display { font-size: 28px; }
    .account-name { font-size: 18px; }
    .account-number { font-size: 22px; }
    .qr-code { width: 160px; height: 160px; }
    .logo { width: 50px; height: 50px; }
    .bank-grid { grid-template-columns: repeat(3, 1fr); }
}
