/* ============================================================
   NIMBUS — Điểm Danh Phụ Huynh (Module 2)
   Giữ cùng phong cách với Module 1.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;600;700&display=swap');

/* ---- Biến màu (giống Module 1) ---- */
:root {
    --p:      #e07b39;
    --pt:     #c2601a;
    --p-soft: #fff3eb;
    --ink:    #1a1a1a;
    --muted:  #888;
    --line:   #e5e7eb;
    --divider:#f0f0f0;
    --bg:     #f3f4f6;
    --r:      10px;
    --r-sm:   7px;
    --pill:   999px;
    --sh:     0 1px 4px rgba(0,0,0,.08);
    --sh2:    0 4px 16px rgba(0,0,0,.12);
    --red:    #c0392b;
    --red-bg: #fff0ef;
    --green:  #1a7a2e;
    --green-bg:#eaf6eb;
    --amber:  #8a6200;
    --amber-bg:#fffae0;
    --blue:   #1a56db;
    --blue-bg:#e8f0fe;
}

/* ---- Reset / Base ---- */
*, *::before, *::after { box-sizing: border-box; }
button, input, select, textarea { font-family: inherit; }

/* ---- Root container ---- */
#ddph-root {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
}

/* ---- Login ---- */
.ddph-login {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
    text-align: center;
    gap: 16px;
}
.ddph-login h2 { margin: 0; font-size: 22px; font-weight: 800; color: var(--pt); }
.ddph-login p  { margin: 0; color: var(--muted); font-size: 14px; max-width: 320px; line-height: 1.6; }
.ddph-msg { color: var(--red); font-size: 13px; min-height: 18px; }

/* ---- App layout ---- */
.ddph-app { display: flex; flex-direction: column; height: 100%; }

.ddph-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.ddph-brand { font-size: 16px; font-weight: 900; color: var(--pt); letter-spacing: 1px; }
.ddph-logo { height: 28px; width: auto; display: block; object-fit: contain; }
.ddph-logout {
    background: none; border: none; cursor: pointer; padding: 6px;
    color: var(--p); display: flex; align-items: center;
    transition: color .15s;
}
.ddph-logout:hover { color: var(--pt); }
.ddph-logout svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

#ddph-view { flex: 1; padding: 16px; }

/* ---- Buttons ---- */
.ddph-primary {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--p); color: #fff; border: none; border-radius: var(--r-sm);
    padding: 10px 18px; font-size: 13.5px; font-weight: 700; cursor: pointer;
    transition: background .15s;
}
.ddph-primary:hover { background: var(--pt); }
.ddph-primary:disabled { opacity: .55; cursor: default; }

