// Admin/HR overview dashboard (landing page of the custom "HR" app),
// styled after XENHR's AdminDashboardPage.tsx. Deliberately always-light,
// same reasoning as leave_hr_app.scss's own o_xeno_hr_card.

// This page is taller than one screen (stats + announcements + report +
// calendar + chart). Core Odoo clips both .o_action_manager AND .o_action
// with `overflow: hidden` (webclient_layout.scss), assuming each view type
// provides its own internal scroll region -- a plain height:100%+
// overflow-y:auto on this component's root wasn't enough to escape that
// (percentage heights depend on every ancestor in the chain resolving
// cleanly, which isn't guaranteed through ActionContainer's dynamic
// t-component). Anchoring to the viewport with position:fixed sidesteps
// the whole ancestor chain -- the same technique this theme's own
// .xeno_topbar/.xeno_sidebar_rail already use to sit reliably alongside
// core's layout rather than fight it.
$xeno-topbar-height: 48px;
$xeno-sidebar-width: 238px; // keep in sync with xeno_theme_slate's sidebar width

.o_xeno_dashboard {
    overflow-y: auto;

    @media (min-width: 768px) {
        position: fixed;
        top: $xeno-topbar-height;
        left: $xeno-sidebar-width;
        right: 0;
        bottom: 0;
        transition: left 0.2s ease;
    }
}

// Being position:fixed (see the comment above on why) means this page
// sits outside .o_action_manager entirely, so it doesn't pick up that
// element's own margin-left/left collapse handling for free -- confirmed
// live, this stayed anchored at the expanded 238px even with the sidebar
// folded to its 64px rail. Same breakpoint/value xeno_theme_slate's own
// .xeno_topbar and .o_action_manager use for the same toggle.
body.xeno_sidebar_collapsed .o_xeno_dashboard {
    @media (min-width: 768px) {
        left: 64px;
    }
}

.o_xeno_dashboard_card {
    margin-bottom: 20px;
}

// ---------------------------------------------------------------- stats
.o_xeno_stat_grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 20px;

    @media (min-width: 992px) {
        grid-template-columns: repeat(4, 1fr);
    }
}

.o_xeno_stat_card {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;

    > i {
        font-size: 1.4rem;
        width: 44px;
        height: 44px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
}

.o_xeno_stat_label {
    color: #8a8a8a;
    font-size: 0.82rem;
    margin-bottom: 2px;
}

.o_xeno_stat_value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0;
}

