/* ==========================================================================
   CUSTOM DATE PICKER
   Menggantikan kalendar native pelayar dengan popup tersuai supaya rupanya
   konsisten pada semua peranti (Chrome, Safari, Firefox) dan mengikut tema.

   Ciri (mengikut rujukan resort-hululangat):
   - popup putih, radius 4px, shadow kuat
   - tajuk "October 2026" bold + chevron kiri/kanan
   - baris hari: Ah Is Se Ra Kh Ju Sa (11px, bold, kelabu)
   - sel hari 45x45, hover bulat, hari dipilih biru
   - footer: Reset | label | butang Selesai (emas)

   Input asal KEKAL sebagai sumber nilai - skrip menulis ke .value dan
   mencetuskan 'change', jadi semua pengiraan hari dan hantar borang tidak
   berubah sama sekali.
   ========================================================================== */

.dpk-pop{
  position:absolute;
  z-index:9000;
  background:#f7f8fa;
  border-radius:4px;
  padding:20px;
  width:380px;
  box-shadow:0 6px 12px rgba(0,0,0,.45), 0 16px 32px rgba(0,0,0,.5);
  font-family:'Manrope', system-ui, sans-serif;
  color:#14202e;
  -webkit-user-select:none; user-select:none;
}
.dpk-pop.hidden{display:none;}

/* ---------- kepala ---------- */
.dpk-head{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:14px;
}
.dpk-title{
  font-size:16px; font-weight:700; color:#14202e; letter-spacing:.01em;
}
.dpk-nav{
  display:flex; align-items:center; gap:6px;
}
.dpk-nav button{
  width:32px; height:32px;
  display:flex; align-items:center; justify-content:center;
  background:transparent; border:none; border-radius:4px;
  color:#14202e; cursor:pointer; padding:0;
  transition:background .15s;
}
.dpk-nav button:hover{background:rgba(20,32,46,.07);}
.dpk-nav .material-icons-round{font-size:20px;}

/* ---------- hari dalam minggu ---------- */
.dpk-dow{
  display:grid; grid-template-columns:repeat(7,1fr);
  margin-bottom:6px;
}
.dpk-dow span{
  text-align:center;
  font-size:11px; font-weight:600; color:#4f5f73;
  letter-spacing:.06em;
}

/* ---------- grid hari ---------- */
.dpk-grid{
  display:grid; grid-template-columns:repeat(7,1fr);
  gap:0;
}
.dpk-day{
  height:45px;
  display:flex; align-items:center; justify-content:center;
  font-size:14px; font-weight:400; color:#14202e;
  background:transparent; border:none; border-radius:50%;
  cursor:pointer; padding:0;
  transition:background .15s, color .15s;
}
.dpk-day:hover:not(:disabled){background:rgba(20,32,46,.08);}
.dpk-day.muted{color:#cfd8e5; cursor:default;}
.dpk-day.disabled{color:#cfd8e5; cursor:not-allowed;}
.dpk-day.today{font-weight:700; box-shadow:inset 0 0 0 1px rgba(20,32,46,.22);}
.dpk-day.selected{
  background:#2563eb; color:#fff; font-weight:600;
}
.dpk-day.in-range{
  background:rgba(37,99,235,.14); color:#14202e; border-radius:0;
}
.dpk-day.range-start{border-radius:50% 0 0 50%;}
.dpk-day.range-end{border-radius:0 50% 50% 0;}

/* ---------- kaki ---------- */
.dpk-foot{
  display:flex; align-items:center; justify-content:space-between;
  margin-top:16px; gap:8px;
}
.dpk-reset{
  display:flex; align-items:center; gap:6px;
  background:transparent; border:none; border-radius:4px;
  color:#1d4986; font-size:13.5px; font-weight:600;
  padding:8px 14px; cursor:pointer;
  transition:background .15s;
}
.dpk-reset:hover{background:rgba(29,73,134,.08);}
.dpk-reset .material-icons-round{font-size:17px;}

.dpk-hint{
  flex:1;
  text-align:center;
  font-size:13px; color:#4f5f73;
}

.dpk-done{
  background:#b8860b;
  color:#fff; border:none; border-radius:4px;
  font-family:inherit; font-size:13.5px; font-weight:700;
  padding:8px 18px; cursor:pointer;
  transition:background .15s;
}
.dpk-done:hover{background:#a37809;}

/* ---------- input tarikh: ikon kalendar, seluruh medan boleh klik ---------- */
input[type='date']{
  position:relative;
  padding-right:40px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c9a24b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M8 3v4M16 3v4M3 10h18'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 11px center;
  background-size:20px 20px;
  cursor:pointer;
}
/* sembunyikan penunjuk native - kita guna popup sendiri */
input[type='date']::-webkit-calendar-picker-indicator{
  position:absolute; inset:0; width:100%; height:100%;
  margin:0; padding:0; opacity:0; cursor:pointer;
}

@media(max-width:480px){
  .dpk-pop{
    width:min(340px, calc(100vw - 24px));
    padding:16px;
  }
  .dpk-day{height:40px; font-size:13.5px;}
}


/* ---------- satu baris jarak tarikh (mula -> tamat) ---------- */
.dpk-range{
  display:flex;
  align-items:center;
  gap:10px;
}
.dpk-range input[type='date']{
  flex:1;
  min-width:0;              /* biar kedua-dua medan mengecil sama rata */
}
.dpk-range-sep{
  color:var(--md-text-secondary, #9a948a);
  font-size:18px;
  flex:0 0 auto;
}
.dpk-range-hint{
  display:block;
  margin-top:8px;
  font-size:12.5px;
  color:var(--md-text-secondary, #9a948a);
  line-height:1.5;
}
@media(max-width:520px){
  .dpk-range{flex-direction:column; align-items:stretch; gap:8px;}
  .dpk-range-sep{display:none;}
}