.ddph-action {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--p-soft); color: var(--pt); border: 1px solid #f0c9a8;
    border-radius: var(--r-sm); padding: 8px 14px; font-size: 13px; font-weight: 700;
    cursor: pointer; transition: background .15s;
}
.ddph-action:hover { background: #fde8d4; }
.ddph-action:disabled { opacity: .55; cursor: default; }
.ddph-action.ph-btn-done { background: var(--green-bg); color: var(--green); border-color: #b0d9b5; }

/* ---- Loading / Empty ---- */
.ddph-loading { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }
.ddph-empty { text-align: center; color: var(--muted); padding: 48px 20px; font-size: 14px; line-height: 1.7; }

/* ---- Student cards ---- */
.ph-cards { display: flex; flex-direction: column; gap: 14px; max-width: 540px; margin: 0 auto; }

.ph-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 16px;
    box-shadow: var(--sh);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ph-card-name {
    font-size: 17px;
    font-weight: 800;
    color: var(--pt);
}
.ph-nick { font-size: 14px; font-weight: 500; color: var(--muted); }

.ph-schedule { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.ph-sched-tag {
    font-size: 11.5px; font-weight: 700;
    color: var(--pt); background: var(--p-soft);
    border-radius: var(--pill); padding: 2px 9px;
    white-space: nowrap;
}

.ph-card-period {
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 600;
}

.ph-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.ph-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg);
    border-radius: var(--r-sm);
    padding: 8px 4px;
    gap: 2px;
}
.ph-stat span {
    font-size: 20px;
    font-weight: 800;
    color: var(--ink);
    line-height: 1;
}
.ph-stat label {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .2px;
}
.ph-stat-warn { background: var(--red-bg); }
.ph-stat-warn span { color: var(--red); }

/* Stat box màu theo loại */
.ph-stat-total { background: var(--p-soft); }
.ph-stat-total span { color: var(--pt); }

.ph-stat-hoc { background: var(--green-bg); }
.ph-stat-hoc span { color: var(--green); }

.ph-stat-nghi { background: var(--amber-bg); }
.ph-stat-nghi span { color: var(--amber); }

.ph-stat-bu { background: var(--blue-bg); }
.ph-stat-bu span { color: var(--blue); }

.ph-stat-conlai-hi { background: var(--p-soft); }
.ph-stat-conlai-hi span { color: var(--pt); }

.ph-stat-conlai-mid { background: #fff8f3; }
.ph-stat-conlai-mid span { color: #d4904e; }

.ph-reg-bu { width: 100%; margin-top: 4px; }

/* ---- Makeup flow ---- */
.ph-flow-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.ph-flow-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.ph-back {
    background: var(--p); border: none; border-radius: var(--r-sm);
    padding: 7px 14px; font-size: 13px; font-weight: 700; color: #fff; cursor: pointer;
    white-space: nowrap; transition: background .15s;
}
.ph-back:hover { background: var(--pt); }

.ph-day-group {
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: #fff;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: var(--sh);
}
.ph-day-head {
    background: var(--p-soft);
    color: var(--pt);
    font-weight: 800;
    font-size: 13.5px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ph-day-head span { background: var(--p); border-radius: var(--pill); padding: 3px 10px; font-size: 12px; color: #fff; font-weight: 800; }

.ph-slot-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-top: 1px solid var(--divider);
    flex-wrap: wrap;
}
.ph-slot-info { flex: 1; min-width: 160px; font-size: 13.5px; }
.ph-slot-info b { font-weight: 800; color: var(--pt); }
.ph-free-badge {
    background: var(--green-bg); color: var(--green);
    border-radius: var(--pill); padding: 3px 10px;
    font-size: 11.5px; font-weight: 700;
}
.ph-reg-btn { flex-shrink: 0; }

.ph-msg-ok { background: var(--green-bg); color: var(--green); border-radius: var(--r-sm); padding: 10px 14px; font-size: 13px; font-weight: 700; margin-bottom: 12px; }
.ph-msg-err { background: var(--red-bg); color: var(--red); border-radius: var(--r-sm); padding: 10px 14px; font-size: 13px; font-weight: 700; margin-bottom: 12px; }

#ph-slot-msg { margin-bottom: 4px; }

/* ---- Stat clickable (Đã học / Đã nghỉ / Đã bù) ---- */
.ph-stat-btn {
    cursor: pointer;
    -webkit-appearance: none; appearance: none;
    border: none; font-family: inherit;
    transition: background .13s, transform .1s;
}
.ph-stat-btn:hover { filter: brightness(.93); }
.ph-stat-btn:active { transform: scale(.94); }
.ph-stat-btn label { cursor: pointer; }

/* ---- Lịch bù sắp tới trên thẻ học viên ---- */
.ph-upcoming-bu {
    display: flex; flex-direction: column; gap: 5px;
    padding: 10px 12px;
    background: var(--amber-bg);
    border: 1px solid #f0d589;
    border-radius: var(--r-sm);
}
.ph-upcoming-title {
    font-size: 11px; font-weight: 800;
    color: var(--amber); text-transform: uppercase; letter-spacing: .4px;
    margin-bottom: 1px;
}
.ph-bu-item {
    display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink);
}
.ph-bu-item b { color: var(--pt); min-width: 85px; font-weight: 700; }
.ph-bu-cancel {
    margin-left: auto; flex-shrink: 0;
    background: none; border: 1px solid #e0b0b0; color: var(--red);
    border-radius: var(--pill); padding: 3px 11px;
    font-size: 12px; font-weight: 700; cursor: pointer;
    transition: background .12s;
}
.ph-bu-cancel:hover { background: var(--red-bg); }
.ph-bu-cancel:disabled { opacity: .5; cursor: default; }

/* ---- Popup ngày điểm danh (giống vch-modal Module 1) ---- */
.ph-modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; padding: 16px;
}
.ph-modal-card {
    max-width: 420px; width: 100%;
    background: #fff; border-radius: var(--r);
    box-shadow: var(--sh2);
    max-height: 82vh; overflow-y: auto;
    display: flex; flex-direction: column; gap: 0;
    padding: 18px;
    -webkit-overflow-scrolling: touch;
}
.ph-modal-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px;
}
.ph-modal-title { font-size: 16px; font-weight: 800; color: var(--pt); line-height: 1.3; }
.ph-modal-close {
    background: none; border: none; cursor: pointer;
    font-size: 24px; color: var(--muted); line-height: 1;
    padding: 0 4px; flex-shrink: 0;
}
.ph-modal-close:hover { color: var(--ink); }
.ph-date-list { display: flex; flex-direction: column; gap: 6px; }
.ph-date-row {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    font-size: 13.5px; padding: 8px 10px;
    background: var(--bg); border-radius: var(--r-sm);
}
.ph-date-row b { color: var(--pt); min-width: 88px; font-weight: 700; flex-shrink: 0; }
.ph-date-gv { color: var(--muted); }

/* ---- Popup thông báo kết quả (đăng ký / huỷ) ---- */
.ph-notify-card {
    max-width: 300px; text-align: center;
    align-items: center; gap: 16px;
}
.ph-notify-icon { font-size: 44px; font-weight: 800; line-height: 1; }
.ph-notify-ok  { color: var(--green); }
.ph-notify-err { color: var(--red); }
.ph-notify-msg {
    font-size: 14px; color: var(--ink); line-height: 1.55;
    white-space: pre-wrap; text-align: center;
}

/* ---- Fullscreen (đè theme) ---- */
html.ddph-fs, body.ddph-fs { margin: 0 !important; padding: 0 !important; height: 100%; overflow: hidden !important; background: var(--bg); overscroll-behavior: none; }
html.ddph-fs #wpadminbar { display: none !important; }
html.ddph-fs::before { content: ""; position: fixed; inset: 0; background: var(--bg); z-index: 2147482999; }
html.ddph-fs #ddph-root { position: fixed; inset: 0; margin: 0; height: 100%; min-height: 0; max-width: none; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; z-index: 2147483000; }

@media (max-width: 380px) {
    .ph-stats { grid-template-columns: repeat(3, 1fr); }
}

/* ===================== V3.10.0 — NGHỈ PHÉP + VẮNG KP ===================== */
/* 6 ô chỉ số (thêm Vắng KP) */
.ph-stats { grid-template-columns: repeat(6, 1fr); }
.ph-stat-vkp { background: #f0e4f7; }
.ph-stat-vkp span { color: #6d28a8; }

/* hàng 2 nút: Đăng ký nghỉ phép + Đăng ký học bù */
.ph-btn-row { display: flex; gap: 8px; margin-top: 4px; }
.ph-btn-row .ddph-action, .ph-btn-row .ddph-primary { flex: 1; }

/* ghi chú đầu luồng đăng ký nghỉ / học bù */
.ph-flow-note {
    background: var(--p-soft, #fdf1e7); color: var(--pt, #b96a2b);
    border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.5;
    margin: 0 0 12px;
}

/* khối "Nghỉ phép đã đăng ký" — tông vàng cam nhẹ để phân biệt với lịch bù */
.ph-upcoming-nghi { background: #fff8ec; border-color: #f4e3bd; }

/* thông báo nhiều dòng trong popup */
.ph-notify-msg { white-space: pre-line; }
.ph-notify-card .ph-btn-row { width: 100%; margin-top: 12px; }

@media (max-width: 420px) {
    .ph-stats { grid-template-columns: repeat(3, 1fr); }
}
