/* ===== Employee Records Module ===== */

.er-app {
    display: flex;
    min-height: calc(100vh - 72px);
}

/* ===== Filter Sidebar ===== */
.er-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--color-bg-soft);
    border-right: 1px solid var(--color-border);
    padding: 24px;
    overflow-y: auto;
}

.er-sidebar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-dark);
    margin-bottom: 24px;
}

.er-add-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}
.er-plus { font-size: 18px; font-weight: 700; }

.er-filter-group { margin-bottom: 20px; }

.er-filter-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 10px;
}

.er-filter-list { list-style: none; }

.er-filter-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 14px;
    color: var(--color-text-body);
    cursor: pointer;
}
.er-filter-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #2563EB;
    cursor: pointer;
}
.er-filter-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border-radius: 10px;
    padding: 1px 8px;
}

/* ===== Main Content ===== */
.er-main {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

/* Table header bar */
.er-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.er-table-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text-dark);
}
.er-table-count {
    font-weight: 400;
    color: var(--color-text-muted);
}

.er-table-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.er-search {
    position: relative;
}
.er-search-input {
    width: 260px;
    height: 40px;
    padding: 0 14px 0 38px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--color-text-body);
    background: var(--color-bg);
}
.er-search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.er-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}

.er-icon-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: none;
    cursor: pointer;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, color 0.15s;
}
.er-icon-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* ===== Employee Table ===== */
.er-table-wrap {
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
}

.er-table {
    width: 100%;
    border-collapse: collapse;
}

.er-table thead th {
    height: 48px;
    padding: 0 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    background: var(--color-bg-soft);
    border-bottom: 1px solid var(--color-border);
}

.er-table tbody tr {
    height: 56px;
    cursor: pointer;
    transition: background 0.12s;
}
.er-table tbody tr:hover { background: var(--color-bg-soft); }
.er-table tbody tr:not(:last-child) td { border-bottom: 1px solid var(--color-border); }

.er-table td {
    padding: 0 16px;
    font-size: 14px;
    color: var(--color-text-body);
    white-space: nowrap;
}

/* Employee cell (avatar + name + position) */
.er-employee-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.er-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2563EB;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.er-name-block { display: flex; flex-direction: column; }
.er-emp-name { font-size: 14px; font-weight: 500; color: var(--color-text-body); }
.er-emp-position { font-size: 12px; color: var(--color-text-muted); }

/* Badges */
.er-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* Department badges */
.er-badge.dept-marketing  { background: #EFF6FF; color: #2563EB; }
.er-badge.dept-it         { background: #ECFEFF; color: #0EA5E9; }
.er-badge.dept-sales      { background: #FFF7ED; color: #F97316; }
.er-badge.dept-admin      { background: #F5F3FF; color: #7C3AED; }
.er-badge.dept-production { background: #FEF2F2; color: #DC2626; }

[data-theme="dark"] .er-badge.dept-marketing  { background: rgba(37,99,235,0.15); }
[data-theme="dark"] .er-badge.dept-it         { background: rgba(14,165,233,0.15); }
[data-theme="dark"] .er-badge.dept-sales      { background: rgba(249,115,22,0.15); }
[data-theme="dark"] .er-badge.dept-admin      { background: rgba(124,58,237,0.15); }
[data-theme="dark"] .er-badge.dept-production { background: rgba(220,38,38,0.15); }

/* Contract type badges */
.er-badge.contract-uop      { background: #EFF6FF; color: #2563EB; }
.er-badge.contract-b2b      { background: #ECFDF5; color: #16A34A; }
.er-badge.contract-zlecenie { background: #FFFBEB; color: #D97706; }

[data-theme="dark"] .er-badge.contract-uop      { background: rgba(37,99,235,0.15); }
[data-theme="dark"] .er-badge.contract-b2b      { background: rgba(22,163,74,0.15); }
[data-theme="dark"] .er-badge.contract-zlecenie { background: rgba(217,119,6,0.15); }

/* Status badges */
.er-badge.status-active      { background: #ECFDF5; color: #16A34A; }
.er-badge.status-onboarding  { background: #EFF6FF; color: #2563EB; }
.er-badge.status-offboarding { background: #FFF7ED; color: #F97316; }
.er-badge.status-former      { background: #F1F5F9; color: #64748B; }

[data-theme="dark"] .er-badge.status-active      { background: rgba(22,163,74,0.15); }
[data-theme="dark"] .er-badge.status-onboarding  { background: rgba(37,99,235,0.15); }
[data-theme="dark"] .er-badge.status-offboarding { background: rgba(249,115,22,0.15); }
[data-theme="dark"] .er-badge.status-former      { background: rgba(100,116,139,0.15); }

/* Row action buttons */
.er-row-actions {
    display: flex;
    gap: 4px;
}
.er-row-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: none;
    cursor: pointer;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}
.er-row-btn:hover { color: var(--color-primary); background: var(--color-bg-soft); }

/* ===== Detail View ===== */
.er-detail {
    display: none;
}
.er-detail.active {
    display: block;
}

.er-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-primary);
    background: none;
    border: none;
    cursor: pointer;
    margin-bottom: 24px;
    padding: 4px 0;
}
.er-back-btn:hover { text-decoration: underline; }

/* Detail header */
.er-detail-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
}

.er-detail-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #2563EB;
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.er-detail-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text-dark);
    margin-bottom: 4px;
}
.er-detail-role {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-text-muted);
}
.er-detail-badges {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

/* Detail grid */
.er-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* Cards */
.er-card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 24px;
}

.er-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-dark);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.er-card-title svg { flex-shrink: 0; }

/* Fields grid inside cards */
.er-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
}

.er-field-label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}
.er-field-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-body);
}

