/* ===== BIẾN MÀU CHỦ ĐẠO ===== */
:root {
  --primary: #238558;
  --primary-light: #2da76b;
  --primary-dark: #1d6e49;
  --blue: #0d6efd;
  --bg: #f8f9fa;
  --text-dark: #111;
  --text-gray: #666;
}

/* ===== CƠ BẢN ===== */
html, body {
  background: var(--bg);
  color: var(--text-dark);
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ===== CARD TILE (dạng ô vuông trên trang chính) ===== */
.card-tile a {
  display: block;
  border-radius: 14px;
  padding: 18px 16px;
  background: #fff;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
  text-decoration: none;
  color: var(--text-dark);
  transition: transform .12s ease, box-shadow .12s ease;
}
.card-tile a:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0,0,0,.1);
}
.card-tile .desc {
  color: var(--text-gray);
  font-size: .95rem;
  margin: 4px 0 0;
}

/* ===== GRID LAYOUT ===== */
.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(1, minmax(0, 1fr));
}
@media (min-width: 576px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 992px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}

/* =======================================================
   CARD CHUẨN HOÁ TOÀN HỆ (ADMIN + MOBILE)
   ======================================================= */
.card {
  border-radius: 12px;
  overflow: hidden; /* giúp header & body liền mạch */
  margin-bottom: 24px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
  background: #fff;
  box-sizing: border-box;
}

/* Căn giữa toàn bộ card khi ở màn hình hẹp */
.main-content {
  padding: 20px;
}

/* ===== CARD HEADER ===== */
.card-header {
  border: none;
  border-radius: 0;
  padding: 12px 16px;
  font-weight: 600;
  color: #fff;
}

/* Màu nền card-header */
.card-header.bg-primary {
  background-color: #0069d9 !important; /* xanh dương dịu */
}
.card-header.bg-success {
  background-color: var(--primary) !important; /* xanh thương hiệu XPĐĐ */
}

/* Gradient nhẹ cho tone XPĐĐ (nhìn sang hơn, có thể bỏ nếu muốn phẳng) */
.card-header.bg-success {
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
}

/* Gỡ bo tròn riêng của Bootstrap gây lệch góc */
.card > .card-header:first-child {
  border-radius: 0 !important;
  margin: 0 !important;
}

/* ===== CARD BODY ===== */
.card-body {
  padding: 1rem 1.25rem;
  background: #fff;
}

/* ===== BẢNG & NÚT ===== */
.table {
  font-size: 1rem;
}
.btn {
  font-weight: 500;
  border-radius: 8px;
}

/* =======================================================
   RESPONSIVE TOÀN HỆ (MOBILE ≤ 1000px)
   ======================================================= */
@media (max-width: 1000px) {
  .container,
  .container-fluid,
  .main-content,
  .table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    box-sizing: border-box;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 10px !important;
  }

  /* ==== CARD ==== */
  .card {
    width: 100% !important;
    margin: 0 auto 24px auto !important;
    border-radius: 12px !important; /* giữ bo cong như màn lớn */
    overflow: hidden !important;    /* để header khớp viền */
    box-sizing: border-box;
  }

  /* ==== CARD HEADER ==== */
  .card-header {
    border-radius: 12px 12px 0 0 !important; /* cong 2 góc trên */
    padding: 10px 12px !important;
    font-size: 1rem;
  }

  /* ==== CARD BODY ==== */
  .card-body {
    border-radius: 0 0 12px 12px !important; /* cong 2 góc dưới */
    padding: 0.75rem 1rem !important;
  }

  /* ==== BẢNG + NÚT ==== */
  .table {
    font-size: 0.95rem !important;
  }

  h4, h5 {
    font-size: 1.1rem;
  }

  .btn {
    width: 100%;
    display: block;
  }
}


.user-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.user-box span {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-box a {
  flex-shrink: 0;
}

/* ===== MINI NAV (cho mobile đo đạc) ===== */
.mini-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: #fff;
  border-top: 1px solid #ddd;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.05);
  z-index: 999;
  padding: 6px 0;
  font-size: 1.4rem;
}
.mini-nav a {
  color: #666;
  text-decoration: none;
  text-align: center;
  flex: 1;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.2s ease;
}
.mini-nav a span {
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 3px;
}
.mini-nav a.active {
  color: #238558;
  font-weight: 600;
}
.mini-nav a.active span {
  color: #238558;
}
.mini-nav a:active {
  transform: scale(0.95);
}


