/* public/assets/css/s44-mobile-checkins.css
   UI-only redesign of /mobile-checkins (Mobile / QR Check-In Log).
   Scoped to .mc-page — no other screen is affected.
   Mobile (<768px): compact header, segmented tabs, collapsible filter,
   one card per check-in. Desktop (≥768px): single-row filter + table.
   Colors come from CSS variables only (Day/Night safe). Zero CDN. */

.mc-page { --mc-gap: 12px; --mc-r: 16px; min-width: 0; }
.mc-page svg { flex-shrink: 0; }

/* ── Header ─────────────────────────────────────────────────── */
.mc-page .mc-header {
    display: flex; flex-direction: row; align-items: center;
    gap: 12px; margin-bottom: 14px;
}
.mc-header-icon {
    width: 46px; height: 46px; flex: 0 0 46px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 14px; color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent, var(--primary)));
    box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 30%, transparent);
}
.mc-header-icon svg { width: 24px; height: 24px; }
.mc-header-text { min-width: 0; }
.mc-header-text h1 {
    margin: 0; font-size: 1.15rem; line-height: 1.35; word-break: break-word;
}
.mc-count-pill {
    display: inline-flex; align-items: center; gap: 5px;
    margin: 6px 0 0; padding: 2px 10px; border-radius: 999px;
    font-size: .78rem; color: var(--text-muted);
    background: var(--surface-alt);
}
.mc-count-pill strong { color: var(--primary); font-size: .85rem; }

/* ── Tabs (segmented control) ───────────────────────────────── */
.mc-tabs {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
    padding: 4px; margin-bottom: 12px;
    background: var(--surface-alt); border-radius: 14px;
}
.mc-tab {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 42px; padding: 6px 8px; border-radius: 11px;
    font-size: .84rem; font-weight: 600; text-align: center; line-height: 1.25;
    color: var(--text-muted); text-decoration: none;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
.mc-tab svg { width: 17px; height: 17px; }
.mc-tab.is-active {
    color: var(--primary); background: var(--surface);
    box-shadow: 0 2px 8px rgba(16, 24, 40, .10);
}
.mc-tab-badge {
    font-style: normal; font-size: .7rem; font-weight: 700; line-height: 1;
    min-width: 20px; padding: 4px 6px; border-radius: 999px; text-align: center;
    color: #fff; background: var(--warning);
}

/* ── Filter card ────────────────────────────────────────────── */
.mc-filter {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--mc-r); margin-bottom: 12px; overflow: visible;
    box-shadow: var(--shadow-ambient), var(--shadow-contact);
}
.mc-filter-toggle {
    border-radius: var(--mc-r);
    width: 100%; display: flex; align-items: center; gap: 10px;
    min-height: 48px; padding: 0 16px;
    font: inherit; font-weight: 700; font-size: .9rem;
    color: var(--text); background: transparent; border: 0; cursor: pointer;
}
.mc-filter-toggle-label { display: inline-flex; align-items: center; gap: 8px; }
.mc-filter-toggle-label svg { width: 17px; height: 17px; color: var(--primary); }
.mc-filter-count {
    font-style: normal; font-size: .72rem; font-weight: 700;
    min-width: 22px; padding: 3px 7px; border-radius: 999px; text-align: center;
    color: #fff; background: var(--primary);
}
.mc-filter-chevron {
    margin-left: auto; font-size: 1.3rem; line-height: 1; color: var(--text-muted);
    transform: rotate(-90deg); transition: transform .2s ease;
}
.mc-filter.is-open .mc-filter-chevron { transform: rotate(90deg); }

.mc-filter-body { display: none; padding: 4px 16px 16px; border-top: 1px solid var(--border); }
.mc-filter.is-open .mc-filter-body { display: block; }

.mc-filter-form {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px; padding-top: 12px;
}
.mc-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; }
.mc-field-search, .mc-field-source { grid-column: 1 / -1; }
.mc-field-label {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .72rem; font-weight: 700; letter-spacing: .02em;
    color: var(--text-muted);
}
.mc-field-label svg { width: 13px; height: 13px; color: var(--primary); }