.o_xeno_stat_blue > i { background: #e7f1ff; color: #2f6fed; }
.o_xeno_stat_green > i { background: #e5f7ec; color: #1f9d55; }
.o_xeno_stat_red > i { background: #fdeceb; color: #e0362e; }
.o_xeno_stat_yellow > i { background: #fff6e0; color: #c98a06; }

// ------------------------------------------------------------ card head
.o_xeno_card_head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;

    h3 {
        font-size: 1.02rem;
        font-weight: 700;
        margin: 0;
    }

    > i {
        color: #2f6fed;
    }
}

.o_xeno_card_head_nav {
    justify-content: space-between;
}

.o_xeno_badge_count {
    margin-left: auto;
    background: #e7f1ff;
    color: #2f6fed;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 100px;
    padding: 2px 9px;
}

.o_xeno_day_nav {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.86rem;
    font-weight: 600;
    white-space: nowrap;
}

// --------------------------------------------------------- announcements
// auto-FIT (not auto-fill): empty phantom tracks collapse, so the column
// count follows the actual number of announcements -- one announcement
// spans the full width (short & wide) instead of being stranded in a
// narrow 240px column with a tall body and empty space beside it; several
// share the row in equal-width columns, wrapping only below 260px each.
.o_xeno_announcement_grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    align-items: start;
    gap: 12px;
}

.o_xeno_announcement_item {
    display: flex;
    flex-direction: column;
    border: 1px solid #d9e6ff;
    background: #f5f9ff;
    border-radius: 10px;
    padding: 12px 14px;
}

.o_xeno_announcement_head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.o_xeno_announcement_title {
    font-weight: 700;
    font-size: 0.9rem;
}

.o_xeno_announcement_audience {
    font-size: 0.68rem;
    font-weight: 600;
    color: #2f6fed;
    background: #fff;
    border: 1px solid #d9e6ff;
    border-radius: 100px;
    padding: 1px 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.o_xeno_announcement_body {
    font-size: 0.84rem;
    color: #495057;
    // Keep a long announcement (e.g. a full leave policy) from stretching
    // the whole card down the page -- cap the body and scroll inside it so
    // every card in the row stays a similar, tidy height.
    max-height: 240px;
    overflow-y: auto;

    p {
        margin: 0 0 6px;

        &:last-child {
            margin-bottom: 0;
        }
    }
}

.o_xeno_announcement_date {
    font-size: 0.75rem;
    color: #8a8a8a;
    margin: 6px 0 0;
}

// -------------------------------------------------------------- table
.o_xeno_table_wrap {
    overflow-x: auto;
}

.o_xeno_report_table {
    font-size: 0.85rem;
    margin-bottom: 0;

    th, td {
        text-align: center;
        white-space: nowrap;
        vertical-align: middle;
    }
}

.o_xeno_table_empty {
    color: #adb5bd;
    padding: 24px !important;
}

.o_xeno_pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 0.74rem;
    font-weight: 600;
}

.o_xeno_pill_approved { background: #e5f7ec; color: #1f9d55; }
.o_xeno_pill_pending { background: #fff6e0; color: #c98a06; }

// ------------------------------------------------------------- calendar
.o_xeno_cal_weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 4px;

    span {
        text-align: center;
        font-size: 0.72rem;
        font-weight: 600;
        color: #8a8a8a;
        padding: 4px 0;
    }
}

.o_xeno_cal_grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e9ecef;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.o_xeno_cal_cell {
    background: #fff;
    min-height: 82px;
    padding: 6px;
}

.o_xeno_cal_pad {
    background: #fafafa;
}

.o_xeno_cal_weekend {
    background: #f5f5f5;
}

.o_xeno_cal_has_events {
    cursor: pointer;

    &:hover {
        filter: brightness(0.97);
    }
}

.o_xeno_cal_today .o_xeno_cal_daynum {
    background: #2f6fed;
    color: #fff;
}

.o_xeno_cal_daynum {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 3px;
}

.o_xeno_cal_events {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.o_xeno_cal_event {
    font-size: 0.68rem;
    padding: 1px 5px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.o_xeno_cal_overflow {
    font-size: 0.66rem;
    color: #adb5bd;
    padding: 0 3px;
}

// Fixed categorical assignment, one color per XENHR event kind.
.o_xeno_ev_holiday_public { background: #dbeafe; color: #1d4ed8; }
.o_xeno_ev_holiday_company { background: #ede9fe; color: #6d28d9; }
.o_xeno_ev_passport { background: #fef3c7; color: #b45309; }
.o_xeno_ev_visa { background: #ffedd5; color: #c2410c; }
.o_xeno_ev_work_permit { background: #fee2e2; color: #b91c1c; }
.o_xeno_ev_birthday { background: #fce7f3; color: #be185d; }
.o_xeno_ev_activity { background: #dcfce7; color: #15803d; }

.o_xeno_cal_legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 12px;
    font-size: 0.75rem;
    color: #6c757d;
}

.o_xeno_legend_item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.o_xeno_legend_dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}

// ---------------------------------------------------------------- chart
.o_xeno_chart {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    height: 220px;
    padding: 8px 6px 0;
}

.o_xeno_chart_col {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.o_xeno_chart_bars {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    width: 100%;
    justify-content: center;
}

.o_xeno_chart_bar {
    width: 16px;
    border-radius: 4px 4px 0 0;
    min-height: 2px;
    transition: height 0.2s ease;
}

.o_xeno_bar_present { background: #22c55e; }
.o_xeno_bar_absent { background: #ef4444; }

.o_xeno_chart_label {
    font-size: 0.72rem;
    color: #8a8a8a;
    margin-top: 6px;
}

.o_xeno_chart_legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
    font-size: 0.78rem;
    color: #6c757d;
}

// ----------------------------------------------------------- day detail
.o_xeno_day_overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.o_xeno_day_panel {
    background: #fff;
    border-radius: 12px;
    width: 380px;
    max-width: calc(100vw - 32px);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.o_xeno_day_panel_head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #e9ecef;

    h4 {
        font-size: 0.95rem;
        font-weight: 700;
        margin: 0;
    }
}

.o_xeno_day_panel_body {
    padding: 12px 18px 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.o_xeno_day_event {
    border-radius: 8px;
    padding: 10px 12px;
}

.o_xeno_day_event_label {
    font-weight: 700;
    font-size: 0.85rem;
    margin: 0;
}

.o_xeno_day_event_name, .o_xeno_day_event_detail {
    font-size: 0.78rem;
    margin: 3px 0 0;
    opacity: 0.85;
}