.card-header.bg-success {
  background: #238558 !important;
}
.card-body form input, 
.card-body form select {
  font-size: 0.95rem;
}



/* ===== ADMIN NAV BAR (fixed bottom giống mobile) ===== */
.admin-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: #fff;
  border-top: 1px solid #ddd;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.05);
  z-index: 999;
  padding: 6px 0;
  font-size: 1.3rem;
}

.admin-nav a {
  color: #555;
  text-decoration: none;
  text-align: center;
  flex: 1;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.2s ease;
}

.admin-nav a span {
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 3px;
}

.admin-nav a.active {
  color: #238558;
  font-weight: 600;
}

.admin-nav a.active span {
  color: #238558;
}

.admin-nav a:active {
  transform: scale(0.95);
}


/* ===== CARD TILE CĂN GIỮA & MÀU NHẸ ===== */
.card-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 16px;
  padding: 28px 18px;
  color: #111;
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
  transition: transform .15s ease, box-shadow .15s ease;
}
.card-tile a {
  color: inherit;
  text-decoration: none;
  display: block;
  width: 100%;
}
.card-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}
.card-tile .desc {
  color: #444;
  font-size: 0.95rem;
  margin-top: 4px;
}

/* ===== TONE MÀU NHẸ KHÁC NHAU ===== */
.tile-1 { background: #e6f4ea; }   /* xanh nhạt (tính tiền) */
.tile-2 { background: #fff6e5; }   /* vàng nhạt (đăng ký) */
.tile-3 { background: #eaf1ff; }   /* xanh dương nhạt (danh sách) */
.tile-4 { background: #f9e8f3; }   /* hồng tím nhạt (quản lý) */

/* ===== GRID GỌN GÀNG ===== */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(1, 1fr);
  margin-bottom: 80px; /* chừa chỗ cho navbar */
}
@media (min-width: 576px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 992px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}



/* ===== KHOẢNG CÁCH CHUẨN CHO NÚT (BUTTON & LINK) ===== */
.btn {
  margin-bottom: 12px;      /* cách phía dưới */
  margin-right: 8px;        /* cách ngang giữa các nút */
}

/* Giãn hơn chút trên mobile để dễ bấm */
@media (max-width: 768px) {
  .btn {
    margin-bottom: 16px;
    margin-right: 10px;
  }
}




/* ===== NÚT ≤ / < GỌN & CĂN HÀNG HOÀN HẢO ===== */
.toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: calc(2rem); /* khớp chiều cao input Bootstrap */
  width: 32px;
  margin-left: -6px;
  margin-right: 6px;
  padding: 0;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #555;
  cursor: pointer;
  vertical-align: middle;
  transform: translateY(2px); /* căn giữa tuyệt đối */
}
.toggle-btn:hover {
  color: #000;
}
.toggle-btn.active {
  background-color: #238558;
  color: #fff;
}
@media (max-width: 576px) {
  .toggle-btn {
    width: 28px;
    height: calc(2rem);
    margin-left: -4px;
    margin-right: 4px;
    font-size: 0.85rem;
    transform: translateY(2px);
  }
}
/* ===== CĂN NÚT ≤ / < NGANG HÀNG VỚI INPUT ===== */
.d-flex.align-items-center .toggle-btn {
  height: calc(2.4rem + 2px);   /* khớp chiều cao input bootstrap */
  margin: 0 0 0 6px;            /* sát bên phải input */
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1;
  border: none;
  border-radius: 6px;
  background: #f1f3f5;
  color: #333;
  transform: translateY(1px);   /* hạ nhẹ 1px để căn chuẩn baseline */
  vertical-align: middle;
}
.d-flex.align-items-center .toggle-btn:hover {
  background: #e9ecef;
}
.d-flex.align-items-center .toggle-btn.active {
  background: #238558;
  color: #fff;
}
@media (max-width: 768px) {
  .d-flex.align-items-center .toggle-btn {
    height: calc(2rem + 2px);
    font-size: 0.85rem;
    transform: translateY(1px);
  }
}
