
/* =====================================================
   CARD SYSTEM
===================================================== */

.card {
  width: 100%;
  margin: 10px 0;
  padding: 14px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* 📱 Mobile giảm lề trong card */
@media (max-width: 767px) {
  .card {
    padding: 12px 10px;
    margin: 8px 0;
  }
}


/* card lớn hơn cho desktop */
@media (min-width: 768px) {
  .card {
    border-radius: 16px;
  }
}


/* =====================================================
   PAGE TITLE
===================================================== */

.view-title {
  margin: 0 0 16px;
  text-align: center;
}


/* =====================================================
   FORM LAYOUT (SHARED ACROSS ALL FORMS)
===================================================== */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* 📱 Mobile giảm gap để tăng diện tích ô */
@media (max-width: 767px) {
  .form-grid {
    gap: 8px 10px; /* row-gap 8px, column-gap 10px */
  }
}


/* Mobile span */
.col-2 { grid-column: span 1; }  /* mỗi field = 1 cột */
.col-4 { grid-column: span 2; }  /* full width */


/* Tablet giữ nguyên 2 cột */
@media (min-width: 768px) {
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop 4 cột chuẩn hệ cũ */
@media (min-width: 1200px) {
  .form-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .col-2 { grid-column: span 2; }
  .col-4 { grid-column: span 4; }
}


/* =====================================================
   FIELD + INPUT
===================================================== */

.field {
  display: flex;
  flex-direction: column;
}

label {
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 16px;
}

/* 📱 Mobile input gọn hơn */
@media (max-width: 767px) {
  input,
  select,
  textarea {
    padding: 8px 10px;
    font-size: 15px;
  }
}



textarea {
  resize: vertical;
  min-height: 96px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #1976d2;
}

input[readonly],
select[readonly],
textarea[readonly] {
  background: #f5f5f5;
}


/* =====================================================
   BUTTONS
===================================================== */

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  margin-top: 16px;
  border: none;
  border-radius: 10px;
  background: #1976d2;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

button:active { opacity: .9; }
button:disabled { opacity: .5; cursor: default; }

.btn-secondary {
  background: #e0e0e0;
  color: #333;
}


/* =====================================================
   ACTION ROW (FORM BUTTON GROUP)
===================================================== */

.action-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.action-row button {
  margin-top: 0;
  min-width: 120px;
}


/* =====================================================
   SIMPLE CENTERED VIEW (LOGIN / MST / CHANGE PW)
===================================================== */

.view-single-col {
  display: flex;
  justify-content: center;
}

.view-single-col .card {
  width: 100%;
  max-width: 360px;
}

.single-form {
  display: flex;
  flex-direction: column;
}


/* =====================================================
   PASSWORD TOGGLE
===================================================== */

.password-wrapper {
  position: relative;
}

.toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  user-select: none;
}


/* =====================================================
   MENU LIST (HOME, ACCOUNT, FEATURE LISTS)
===================================================== */

.menu-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 10px;
  background: #f9fafb;
  cursor: pointer;
  transition: background 0.15s ease;
}

.menu-row:hover {
  background: #eef2f7;
}

.menu-icon {
  font-size: 20px;
  width: 28px;
  text-align: center;
}

.menu-text {
  font-weight: 600;
}


/* =====================================================
   LARGE MENU (ACCOUNT PAGE)
===================================================== */

.menu-list-large {
  margin-top: 8px;
  gap: 14px;
}

.menu-row-large {
  padding: 18px;
  border-radius: 12px;
  background: #f3f6fb;
}

.menu-row-large:hover {
  background: #e7eef9;
}

.menu-icon-large {
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border-radius: 50%;
  background: #e3ebf8;
}

.menu-row-danger {
  background: #fdecea;
}

.menu-row-danger:hover {
  background: #f8d7da;
}

.menu-row-danger .menu-text {
  color: #c62828;
}


/* =====================================================
   HOME USER INFO CARD (TEXT STYLE ONLY)
===================================================== */

.home-user-card {
  background: transparent;
  box-shadow: none;
  border: none;
  cursor: default;
  padding: 0;
}

