/**
 * leaveManagement.css — V2 Leave Management Styles
 * Zero-inline — all style attributes are externalized here.
 */

/* ── Container height fix (dynamic frame from fcts.js append) ── */
#pageLeaveManagement {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#pageLeaveManagement .cd-main-content {
    min-height: auto;
    height: auto;
}


/* ── Modal utilities ─────────────────────────────────────── */
.leave-modal-row {
    margin-top: 12px;
}

.leave-modal-full {
    width: 100%;
    box-sizing: border-box;
}

.leave-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    justify-content: flex-start;
}

/* ── Approver chips (HR Settings display) ─────────────── */
.leave-approvers-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
    min-height: 36px;
    align-items: center;
}

.leave-approver-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 0.82rem;
    font-weight: 600;
}

.leave-approver-chip i {
    font-size: 0.8rem;
    color: #3b82f6;
}

/* Approver edit header row */
.leave-approvers-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 8px 0 4px 0;
}

/* Inline editor panel */
.leave-approvers-editor {
    margin-top: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    background: #f8fafc;
}

.leave-approvers-editor.hide { display: none; }

.leave-approvers-editor-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* Table action button compact */
.btn-adjust.v2-btn-blue,
.btn-approve.v2-btn-blue,
.btn-reject.v2-btn-danger-red {
    padding: 4px 12px !important;
    font-size: 0.78rem !important;
}

.leave-modal-textarea {
    resize: vertical;
}

/* ── Cancel button (neutral/secondary style) ─────────────── */
.leave-modal-cancel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: 8px;
    border: 1.5px solid #cbd5e1;
    background: #f8fafc;
    color: #475569;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.leave-modal-cancel-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #334155;
}

