// "Odoo Mobile" app pages (Attendance / Leave Request). Phone-first:
// a single column that fills the viewport on a phone and stays a centered
// max-width column on wider screens. Navy / accent-blue palette + rounded
// white cards, matching XENHR's own mobile app look. Both client-action
// pages can run taller than one screen, so anchor scroll to the page
// itself (same technique the other xeno client-action pages use to escape
// core's overflow:hidden action-manager wrapper).
$xeno-navy: #1a2b4a;
$xeno-accent: #4fc3f7;
$xeno-topbar-height: 48px;

.o_xeno_mobile {
    background: #f0f4f8;
    padding: 16px;
    // This is the client-action root. Its parent (.o_action_manager, and
    // on phones the theme forces it to a real 100dvh via body:has()) has a
    // definite height + overflow:hidden, but is NOT a flex column -- so a
    // flex:1 child does nothing and the page grows to content height and
    // gets clipped (why it still wouldn't scroll). A plain height:100% +
    // overflow-y:auto gives this a definite height of its own and scrolls
    // internally, the same fix that works for the My Profile page.
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; // momentum scrolling on iOS
}

.o_xeno_mobile_shell {
    // On a phone this is full width; on a desktop it stays a phone-width
    // column centred in the page, so the "mobile" layout still reads as
    // mobile when an admin opens it on a laptop.
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.o_xeno_m_hero {
    background: $xeno-navy;
    border-radius: 18px;
    padding: 20px 22px;
    color: #fff;
    box-shadow: 0 6px 16px rgba(26, 43, 74, 0.28);
}

.o_xeno_m_brand {
    font-size: 1.4rem;
    font-weight: 900;
    letter-spacing: 2px;

    span { color: $xeno-accent; }
}

.o_xeno_m_hero_title {
    margin-top: 8px;
    font-size: 1.15rem;
    font-weight: 700;
}

// Hero row that carries the brand + a back-to-Attendance button, used on
// every Odoo Mobile page except Attendance itself (that one *is* home).
.o_xeno_m_hero_top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.o_xeno_m_home_btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    cursor: pointer;
    transition: background 0.15s;

    &:active { background: rgba(255, 255, 255, 0.26); }
}

// Attendance hero: employee name + logout button, top-right.
.o_xeno_m_userbox {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.o_xeno_m_username {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.o_xeno_m_logout_btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;

    &:active { background: rgba(255, 255, 255, 0.26); }
}

// Attendance page's quick links to the other Odoo Mobile pages -- a 2x2
// grid (rather than a single flex row) so a 4th tile (Leave Approval)
// doesn't keep squeezing every tile narrower as more get added.
.o_xeno_m_quicklinks {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.o_xeno_m_quicklink {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: none;
    border-radius: 16px;
    padding: 18px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;

    &:active { transform: scale(0.97); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08); }
}

.o_xeno_m_quicklink_icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
}

.o_xeno_m_quicklink_lbl {
    font-size: 0.85rem;
    font-weight: 700;
    color: $xeno-navy;
    text-align: center;
}

.o_xeno_m_clock {
    margin-top: 12px;
    font-size: 2rem;
    font-weight: 800;
    color: $xeno-accent;
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums;
}

.o_xeno_m_date {
    font-size: 0.8rem;
    color: #90caf9;
    margin-top: 2px;
}

.o_xeno_m_card {
    background: #fff;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.o_xeno_m_card_title {
    font-size: 0.95rem;
    font-weight: 700;
    color: $xeno-navy;
    margin-bottom: 14px;
}

.o_xeno_m_section {
    margin: 4px 2px -4px;
}

.o_xeno_m_muted {
    color: #a0aec0;
    font-weight: 500;
    font-size: 0.85em;
}

.o_xeno_m_doc_row {
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 0.9rem;

    &:last-of-type {
        border-bottom: none;
    }
}