.home-user-card .menu-text {
  display: flex;
  flex-direction: column;
}

.home-user-card .home-name {
  font-size: 16px;
  font-weight: 700;
}

.home-user-card .home-title {
  font-size: 14px;
  color: #555;
  margin-top: 2px;
}

.home-user-card:hover {
  background: transparent;
}
.home-user-card:active {
  transform: none;
}


/* =====================================================
   STATE / UTILITY
===================================================== */

.hidden { display: none !important; }

.error {
  margin-top: 8px;
  font-size: 14px;
  color: #d32f2f;
  text-align: center;
}


/* =====================================================
   BACK BUTTON ICON
===================================================== */

.back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.back-btn::before {
  content: "";
  width: 10px;
  height: 10px;
  border-left: 3px solid #1976d2;
  border-bottom: 3px solid #1976d2;
  transform: rotate(45deg);
  margin-left: 4px;
}

.back-btn:active {
  background: rgba(25,118,210,.12);
}


/* ===== VIEW HEADER (DÙNG CHO MỌI VIEW CON) ===== */
.view-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.view-header .view-title {
  margin: 0;
  text-align: left;
}

/* ===== RESULT STATE ICON ===== */
.status-icon {
  font-size: 48px;
  margin-bottom: 12px;
  text-align: center;
}

.center {
  text-align: center;
}