/* ── Status badges ─────────────────────────────────────────── */
.leave-status-pending  { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.leave-status-approved { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.leave-status-rejected { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.leave-status-cancelled { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }

/* ── KPI grid bottom spacing variant ─────────────────────── */
.leave-kpi-grid--mb {
    margin-bottom: 24px !important;
}


/* ── Entity icon (header) ────────────────────────────────── */
.leave-entity-icon {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
}

/* ── Header meta ─────────────────────────────────────────── */
.leave-header-info {
    flex: 1;
    min-width: 0;
}

.leave-header-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
}

.leave-meta-balance {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

/* ── KPI Cards grid ──────────────────────────────────────── */
.leave-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .leave-kpi-grid {
        grid-template-columns: 1fr;
    }
}

.leave-kpi-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    padding: 16px 20px;
}

.leave-kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.leave-kpi-remaining .leave-kpi-icon { background: #e8f5e9; color: #2e7d32; }
.leave-kpi-used      .leave-kpi-icon { background: #fff3e0; color: #e65100; }
.leave-kpi-total     .leave-kpi-icon { background: #e3f2fd; color: #1565c0; }

.leave-kpi-remaining .leave-kpi-icon svg { stroke: #2e7d32; }
.leave-kpi-used      .leave-kpi-icon svg { stroke: #e65100; }
.leave-kpi-total     .leave-kpi-icon svg { stroke: #1565c0; }

.leave-kpi-body {
    min-width: 0;
}

.leave-kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

.leave-kpi-label {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ── Status badges ───────────────────────────────────────── */
.leave-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.leave-status-pending  { background: #fff3cd; color: #856404; }
.leave-status-approved { background: #d4edda; color: #155724; }
.leave-status-rejected { background: #f8d7da; color: #721c24; }

/* ── Pending count badge (manager tab) ───────────────────── */
.leave-pending-badge {
    display: inline-block;
    background: #dc3545;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: 8px;
    vertical-align: middle;
}

/* ── Empty state rows in tables ──────────────────────────── */
.leave-empty-row {
    color: #94a3b8;
    font-style: italic;
    padding: 20px !important;
}

/* ── Helper text under inputs ────────────────────────────── */
.leave-helper-text {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

/* ── Settings actions bar ────────────────────────────────── */
.leave-settings-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* ── Remodal custom sizing ───────────────────────────────── */
[data-remodal-id="modalLeaveRequest"],
[data-remodal-id="modalAdjustBalance"] {
    max-width: 520px;
    text-align: left;
}

[data-remodal-id="modalLeaveRequest"] h4,
[data-remodal-id="modalAdjustBalance"] h4 {
    text-align: left;
}

.modal-date-col {
    width: 48%;
    display: inline-block;
    vertical-align: top;
}

.modal-date-col--left {
    margin-right: 2%;
}

.modal-date-input {
    width: 100%;
    height: 40px;
    border: 1px solid #d9d9d9;
    box-sizing: border-box;
    border-radius: 6px;
    padding: 0 10px;
}

/* ── Wizard approver user list ───────────────────────────── */
.leave-wizard-user-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px;
    background: #f8fafc;
}

.leave-wizard-user-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s;
    user-select: none;
}

.leave-wizard-user-row:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.leave-wizard-user-row.selected {
    border-color: #2b5797;
    background: #eff6ff;
}

.leave-wizard-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #2b5797;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

.leave-wizard-user-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
}

.leave-wizard-user-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 10px;
    color: transparent;
    transition: all 0.18s;
}

.leave-wizard-user-row.selected .leave-wizard-user-check {
    background: #2b5797;
    border-color: #2b5797;
    color: #ffffff;
}

@media (max-width: 768px) {
    .leave-header-info {
        display: none !important;
    }

    .modal-date-col {
        width: 100%;
        display: block;
        margin-right: 0;
        margin-bottom: 12px;
    }
}

/* ════════════════════════════════════════════════════════════
   LEAVE SETUP WIZARD
   ════════════════════════════════════════════════════════════ */

/* Backdrop */
.leave-wizard-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(3px);
}

/* Panel */
.leave-wizard {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    width: 540px;
    max-width: 95vw;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Progress bar */
.leave-wizard-progress {
    height: 4px;
    background: #f1f5f9;
    flex-shrink: 0;
}

.leave-wizard-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #2b5797, #3b82f6);
    transition: width 0.35s ease;
    width: 0%;
}

/* Step indicators */
.leave-wizard-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 20px 32px 0;
    flex-shrink: 0;
}

.leave-wizard-step {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #94a3b8;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.leave-wizard-step.active {
    background: #2b5797;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(43, 87, 151, 0.35);
}

.leave-wizard-step.done {
    background: #22c55e;
    color: #ffffff;
}

.leave-wizard-step-line {
    flex: 1;
    height: 2px;
    background: #e2e8f0;
    max-width: 80px;
}

/* Body */
.leave-wizard-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
}

/* Icon */
.leave-wizard-icon-wrap {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}

.leave-wizard-icon-blue   { background: #dbeafe; color: #1d4ed8; }
.leave-wizard-icon-purple { background: #ede9fe; color: #7c3aed; }
.leave-wizard-icon-green  { background: #dcfce7; color: #16a34a; }

/* Titles & text */
.leave-wizard-title {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 8px;
}

.leave-wizard-desc {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin: 0 0 20px;
}

/* Checklist (step 1) */
.leave-wizard-checklist {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.leave-wizard-check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #334155;
}

.leave-wizard-check .fa {
    color: #22c55e;
    font-size: 14px;
    flex-shrink: 0;
}

/* Form fields */
.leave-wizard-field {
    margin-bottom: 16px;
}

.leave-wizard-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
}

/* Summary (step 4) */
.leave-wizard-summary-table {
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.leave-wizard-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}

.leave-wizard-summary-row:last-child {
    border-bottom: none;
}

.leave-wizard-summary-label {
    color: #64748b;
    font-weight: 600;
}

.leave-wizard-summary-value {
    color: #1e293b;
    font-weight: 600;
    text-align: right;
}

.leave-wizard-note {
    margin-top: 14px;
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
}

/* Footer */
.leave-wizard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px 24px;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}

/* V2 Button helpers (if not in main design system) */
.v2-btn-ghost {
    background: transparent;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.v2-btn-ghost:hover {
    background: #f8fafc;
    color: #1e293b;
}

@media (max-width: 600px) {
    .leave-wizard {
        width: 100%;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: none;
    }

    .leave-wizard-body {
        padding: 16px 20px;
    }

    .leave-wizard-footer {
        padding: 12px 20px 20px;
    }
}

/* ── Public Holidays section ─────────────────────────────── */
.leave-holiday-form {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    margin: 12px 0;
    transition: all 0.2s ease;
}

.leave-holiday-form.hide {
    display: none;
}

.leave-holiday-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

/* Scope badges */
.leave-holiday-scope-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.leave-holiday-scope-global {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.leave-holiday-scope-user {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* ── Holiday header actions row ─────────────────────────────── */
.leave-holiday-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.leave-holiday-import-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.leave-import-select-wrap {
    min-width: 100px;
}