/* Documents list in detail */
.er-doc-list { list-style: none; }

.er-doc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
    color: var(--color-text-body);
}
.er-doc-item:last-child { border-bottom: none; }
.er-doc-item svg { flex-shrink: 0; }
.er-doc-item span { flex: 1; }

.er-add-doc-btn {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

/* Equipment table */
.er-equip-table {
    width: 100%;
    border-collapse: collapse;
}
.er-equip-table th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    padding: 0 0 10px;
}
.er-equip-table td {
    padding: 8px 0;
    font-size: 14px;
    color: var(--color-text-body);
    border-top: 1px solid var(--color-border);
}

.er-equip-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.er-equip-status.issued   { background: #ECFDF5; color: #16A34A; }
.er-equip-status.returned { background: #F1F5F9; color: #64748B; }
[data-theme="dark"] .er-equip-status.issued   { background: rgba(22,163,74,0.15); }
[data-theme="dark"] .er-equip-status.returned { background: rgba(100,116,139,0.15); }

/* Access list */
.er-access-list { list-style: none; }

.er-access-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}
.er-access-item:last-child { border-bottom: none; }

.er-access-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--color-bg-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.er-access-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-body);
}

/* Toggle (reuse from onboarding pattern) */
.er-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.er-toggle input { opacity: 0; width: 0; height: 0; }
.er-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #CBD5E1;
    border-radius: 24px;
    transition: background 0.2s;
}
.er-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.er-toggle input:checked + .er-toggle-slider { background: #2563EB; }
.er-toggle input:checked + .er-toggle-slider::before { transform: translateX(20px); }

/* Timeline */
.er-timeline { list-style: none; position: relative; padding-left: 24px; }
.er-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--color-border);
}

.er-timeline-item {
    position: relative;
    padding-bottom: 20px;
}
.er-timeline-item:last-child { padding-bottom: 0; }

.er-timeline-dot {
    position: absolute;
    left: -24px;
    top: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    background: var(--color-bg);
}
.er-timeline-dot.blue { border-color: #2563EB; background: #2563EB; }
.er-timeline-dot.green { border-color: #16A34A; background: #16A34A; }
.er-timeline-dot.orange { border-color: #F97316; background: #F97316; }

.er-timeline-date {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}
.er-timeline-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-body);
}

/* HR Process card */
.er-process-bar {
    height: 8px;
    border-radius: 4px;
    background: var(--color-border);
    margin-bottom: 8px;
    overflow: hidden;
}
.er-process-fill {
    height: 100%;
    border-radius: 4px;
    background: #2563EB;
    transition: width 0.3s;
}

.er-process-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    margin-bottom: 12px;
}

.er-process-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-primary);
    text-decoration: none;
}
.er-process-link:hover { text-decoration: underline; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .er-detail-grid { grid-template-columns: 1fr; }
    .er-table td:nth-child(4),
    .er-table th:nth-child(4) { display: none; }
}

@media (max-width: 768px) {
    .er-app { flex-direction: column; }

    .er-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        max-height: 280px;
    }

    .er-main { padding: 20px; }

    .er-table-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .er-search-input { width: 100%; }

    .er-fields-grid { grid-template-columns: 1fr; }

    .er-table td:nth-child(3),
    .er-table th:nth-child(3),
    .er-table td:nth-child(5),
    .er-table th:nth-child(5) { display: none; }
}