.mc-page .mc-field input[type="text"],
.mc-page .mc-field select {
    width: 100%; min-width: 0; max-width: none; box-sizing: border-box;
    height: 44px; padding: 0 14px;
    font: inherit; font-size: .9rem; color: var(--text);
    background-color: var(--bg); background-image: none;
    border: 1px solid var(--border); border-radius: 12px;
    box-shadow: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.mc-page .mc-field select {
    appearance: none; -webkit-appearance: none; padding-right: 36px;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                      linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%;
    background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.mc-page .mc-field input[type="text"]:focus,
.mc-page .mc-field select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
/* shared date picker inside our fields: same height/radius as the rest */
.mc-page .mc-field .s11-picker-field { width: 100%; }
.mc-page .mc-field .s11-picker-display,
.mc-page .mc-field .s11-picker-display[type="text"] {
    height: 44px !important; padding: 0 44px 0 12px !important;
    font-size: .88rem; border-radius: 12px !important;
    background-color: var(--bg) !important;
}
.mc-page .mc-field .s11-picker-icon { right: 4px; width: 34px; height: 34px; }

/* Action buttons: Filter (wide) + Reset */
.mc-filter-actions {
    grid-column: 1 / -1;
    display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 10px;
    margin-top: 2px; padding-top: 14px; border-top: 1px dashed var(--border);
}
.mc-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 46px; padding: 0 14px; border-radius: 12px;
    font: inherit; font-size: .92rem; font-weight: 700; line-height: 1;
    text-decoration: none; white-space: nowrap; cursor: pointer;
    box-sizing: border-box; border: 1.5px solid transparent;
    transition: transform .12s ease, box-shadow .15s ease, background-color .15s ease;
}
.mc-btn svg { width: 18px; height: 18px; }
.mc-btn:active { transform: scale(.97); }
.mc-btn-primary {
    color: #fff; background: linear-gradient(135deg, var(--primary), var(--accent, var(--primary)));
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 32%, transparent);
}
.mc-btn-ghost { color: var(--text-muted); background: transparent; border-color: var(--border); }
.mc-btn-ghost:hover {
    color: var(--danger); border-color: var(--danger);
    background: color-mix(in srgb, var(--danger) 8%, transparent);
}

/* ── Toolbar: range info + per page ─────────────────────────── */
.mc-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin: 0 2px 10px;
}
.mc-toolbar-info { font-size: .78rem; color: var(--text-muted); min-width: 0; }
.mc-perpage { display: inline-flex; align-items: center; gap: 8px; margin: 0; flex: 0 0 auto; }
.mc-perpage label { font-size: .78rem; color: var(--text-muted); white-space: nowrap; margin: 0; }
.mc-page .mc-perpage select {
    height: 36px; min-width: 72px; padding: 0 28px 0 12px;
    font: inherit; font-size: .85rem; color: var(--text);
    background-color: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    appearance: none; -webkit-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                      linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
    background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}

/* ── Mobile cards ───────────────────────────────────────────── */
.mc-cards { display: flex; flex-direction: column; gap: var(--mc-gap); }
.mc-table-desktop { display: none; }

.mc-card {
    position: relative; overflow: hidden;
    padding: 14px 14px 12px 18px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--mc-r);
    box-shadow: var(--shadow-ambient), var(--shadow-contact);
}
.mc-card::before {           /* status accent bar */
    content: ""; position: absolute; inset: 0 auto 0 0; width: 5px;
    background: var(--text-muted);
}
.mc-card.mc-status-approved::before { background: var(--success); }
.mc-card.mc-status-pending::before  { background: var(--warning); }
.mc-card.mc-status-rejected::before { background: var(--danger); }

.mc-card-head { display: flex; align-items: center; gap: 10px; }
.mc-avatar {
    width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1rem; color: var(--primary);
    background: color-mix(in srgb, var(--primary) 14%, var(--surface));
}
.mc-card-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mc-card-name { font-size: .95rem; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-card-code { font-size: .74rem; color: var(--text-muted); }

.mc-status {
    flex: 0 0 auto; padding: 4px 11px; border-radius: 999px;
    font-size: .74rem; font-weight: 700; line-height: 1.3; white-space: nowrap;
    color: var(--text-muted); background: var(--surface-alt);
}
.mc-status.mc-status-approved { color: var(--success); background: color-mix(in srgb, var(--success) 13%, transparent); }
.mc-status.mc-status-pending  { color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); }
.mc-status.mc-status-rejected { color: var(--danger);  background: color-mix(in srgb, var(--danger) 12%, transparent); }