.o_xeno_m_notice,
.o_xeno_m_loading {
    text-align: center;
    color: #718096;
    font-size: 0.9rem;
}

// Status + big action button
.o_xeno_m_status_card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
}

.o_xeno_m_status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: center;
    padding: 6px 16px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.9rem;

    &.is_in { background: #e6f7ec; color: #206b45; }
    &.is_out { background: #fdecec; color: #a33a49; }
}

.o_xeno_m_status_dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: currentColor;
}

.o_xeno_m_bigbtn {
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 16px;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #fff;
    background: $xeno-navy;
    box-shadow: 0 4px 12px rgba(26, 43, 74, 0.35);
    cursor: pointer;
    transition: filter 0.15s, opacity 0.15s;

    &.is_checkout { background: #c0392b; box-shadow: 0 4px 12px rgba(192, 57, 43, 0.35); }
    &.is_busy, &:disabled { opacity: 0.6; cursor: default; }
    &:not(:disabled):active { filter: brightness(0.92); }
    margin-top: 4px;
}

// Today's times
.o_xeno_m_times {
    display: flex;
    align-items: center;
}

.o_xeno_m_time_item {
    flex: 1;
    text-align: center;
}

.o_xeno_m_time_label {
    font-size: 0.8rem;
    color: #718096;
    margin-bottom: 6px;
}

.o_xeno_m_time_val {
    font-size: 1.4rem;
    font-weight: 800;
    color: $xeno-navy;
    font-variant-numeric: tabular-nums;
}

.o_xeno_m_time_divider {
    width: 1px;
    align-self: stretch;
    background: #e2e8f0;
    margin: 4px 0;
}

// Month stats
.o_xeno_m_stats {
    display: flex;
    gap: 10px;
}

.o_xeno_m_stat {
    flex: 1;
    background: #f8fafc;
    border-radius: 12px;
    border-top: 3px solid #81c784;
    padding: 14px;
    text-align: center;
}

.o_xeno_m_stat_val {
    font-size: 1.6rem;
    font-weight: 800;
    color: $xeno-navy;
}

.o_xeno_m_stat_lbl {
    font-size: 0.72rem;
    color: #718096;
    margin-top: 2px;
}

// Leave form fields
.o_xeno_m_label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #2d3748;
    margin: 12px 0 6px;
}

.o_xeno_m_input {
    width: 100%;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #f7fafc;
    padding: 12px 14px;
    font-size: 0.95rem;
    color: #2d3748;

    &:focus {
        outline: none;
        border-color: $xeno-accent;
        background: #fff;
    }
}

.o_xeno_m_textarea {
    resize: vertical;
    min-height: 64px;
}

.o_xeno_m_field_row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.o_xeno_m_field {
    // Native <input type="date"> carries its own browser-imposed minimum
    // width (the calendar icon + "dd/mm/yyyy" text need room) that can
    // exceed half the available width on a narrow phone -- flex:1 alone
    // let each field get squeezed past that minimum and overflow the card
    // instead of shrinking, since a flex item's default min-width is
    // "auto" (its content size), not 0. flex-basis below plus flex-wrap on
    // the row means two fields that don't both fit drop to their own full-
    // width row instead, rather than clipping off the edge of the screen.
    flex: 1 1 140px;
    min-width: 0;
}

// Part-time hour:minute selects
.o_xeno_m_time_row {
    display: flex;
    align-items: center;
    gap: 8px;

    .o_xeno_m_input { flex: 1; }
}

.o_xeno_m_time_colon {
    font-weight: 800;
    color: $xeno-navy;
}

// Leave list rows
.o_xeno_m_leave_row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
}

.o_xeno_m_leave_main { flex: 1; min-width: 0; }

.o_xeno_m_leave_type {
    font-weight: 700;
    color: $xeno-navy;
    font-size: 0.92rem;
}