/* ===== LIST VERTICAL ===== */
.list-vertical {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

/* ===== SMALL CARD (history item) ===== */
.card-sm {
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

/* time */
.item-title {
  font-weight: 600;
  margin-bottom: 4px;
}

/* status badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.badge-ok {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-pending {
  background: #fff3e0;
  color: #ef6c00;
}

/* map link */
.map-link {
  display: inline-block;
  margin-top: 4px;
  font-size: 14px;
}


/* ================= LIST ITEM CARD ================= */
.list-item {
  padding: 12px;
  border-radius: 12px;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Dòng thời gian */
.list-item-title {
  font-weight: 600;
  font-size: 14px;
}

/* Trạng thái */
.list-item-status {
  font-size: 13px;
  font-weight: 600;
}

/* Màu trạng thái (dùng chung cho toàn app) */
.status-CHO_DUYET { color: #f57c00; }
.status-DA_DUYET  { color: #2e7d32; }
.status-TU_CHOI   { color: #d32f2f; }
.status-DA_HUY    { color: #9e9e9e; }

/* Mô tả phụ */
.list-item-desc {
  font-size: 13px;
  color: #555;
}

/* Nút phụ (Huỷ đơn) */
.btn-outline-danger {
  align-self: flex-start;
  background: #fff;
  color: #d32f2f;
  border: 1px solid #d32f2f;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}


/* Checkbox nằm cùng hàng label */
.checkbox-field {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.checkbox-field label {
  margin: 0;
  font-weight: 600;
}

.checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
}


/* ===== LIST LAYOUT (UNIFIED) ===== */
.list-container {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
}

.list-item {
  padding: 14px 0;
  border-bottom: 1px solid #eee;
}

.list-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.list-row {
  font-size: 13px;
  color: #444;
  margin-top: 2px;
}

.list-status {
  margin-top: 6px;
  font-weight: 600;
  font-size: 13px;
}

/* Trạng thái dùng chung hệ màu duyệt */
.list-status.CHO_DUYET { color: #f57c00; }
.list-status.DA_DUYET  { color: #2e7d32; }
.list-status.TU_CHOI   { color: #d32f2f; }
.list-status.DA_HUY    { color: #9e9e9e; }

/* Nút outline cảnh báo */
.btn-danger-outline {
  margin-top: 8px;
  background: #fff;
  color: #d32f2f;
  border: 1px solid #d32f2f;
}

.btn-small {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
}


/* =========================================
   FORM VISUAL ENHANCEMENTS (GLOBAL)
========================================= */

/* Nhóm field có khoảng thở tốt hơn */
.form-grid {
  row-gap: 14px; /* thay vì 12px mặc định */
}

/* Field readonly nổi bật nhẹ để phân biệt */
input[readonly] {
  background: #f3f6fb;
  border-color: #d6e0f5;
  font-weight: 600;
}

/* Checkbox căn trục đẹp hơn */
.checkbox-field {
  align-items: center;
  gap: 8px;
}

.checkbox-field input[type="checkbox"] {
  transform: scale(1.1);
}

/* Tổng số ngày nghỉ nổi bật vì là kết quả */
#dt_tong_so_ngay {
  font-weight: 700;
  color: #1976d2;
}

/* Textarea dễ nhìn hơn */
textarea {
  line-height: 1.5;
}

/* Nút hành động chính */
#btnCreateDonTu {
  min-width: 160px;
  font-size: 16px;
}



/* =====================================================
   FORM OVERLAY (UNIFIED DESKTOP + MOBILE)
===================================================== */

/* 🔥 Lớp phủ luôn là fixed */
.view-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;

  /* 🔥 QUAN TRỌNG */
  overflow: hidden; /* tránh double scroll */
}

/* 🔥 Khung form (Desktop default) */
.view-overlay .card {
  width: 100%;
  max-width: 880px;
  max-height: 90vh;

  /* scroll nội bộ */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  
  /* Lề rộng cho Desktop để tránh bấm nhầm ra ngoài */
  padding: 28px 42px; 

  border-radius: 18px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);

  animation: overlayFadeIn .18s ease;
}

/* =====================================================
   📱 MOBILE = FULL SCREEN OVERLAY
===================================================== */
@media (max-width: 767px) {
  .view-overlay {
    /* 🔥 VẪN FIXED, KHÔNG static */
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    background: #fff; /* mobile giống app native */
  }

  .view-overlay .card {
    width: 100%;
    height: 100%;

    max-width: none;
    max-height: none;

    /* Reset lề cho mobile: Trên/Dưới 16px, Trái/Phải 16px (đưa dữ liệu ra sát lề) */
    padding: 16px 16px; 

    border-radius: 0;
    box-shadow: none;

    animation: none;
  }
}

/* =====================================================
   ANIMATION
===================================================== */
@keyframes overlayFadeIn {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}



/* ===== TOAST NOTIFICATION ===== */
.toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 3000;
}

.toast {
  padding: 12px 16px;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  min-width: 220px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  animation: toast-in .25s ease;
}

.toast-success { background: #2e7d32; }
.toast-error   { background: #c62828; }
.toast-info    { background: #1565c0; }

.toast-hide {
  opacity: 0;
  transform: translateX(20px);
  transition: all .3s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}


/* =====================================================
   OVERLAY MINI
===================================================== */
.overlay-mini {
  position: absolute;
  z-index: 9999;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  min-width: 220px;
  max-width: 360px;
  
  /* Giới hạn chiều cao tương đương 5 mục, cuộn dọc nếu vượt quá */
  max-height: 360px;
  overflow-y: auto;
  
  /* Animation xuất hiện nhẹ nhàng */
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

.overlay-mini.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Custom Scrollbar gọn đẹp */
.overlay-mini::-webkit-scrollbar {
  width: 6px;
}
.overlay-mini::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
.overlay-mini::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.overlay-mini::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Item bên trong Overlay Mini */
.overlay-mini-item {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  font-size: 13px;
  color: #334155;
  transition: background 0.2s;
}
.overlay-mini-item:last-child {
  border-bottom: none;
}
.overlay-mini-item:hover {
  background-color: #f8fafc;
}
.overlay-mini-item.unread {
  background-color: #f0f9ff;
  font-weight: 600;
}

/* =====================================================
   GLOBAL SEARCH / SELECT RESULT
===================================================== */

.search-select {
  display: flex;
  flex-direction: column;

  width: 100%;
  max-height: min(420px, 60vh);

  overflow: hidden;

  background: #fff;
}


/* =====================================================
   HEADER

   Thanh rất mỏng.
   Chỉ dùng để giữ nút đóng cố định phía trên.
===================================================== */

.search-select-header {
  flex: 0 0 32px;

  display: flex;
  align-items: center;
  justify-content: flex-end;

  height: 32px;
  min-height: 32px;

  padding: 0 1px;

  box-sizing: border-box;

  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}


/* =====================================================
   CLOSE
===================================================== */

.search-select-close {
  flex: 0 0 30px;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 30px;
  height: 30px;

  padding: 0;
  margin: 0;

  border: 0;
  background: transparent;

  font-size: 22px;
  line-height: 1;
  color: #64748b;

  cursor: pointer;
}

.search-select-close:hover {
  background: #f1f5f9;
  border-radius: 6px;
}


/* =====================================================
   LIST

   Chỉ phần này được scroll.
===================================================== */

.search-select-list {
  flex: 1 1 auto;
  min-height: 0;

  overflow-y: auto;
  overscroll-behavior: contain;

  -webkit-overflow-scrolling: touch;
}


/* =====================================================
   ITEM
===================================================== */

.search-select-item {
  display: block;

  width: 100%;

  padding: 9px 12px;

  border: 0;
  border-bottom: 1px solid #f1f5f9;

  background: #fff;

  text-align: left;
  font: inherit;

  cursor: pointer;
}

.search-select-item:hover {
  background: #f8fafc;
}


/* =====================================================
   TEXT
===================================================== */

.search-select-main {
  font-size: 13.5px;
  font-weight: 600;
  color: #334155;
}

.search-select-sub {
  margin-top: 2px;

  font-size: 12px;
  color: #64748b;
}


/* =====================================================
   EMPTY
===================================================== */

.search-select-empty {
  padding: 18px 12px;

  text-align: center;

  font-size: 13px;
  color: #64748b;
}



/* ===== LIST TOOLBAR (FILTER + ACTION) ===== */
.checkin-toolbar {
  align-items: end;
}

.toolbar-btn-wrap {
  display: flex;
  justify-content: flex-end;
}

.toolbar-btn-wrap button {
  margin-top: 0;
  min-width: 140px;
}

/* Mobile: xếp dọc cho dễ bấm */
@media (max-width: 767px) {
  .toolbar-btn-wrap {
    justify-content: stretch;
  }
}


/* ===== FORM GRID 65:35 — CĂN LỀ CHUẨN NHƯ FIELD ===== */
.form-grid-65 {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 65% 35%;
  gap: 8px;
  width: 100%;           /* 🔥 QUAN TRỌNG */
  justify-self: stretch; /* 🔥 FIX LỆCH GRID NESTED */

  /* 🔥 QUAN TRỌNG: tạo padding giống .field col-4 */
  padding: 0 4px;
  box-sizing: border-box;
}


/* Desktop trở về layout chuẩn */
@media (min-width: 768px) {
  .form-grid-65 {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===== DETAIL 2-COLUMN LAYOUT (SHARED) ===== */

.detail-grid {
  display: grid;
  grid-template-columns: 30% 70%;
  row-gap: 10px;
  column-gap: 12px;
  margin-top: 8px;
}

.detail-label {
  font-weight: 600;
  color: #444;
}

.detail-value {
  white-space: pre-wrap;
  word-break: break-word;
}


/* ================= DETAIL VIEW WIDTH CONTROL ================= */

/* Mặc định (mobile & desktop full page) */
.detail-view {
  max-width: 100%;
}

/* Khi nằm trong overlay (desktop) → thu hẹp giống mobile form */
.view-overlay .detail-view {
  max-width: 520px;
  margin: 0 auto;
}

.detail-value-strong {
  font-weight: 700;
  color: #1976d2;
}


/* ===== DESTRUCTIVE ACTION BUTTON (TEXT RED) ===== */
.btn-danger-text {
  background: #f1f3f5;   /* xám nhạt đồng bộ với nút IN */
  color: #d32f2f;        /* đỏ cảnh báo */
  border: none;
}

.btn-danger-text:hover {
  background: #e2e6ea;
}

/* ===== HEADER TOOL BUTTON (PRINT / EXPORT / ETC) ===== */
.header-tool-btn {
  margin-left: auto;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  background: #f1f3f5;
  color: #444;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.header-tool-btn:hover {
  background: #e2e6ea;
}