/* public/css/rac-com.css — CSS cho Hộp Rắc Cơm, Mục Tiền, Tường Cơm & Sổ Thu Chi */

/* 1. Hộp Dialog Rắc Cơm */
dialog#hop-rac-com {
  border: none;
  border-radius: 16px;
  padding: 0;
  margin: auto; /* chung.css reset margin:0 làm hộp dính góc trên trái */
  max-width: 480px;
  width: calc(100% - 32px);
  box-shadow: 0 20px 40px rgba(4, 18, 47, 0.25);
  background: #ffffff;
  color: var(--mau-chu, #04122f);
  overflow: hidden;
}

dialog#hop-rac-com::backdrop {
  background: rgba(4, 18, 47, 0.6);
  backdrop-filter: blur(3px);
}

.hop-rac-com-dau {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #f7f8fb;
  border-bottom: 1px solid #e2e8f0;
}

.hop-rac-com-dau h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #082054;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nut-dong-hop {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}

.nut-dong-hop:hover {
  background: #e2e8f0;
  color: #04122f;
}

.hop-rac-com-than {
  padding: 20px;
  max-height: calc(85vh - 70px);
  overflow-y: auto;
}

/* Bước 1: Chọn món & nhập thông tin */
.luoi-mon {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.the-mon-chon {
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
  cursor: pointer;
  background: #ffffff;
  transition: all 0.15s ease;
  user-select: none;
}

.the-mon-chon:hover {
  border-color: #00a9cc;
  background: #f0fafd;
}

.the-mon-chon.dang-chon {
  border-color: #00a9cc;
  background: #e6f7fa;
}

.the-mon-chon .ten-mon {
  font-weight: 600;
  font-size: 0.95rem;
  color: #082054;
  display: block;
}

.the-mon-chon .gia-mon {
  font-size: 0.85rem;
  color: #00829e;
  font-weight: 700;
  margin-top: 4px;
  display: block;
}

.khung-tu-nhap {
  grid-column: 1 / -1;
  margin-top: 4px;
}

.khung-tu-nhap input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
  box-sizing: border-box;
}

.nhom-nhap {
  margin-bottom: 14px;
}

.nhom-nhap label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #1e293b;
}

.nhom-nhap input[type="text"],
.nhom-nhap textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  box-sizing: border-box;
}

.nhom-nhap input.loi,
.nhom-nhap textarea.loi {
  border-color: #ef4444;
  background: #fef2f2;
}

.thong-bao-loi {
  color: #ef4444;
  font-size: 0.8rem;
  margin-top: 4px;
}

.hang-an-danh {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.85rem;
  color: #475569;
}

.dem-ky-tu {
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: right;
  margin-top: 2px;
}

.nut-tao-qr {
  width: 100%;
  padding: 12px;
  background: #00a9cc;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.nut-tao-qr:hover {
  background: #008fae;
}

.nut-tao-qr:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