.o_xeno_m_leave_dates {
    font-size: 0.82rem;
    color: #718096;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

.o_xeno_m_leave_reason {
    font-size: 0.8rem;
    color: #a0aec0;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.o_xeno_m_pill {
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;

    &.is_pending { background: #fdf0cc; color: #8a6d1d; }
    &.is_approved { background: #d9f2e3; color: #206b45; }
    &.is_rejected { background: #fbdfe4; color: #a33a49; }
    &.is_muted { background: #ececec; color: #7a7a7a; }
}

.o_xeno_m_leave_side {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.o_xeno_m_cancel_link {
    border: none;
    background: none;
    padding: 0;
    color: #a33a49;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;

    &:active { opacity: 0.7; }
}

// Leave Balance cards
.o_xeno_m_bal_card {
    border-left: 4px solid #4fc3f7;
}

.o_xeno_m_bal_top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.o_xeno_m_bal_type {
    font-size: 0.95rem;
    font-weight: 700;
}

.o_xeno_m_bal_remaining {
    font-size: 0.8rem;
    color: #718096;
}

.o_xeno_m_bal_remaining_val {
    font-weight: 800;
    color: $xeno-navy;
    font-size: 0.95rem;
}

.o_xeno_m_bal_bar {
    height: 6px;
    background: #edf2f7;
    border-radius: 4px;
    margin-bottom: 14px;
    overflow: hidden;
}

.o_xeno_m_bal_bar_fill {
    height: 6px;
    border-radius: 4px;
}

.o_xeno_m_bal_stats {
    display: flex;
    justify-content: space-between;
}

.o_xeno_m_bal_stat {
    text-align: center;
    flex: 1;
}

.o_xeno_m_bal_stat_val {
    font-size: 1.1rem;
    font-weight: 800;
    color: $xeno-navy;
    font-variant-numeric: tabular-nums;
}

.o_xeno_m_bal_pending { color: #ffb74d; }

.o_xeno_m_bal_stat_lbl {
    font-size: 0.68rem;
    color: #a0aec0;
    margin-top: 2px;
}

// Leave Approval page
.o_xeno_m_approval_card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.o_xeno_m_approval_card > .o_xeno_m_leave_row {
    padding: 0;
}

// Unlike .o_xeno_m_leave_reason (single-line ellipsis, used by the
// compact "My Recent Requests" list rows), the approval card has room to
// show the requester's full note -- wraps normally across lines instead
// of truncating.
.o_xeno_m_approval_reason {
    font-size: 0.8rem;
    color: #a0aec0;
    margin-top: 3px;
    white-space: normal;
    overflow-wrap: break-word;
}

.o_xeno_m_approval_actions {
    display: flex;
    gap: 10px;
    padding-top: 0.5rem;
}

.o_xeno_m_approve_btn,
.o_xeno_m_reject_btn,
.o_xeno_m_cancel_btn {
    flex: 1;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.15s, opacity 0.15s;

    &:disabled { opacity: 0.6; cursor: default; }
    &:not(:disabled):active { filter: brightness(0.93); }
}

.o_xeno_m_approve_btn { background: #00d47bba; color: #fff; }
.o_xeno_m_reject_btn { background: #f67688; color: #fff; }
.o_xeno_m_cancel_btn { background: #edf2f7; color: #4a5568; }

.o_xeno_m_decision_box {
    background: #f7fafc;
    border-radius: 12px;
    padding: 12px 14px;

    .o_xeno_m_label { margin-top: 0; }
}

// Short Analysis summary shown after the first tap of Confirm Approve/
// Reject (mobile_leave_approval.js's computeShortLeaveAnalysis) -- one
// compact line per check, a warning-colored dot for anything flagged.
.o_xeno_m_analysis {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.o_xeno_m_analysis_row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 0.82rem;
    color: #4a5568;
}

.o_xeno_m_analysis_dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e0;
    margin-top: 2px;

    &.is_flagged { background: #f0ad4e; }
}
