/* ============================================================
   Attendance Heatmap Component
   Companion to calendar.css — no class name conflicts.
   ============================================================ */

/* Outer wrapper injected by attendanceHeatmap.js --------- */
.att-heatmap-wrapper {
    padding: 15px 20px 20px 20px;
    margin-bottom: 35px;
    position: relative;
}

/* Inner layout -------------------------------------------- */
.att-heatmap-inner {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* ── Toolbar ─────────────────────────────────────────────── */
.att-heatmap-toolbar {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 0 0 12px 0;
    border-bottom: 1px solid #efefef;
    margin-bottom: 12px;
}

.att-heatmap-toolbar--synced {
    justify-content: flex-start;
}

/* Period tab pills */
.att-heatmap-period-tabs {
    display: flex;
    flex-direction: row;
    gap: 4px;
}

.att-heatmap-period-tab {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #d0d7de;
    border-radius: 20px;
    background-color: #f6f8fa;
    color: #444;
    cursor: pointer;
    transition:
        background-color 0.15s,
        color 0.15s,
        border-color 0.15s;
    line-height: 1.5;
}

.att-heatmap-period-tab:hover {
    background-color: #e0eaf4;
    border-color: #5993ab;
    color: #5993ab;
}

.att-heatmap-period-tab.active {
    background-color: #5993ab;
    border-color: #5993ab;
    color: #fff;
}

/* Legend */
.att-heatmap-legend {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    margin-left: auto;
}

.att-heatmap-toolbar--synced .att-heatmap-legend {
    margin-left: 0;
}

.att-heatmap-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #666;
}

.att-heatmap-legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

/* Summary line */
.att-heatmap-summary {
    font-size: 12px;
    color: #666;
    padding: 0 0 10px 0;
}

.att-heatmap-summary-present {
    color: #388e3c;
    font-weight: 600;
}

.att-heatmap-summary-absent {
    color: #c62828;
    font-weight: 600;
}

.att-heatmap-summary-holiday {
    color: #1565c0;
    font-weight: 600;
}

/* ── Graph area ──────────────────────────────────────────── */
.att-heatmap-graph {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
}

/* Day-of-week labels column */
.att-heatmap-day-labels {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 2px;
    padding-top: 18px; /* align with cells below month label */
    margin-right: 4px;
    flex-shrink: 0;
}

.att-heatmap-day-label {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 10px;
    color: #999;
    height: 17px;
    padding-right: 4px;
    width: 26px;
}

/* Scroll container (enables horizontal scroll for long periods) */
.att-heatmap-scroll {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 2px;
    padding-bottom: 6px;
}

/* Custom scrollbar styling */
.att-heatmap-scroll::-webkit-scrollbar {
    height: 4px;
}

.att-heatmap-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.att-heatmap-scroll::-webkit-scrollbar-thumb {
    background: #c0d8e4;
    border-radius: 2px;
}

.att-heatmap-scroll::-webkit-scrollbar-thumb:hover {
    background: #5993ab;
}

/* Week column */
.att-heatmap-week-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

/* Month label above week column */
.att-heatmap-month-label {
    display: block;
    font-size: 10px;
    color: #888;
    height: 20px;
    line-height: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 28px;
}

.att-heatmap-month-label--empty {
    visibility: hidden;
}

/* ── Day cell ─────────────────────────────────────────────── */
.att-heatmap-cell {
    width: 17px;
    height: 17px;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition:
        transform 0.1s,
        box-shadow 0.1s;
    flex-shrink: 0;
    position: relative;
}

.att-heatmap-cell:hover {
    transform: scale(1.25);
    box-shadow: 0 0 0 2px #5993ab;
    z-index: 2;
}

/* Status colours (also used programmatically via inline styles;
   these serve as fallback for environments without inline style support) */
.att-heatmap-cell.status-present {
    background-color: #4caf50;
}

.att-heatmap-cell.status-absent {
    background-color: #e53935;
}

.att-heatmap-cell.status-holiday {
    background-color: #64b5f6;
}

.att-heatmap-cell.status-weekend {
    background-color: #e0e0e0;
    cursor: default;
}

.att-heatmap-cell.status-weekend:hover {
    transform: none;
    box-shadow: none;
}

.att-heatmap-cell.status-unknown {
    background-color: #bdbdbd;
}

.att-heatmap-cell.status-future {
    background-color: #f5f5f5;
    cursor: default;
    border-color: #ececec;
}

.att-heatmap-cell.status-future:hover {
    transform: none;
    box-shadow: none;
}

/* Today highlight */
.att-heatmap-cell--today {
    box-shadow: 0 0 0 2px #5993ab;
}

.att-heatmap-cell--today:hover {
    box-shadow: 0 0 0 2px #345065;
}

/* ── Adaptive density (short ranges render larger) ───────────────────────── */
.att-heatmap-wrapper[data-heatmap-density='medium'] .att-heatmap-week-col {
    gap: 3px;
}

.att-heatmap-wrapper[data-heatmap-density='medium'] .att-heatmap-scroll {
    gap: 3px;
}

.att-heatmap-wrapper[data-heatmap-density='medium'] .att-heatmap-cell {
    width: 21px;
    height: 21px;
}

.att-heatmap-wrapper[data-heatmap-density='medium'] .att-heatmap-day-label {
    height: 21px;
    font-size: 11px;
    width: 30px;
}

.att-heatmap-wrapper[data-heatmap-density='medium'] .att-heatmap-month-label {
    height: 22px;
    line-height: 22px;
    width: 32px;
    font-size: 11px;
}

.att-heatmap-wrapper[data-heatmap-density='medium'] .att-heatmap-day-labels {
    gap: 3px;
    padding-top: 22px;
}

.att-heatmap-wrapper[data-heatmap-density='large'] .att-heatmap-week-col {
    gap: 4px;
}

.att-heatmap-wrapper[data-heatmap-density='large'] .att-heatmap-scroll {
    gap: 4px;
}

.att-heatmap-wrapper[data-heatmap-density='large'] .att-heatmap-cell {
    width: 25px;
    height: 25px;
    border-radius: 4px;
}

.att-heatmap-wrapper[data-heatmap-density='large'] .att-heatmap-day-label {
    height: 25px;
    font-size: 12px;
    width: 34px;
}

.att-heatmap-wrapper[data-heatmap-density='large'] .att-heatmap-month-label {
    height: 24px;
    line-height: 24px;
    width: 36px;
    font-size: 12px;
}

.att-heatmap-wrapper[data-heatmap-density='large'] .att-heatmap-day-labels {
    gap: 4px;
    padding-top: 24px;
}

/* ── Tooltip ─────────────────────────────────────────────── */
.att-heatmap-tooltip {
    position: absolute;
    background-color: #333;
    color: #fff;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 9999;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.att-heatmap-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #333;
}