.mc-card-event {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-top: 12px; padding: 10px 12px; border-radius: 12px;
    background: var(--surface-alt);
}
.mc-type { font-size: .85rem; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.mc-type::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--text-muted); }
.mc-type.is-in::before  { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 20%, transparent); }
.mc-type.is-out::before { background: var(--info);    box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 20%, transparent); }
.mc-time {
    display: inline-flex; align-items: center; gap: 5px; text-align: right;
    font-size: .78rem; color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.mc-time svg { width: 14px; height: 14px; color: var(--primary); }

.mc-meta {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 0;
}
.mc-meta > div { min-width: 0; }
.mc-meta dt { font-size: .68rem; font-weight: 700; letter-spacing: .03em; color: var(--text-muted); margin-bottom: 4px; }
.mc-meta dd { margin: 0; font-size: .88rem; font-weight: 600; }

.mc-coords {
    display: flex; align-items: center; gap: 6px; margin: 10px 0 0;
    font-size: .74rem; color: var(--text-muted); font-variant-numeric: tabular-nums;
    word-break: break-all;
}
.mc-coords svg { width: 13px; height: 13px; color: var(--primary); }
.mc-reason { margin-top: 10px; }
.mc-note {
    margin: 10px 0 0; padding: 8px 10px; border-radius: 10px;
    font-size: .8rem; line-height: 1.5; word-break: break-word;
    background: color-mix(in srgb, var(--warning) 9%, var(--surface));
}

.mc-card-actions {
    display: flex; align-items: center; justify-content: flex-end; gap: 8px;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
}
.mc-card-actions .btn,
.mc-card-actions form > .btn {
    width: 42px; height: 42px; min-width: 42px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 12px;
}
.mc-card-actions form { display: inline-flex; margin: 0; }
.mc-card-actions .btn svg { width: 19px; height: 19px; }

.mc-empty { text-align: center; padding: 36px 16px; color: var(--text-muted);
    background: var(--surface); border: 1px dashed var(--border); border-radius: var(--mc-r); }
.mc-empty-icon {
    width: 64px; height: 64px; margin: 0 auto 10px;
    display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
    color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}
.mc-empty-icon svg { width: 30px; height: 30px; }
.mc-empty p { margin: 0; font-size: .9rem; }

/* ── Pagination: touch-friendly, one row ────────────────────── */
.mc-page .pagination { justify-content: center; flex-wrap: wrap; gap: 6px; margin: 16px 0 4px; }
.mc-page .pagination a, .mc-page .pagination span {
    min-width: 40px; height: 40px; padding: 0 10px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
}

/* ── Phones ≤ 359px: single-column date fields ──────────────── */
@media (max-width: 359.98px) {
    .mc-filter-form { grid-template-columns: minmax(0, 1fr); }
    .mc-tab { font-size: .78rem; }
    .mc-card-event { flex-direction: column; align-items: flex-start; }
}

/* ═════════════ Tablet / Desktop ≥ 768px ═════════════ */
@media (min-width: 768px) {
    .mc-page .mc-header { margin-bottom: 18px; }
    .mc-header-text h1 { font-size: 1.5rem; }

    .mc-tabs { display: inline-grid; grid-template-columns: repeat(2, auto); margin-bottom: 16px; }
    .mc-tab { padding: 6px 20px; font-size: .9rem; }

    .mc-filter-toggle { display: none; }
    .mc-filter-body, .mc-filter.is-open .mc-filter-body { display: block; border-top: 0; padding: 16px 20px; }
    .mc-filter-form {
        grid-template-columns: minmax(220px, 2fr) minmax(150px, 1fr) minmax(150px, 1fr) minmax(150px, 1fr) auto;
        align-items: end; padding-top: 0;
    }
    .mc-field-search, .mc-field-source { grid-column: auto; }
    .mc-filter-actions {
        grid-column: auto; grid-template-columns: auto auto;
        margin: 0; padding: 0; border-top: 0;
    }
    .mc-btn { height: 44px; padding: 0 18px; }

    /* table replaces the cards */
    .mc-cards { display: none; }
    .mc-table-desktop { display: block; }
}
@media (min-width: 768px) and (max-width: 991.98px) {
    /* tablet: search on its own line, the rest share a row */
    .mc-filter-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .mc-field-search { grid-column: 1 / -1; }
    .mc-filter-actions { grid-column: 1 / -1; justify-content: end; grid-template-columns: 160px 130px; }
}


/* ── Themed dropdown (ui-select.js) ─────────────────────────────
   The native <select> list is drawn by the OS and ignores the Khmer
   web font. ui-select draws it with our font instead; here we just
   size/skin it to match the other filter fields. */
.mc-page .ui-select { display: block; width: 100%; min-width: 0; }
.mc-page .ui-select-trigger {
    height: 44px; min-height: 44px; padding: 0 12px;
    border-radius: 12px; background: var(--bg);
    font-family: inherit; font-size: .9rem; font-weight: 500; box-shadow: none;
}
.mc-page .ui-select.has-value .ui-select-trigger { background: color-mix(in srgb, var(--primary) 7%, var(--bg)); }
.mc-page .ui-select-label { font-family: inherit; }
.mc-page .ui-select-panel { min-width: 0; border-radius: 14px; z-index: 90; }
.mc-page .ui-select-option { font-family: inherit; min-height: 40px; font-size: .9rem; }
.mc-page .mc-filter-body .ui-select-panel { max-height: 260px; }

/* Per-page picker: compact */
.mc-page .mc-perpage .ui-select { width: 96px; }
.mc-page .mc-perpage .ui-select-trigger { height: 36px; min-height: 36px; padding: 0 10px; border-radius: 10px; background: var(--surface); }
.mc-page .mc-perpage .ui-select-icon { display: none; }
.mc-page .mc-perpage .ui-select-panel { left: auto; right: 0; min-width: 120px; }

/* "Show N" now lives in the table card's top-left toolbar (moved by app.js):
   open the list to the right of the box, not off the left edge. */
.hrms-table-toolbar .mc-perpage .ui-select-panel,
.table-top-controls .mc-perpage .ui-select-panel { left: 0; right: auto; }