/* Bẫy web (honeypot) */
.o-bay-web {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

/* Bước 2: Hiển thị QR và chuyển khoản */
.khung-qr-wrap {
  text-align: center;
}

.anh-qr {
  max-width: 240px;
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  margin: 0 auto 12px;
  display: block;
  background: #fff;
}

.so-tien-to {
  font-size: 1.6rem;
  font-weight: 800;
  color: #082054;
  margin: 8px 0;
}

.thong-tin-ck {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  text-align: left;
  margin-bottom: 14px;
  font-size: 0.9rem;
}

.dong-ck {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed #e2e8f0;
}

.dong-ck:last-child {
  border-bottom: none;
}

.nhan-ck {
  color: #64748b;
  font-size: 0.85rem;
}

.gia-tri-ck {
  font-weight: 600;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nut-chep {
  background: #e2e8f0;
  border: none;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  color: #334155;
}

.nut-chep:hover {
  background: #cbd5e1;
}

.nhac-ck {
  font-size: 0.85rem;
  color: #b45309;
  background: #fef3c7;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  line-height: 1.4;
}

.dem-nguoc-hen-gio {
  font-size: 0.9rem;
  color: #dc2626;
  font-weight: 700;
  margin-bottom: 12px;
}

.nut-da-chuyen {
  width: 100%;
  padding: 10px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.nhac-mobile-qr {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 8px;
}

/* Bước 3: Kết quả */
.khung-ket-qua {
  text-align: center;
  padding: 20px 10px;
}

.icon-ket-qua {
  font-size: 3rem;
  margin-bottom: 12px;
}

.thong-diep-ket-qua {
  font-size: 1.1rem;
  font-weight: 700;
  color: #082054;
  line-height: 1.5;
  margin-bottom: 16px;
}

/* Hiệu ứng bong bóng nước khi nhận cơm thành công */
.bong-bong-hoat-hoa {
  position: relative;
  overflow: hidden;
}

@keyframes bongBongBay {
  0% { transform: translateY(20px) scale(0.8); opacity: 0; }
  50% { opacity: 0.8; }
  100% { transform: translateY(-80px) scale(1.2); opacity: 0; }
}

.hat-bong-bong {
  position: absolute;
  background: rgba(0, 169, 204, 0.4);
  border-radius: 50%;
  pointer-events: none;
  animation: bongBongBay 2s ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {
  .hat-bong-bong {
    animation: none;
    display: none;
  }
}

/* 2. Mục #tien "Bống đã kiếm được bao nhiêu" */
.luoi-tien {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.the-tien {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 2px 4px rgba(4, 18, 47, 0.04);
}

.the-tien .nhan-tien {
  font-size: 0.85rem;
  color: #64748b;
  display: block;
  margin-bottom: 6px;
}

.the-tien .so-tien {
  font-size: 1.25rem;
  font-weight: 700;
  color: #082054;
  font-family: monospace, inherit;
}

.the-tien.so-du .so-tien {
  color: #059669;
}

.khung-gieng-com {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.thanh-tien-do-wrap {
  background: #e2e8f0;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  margin: 10px 0 6px;
}

.thanh-tien-do {
  background: linear-gradient(90deg, #00a9cc, #059669);
  height: 100%;
  border-radius: 7px;
  transition: width 0.4s ease;
}

.thong-tin-gieng {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #475569;
}

.chan-muc-tien {
  text-align: right;
  margin-top: 10px;
}

.link-xem-so {
  color: #00a9cc;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.link-xem-so:hover {
  text-decoration: underline;
}

/* 3. Mục #tuong "Bức tường cơm" */
.luoi-tuong-com {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.the-tuong-com {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 2px 4px rgba(4, 18, 47, 0.04);
}

.tuong-com-dau {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.tuong-com-ten {
  font-weight: 700;
  color: #082054;
  font-size: 0.95rem;
}

.tuong-com-thoi-gian {
  font-size: 0.75rem;
  color: #94a3b8;
}

.tuong-com-mon {
  font-size: 0.85rem;
  color: #00829e;
  font-weight: 600;
  margin-bottom: 6px;
}

.tuong-com-loi-nhan {
  font-size: 0.85rem;
  color: #334155;
  background: #f8fafc;
  padding: 8px 10px;
  border-radius: 8px;
  font-style: italic;
  line-height: 1.4;
  word-break: break-word;
}

/* 4. Trang Sổ Thu Chi (/so/) */
.khung-so-wrap {
  margin: 30px auto;
  max-width: 960px;
}

.thanh-chon-thang {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.nut-chuyen-thang {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: bold;
}

.nut-chuyen-thang:hover {
  background: #f1f5f9;
}

.thang-hien-tai-chu {
  font-size: 1.25rem;
  font-weight: 700;
  color: #082054;
}

.bang-so {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(4, 18, 47, 0.04);
  border: 1px solid #e2e8f0;
}

.bang-so th {
  background: #f8fafc;
  padding: 12px 14px;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
}

.bang-so td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.9rem;
  color: #1e293b;
}

.bang-so tr:last-child td {
  border-bottom: none;
}

.pill-loai {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.pill-loai.thu {
  background: #d1fae5;
  color: #065f46;
}

.pill-loai.chi {
  background: #fee2e2;
  color: #991b1b;
}

.danh-sach-the-so {
  display: none;
}

.the-so-mobile {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}

.the-so-mobile-dau {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.chu-thich-so {
  margin-top: 16px;
  font-size: 0.8rem;
  color: #64748b;
  font-style: italic;
  text-align: center;
}

/* 5. Responsive 375px */
@media (max-width: 640px) {
  .luoi-tien {
    grid-template-columns: repeat(2, 1fr);
  }

  .bang-so {
    display: none;
  }

  .danh-sach-the-so {
    display: block;
  }

  .luoi-mon {
    grid-template-columns: 1fr;
  }
}
