/* ===== CSS cho phần tài khoản có sẵn ===== */

/* Saved Accounts Section */
.saved-accounts-section {
    margin-bottom: 20px;
}

.saved-accounts-section label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 12px;
    letter-spacing: 0.3px;
}

.saved-accounts-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-height: 240px;
    overflow-y: auto;
    padding: 4px;
}

/* Custom scrollbar with soft UI style */
.saved-accounts-list::-webkit-scrollbar {
    width: 8px;
}

.saved-accounts-list::-webkit-scrollbar-track {
    background: #f0f3f7;
    border-radius: 10px;
    margin: 4px 0;
}

.saved-accounts-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #cbd5e1 0%, #94a3b8 100%);
    border-radius: 10px;
    border: 2px solid #f0f3f7;
}

.saved-accounts-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #94a3b8 0%, #64748b 100%);
}

/* Modern Card Design with Gradient */
.saved-account-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Hover Effect */
.saved-account-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

/* Active State - Modern Blue Gradient */
.saved-account-item.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.saved-account-item.active .account-name-short,
.saved-account-item.active .account-bank-short {
    color: #ffffff;
}

.saved-account-item.active .account-check {
    opacity: 1;
    color: #ffffff;
    transform: scale(1) rotate(0deg);
}

/* Bank Icon - Smaller */
.account-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.saved-account-item.active .account-icon {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.3);
}

.account-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

/* Account Information - 2 Lines */
.account-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.account-name-short {
    font-weight: 600;
    font-size: 13px;
    color: #1e293b;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-bank-short {
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Check Icon with Animation */
.account-check {
    opacity: 0;
    color: #3b82f6;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    transform: scale(0.8) rotate(-10deg);
}

.saved-account-item:hover .account-check {
    opacity: 0.4;
    transform: scale(0.9) rotate(-5deg);
}

/* Divider with Modern Design */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e2e8f0 20%, #e2e8f0 80%, transparent);
}

.divider span {
    padding: 0 16px;
    font-size: 12px;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: #ffffff;
    position: relative;
    z-index: 1;
}

/* No accounts message with Soft UI */
.no-accounts {
    text-align: center;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    padding: 24px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    margin: 0;
    box-shadow:
        0 2px 8px rgba(15, 23, 42, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.no-accounts::before {
    content: '📋';
    display: block;
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* Button Group - Compact buttons */
.button-group {
    display: flex;
    gap: 12px;
    margin-top: 0;
}

.button-group button {
    flex: 1;
    padding: 12px 16px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    border-radius: 10px !important;
}

#btnGenerate {
    background: #3b82f6 !important;
}

#btnGenerate:hover {
    background: #2563eb !important;
}

.btn-secondary {
    background: #10b981 !important;
}

.btn-secondary:hover {
    background: #059669 !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .saved-accounts-list {
        grid-template-columns: 1fr;
        max-height: 180px;
        gap: 8px;
    }
    
    .saved-account-item {
        padding: 10px 12px;
        gap: 10px;
    }
    
    .account-icon {
        width: 32px;
        height: 32px;
    }
    
    .account-name-short {
        font-size: 12px;
    }
    
    .account-bank-short {
        font-size: 10px;
    }
    
    .button-group button {
        padding: 10px 12px !important;
        font-size: 14px !important;
    }
    
    .divider {
        margin: 20px 0;
    }
}

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

body {
  font-family: "Lexend", sans-serif;
  background: url("files/background_login.jpg") no-repeat center center;
  background-size: cover;
  background-attachment: scroll; /* ✅ đổi từ fixed sang scroll để tránh giật */
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow-x: hidden;
}

.background-wrapper {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
}

h1 {
  font-size: 26px;
  color: #3ab5ff;
  text-align: center;
  margin-bottom: 30px;
  letter-spacing: 1px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}
.field {
  margin-bottom: 18px;
}
.field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #222;
}
.field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid #ccc;
  height: 40px;
  line-height: 40px;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
}

.field input:focus {
  border-color: #3ab5ff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(58, 181, 255, 0.2);
}

/* Buttons - được style bởi .button-group ở trên */
#btnGenerate,
.btn-secondary {
  color: white;
  border: none;
  cursor: pointer;
}

/* --- SELECT2 --- */
.select2-container--default .select2-selection--single {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between;
  height: 50px !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  border-radius: 10px !important;
  background: #fff;
  overflow: hidden;
}
.select2-selection__rendered {
  display: flex !important;
  align-items: center !important;
  gap: 10px;
  width: 100%;
  overflow: hidden;
  font-size: 15px;
  padding-right: 30px !important;
}

.select2-selection__rendered span {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.select2-results__option {
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 10px 14px !important;
  font-size: 15px;
}
.select2-results__option img {
  width: 45px;
  height: 25px;
  object-fit: contain;
  border-radius: 6px;
}

/* Logo trong danh sách ngân hàng */
.select2-results__option img,
.select2-selection__rendered img {
  flex-shrink: 0;
  width: 60px !important;
  height: 30px !important;
  object-fit: contain;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  background: #fff;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Hiệu ứng hover nhẹ */
.select2-results__option:hover img {
  transform: scale(1.05);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.bank-logo {
  width: 100px !important;
  height: 50px !important;
  object-fit: contain;
}

html {
  overflow-y: scroll; /* luôn giữ scrollbar cố định */
}

body.swal2-shown {
  padding-right: 0 !important; /* chặn SweetAlert2 tự thêm padding */
}

/* Fix mũi tên của select2 */
.select2-container--default
  .select2-selection--single
  .select2-selection__arrow {
  height: 100% !important;
  top: 0 !important;
  right: 12px !important;
  transform: translateY(0);
  display: flex;
  align-items: center;
  justify-content: center;
}

.select2-container--default
  .select2-selection--single
  .select2-selection__arrow
  b {
  border-color: #666 transparent transparent transparent;
  border-width: 5px 5px 0 5px;
}

/* Custom scrollbar cho danh sách ngân hàng */
.select2-results__options::-webkit-scrollbar {
  width: 8px;
}

.select2-results__options::-webkit-scrollbar-track {
  background: rgba(240, 240, 240, 0.6);
  border-radius: 6px;
}

.select2-results__options::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3ab5ff, #2b9ee0);
  border-radius: 6px;
}

.select2-results__options::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #2b9ee0, #1d8cd1);
}

/* --- KHUNG TỔNG --- */
.container {
  display: flex;
  width: 90%;
  max-width: 1100px;
  min-height: 600px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

/* --- FORM TRÁI --- */
.form-section {
  flex: 1;
  width: 50%;
  padding: 40px 30px;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
}

/* --- PREVIEW PHẢI --- */
.preview-section {
  flex: 1;
  width: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    180deg,
    rgba(240, 250, 255, 0.8),
    rgba(255, 255, 255, 0.9)
  );
  padding: 40px;
}

.qr-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 450px;
}

canvas {
  width: 100%;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* --- RESPONSIVE --- */
@media (max-width: 992px) {
  .container {
    flex-direction: column;
  }
  .form-section,
  .preview-section {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 25px;
  }
}


/* Rút gọn text trong dropdown list */
.select2-results__option span {
  display: inline-block;
  max-width: 400px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

