/**
 * user-management styles (Wave D4)
 * Extracted from root styles.css.
 */

/* --- from styles.css L3859-L4524 --- */
/* === Applicant Profile Modal (View Only) === */
.applicant-profile-view-only .modal-content {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.applicant-profile-view-only .modal-content * {
    user-select: none !important;
    -webkit-user-select: none !important;
}

.applicant-profile-view-only input[disabled] {
    cursor: default;
    pointer-events: none;
}

.masked-label {
    font-size: 12px; /* Increased from 10px for accessibility */
    color: var(--text-secondary);
    font-weight: normal;
    opacity: 0.8;
}

.privacy-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.privacy-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.privacy-notice i {
    color: var(--info-color);
    flex-shrink: 0;
    margin-top: 2px;
}

/* Bulk Action Toolbar */
.bulk-action-toolbar {
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Applicant checkbox styling */
.applicant-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.applicant-checkbox:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Skill badges in applicant profile */
.skill-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.skill-badge.assessed {
    font-weight: 500;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    min-height: 40px;
    font-size: var(--font-sm);
    font-weight: 600;
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-outline:hover {
    background-color: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn-outline-secondary {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--border-radius);
    padding: 6px 12px;
}

.btn-outline-secondary:hover {
    background-color: var(--bg-surface-2);
    color: var(--text-primary);
}

.file-upload-label {
    cursor: pointer;
}

.excel-preview {
    margin-top: calc(var(--spacing-unit) * 2);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: calc(var(--spacing-unit) * 2);
}

.excel-preview h5 {
    margin-top: 0;
    margin-bottom: calc(var(--spacing-unit) * 1.5);
    color: var(--brand-fg, var(--primary-color));
}

.excel-preview .table-wrapper {
    margin-bottom: calc(var(--spacing-unit) * 1.5);
    max-height: 200px;
    overflow-y: auto;
}

.excel-preview table {
    font-size: 14px;
}

.excel-preview table th,
.excel-preview table td {
    padding: 8px 12px;
}

.preview-actions {
    display: flex;
    gap: calc(var(--spacing-unit) * 1.5);
    margin-top: calc(var(--spacing-unit) * 1.5);
}

#excel-total-rows {
    font-weight: 600;
    color: var(--brand-fg, var(--primary-color));
    margin: 0;
}

.success {
    color: var(--success-text, var(--success-color));
    font-weight: 600;
}

/* === User Management - Advanced UI === */

/* Stats Bar */
.user-stats-bar {
    display: flex;
    gap: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 2);
    flex-wrap: wrap;
}

.stat-item {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: calc(var(--spacing-unit) * 2);
    border-radius: var(--border-radius);
    min-width: 120px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--brand-color);
}

.stat-number {
    display: block;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--brand-fg, var(--brand-color));
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.platform-staff-access-panel {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-card);
    padding: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.panel-header-inline {
    display: flex;
    justify-content: space-between;
    gap: calc(var(--spacing-unit) * 2);
    align-items: flex-start;
    margin-bottom: calc(var(--spacing-unit) * 1.5);
}

.panel-header-inline h4 {
    margin: 0 0 4px;
    color: var(--text-primary);
}

.compact-table th,
.compact-table td {
    padding: 10px 12px;
}

.muted {
    color: var(--text-secondary);
    font-size: 12px;
}

.readonly-summary {
    margin: 0;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
}

.checkbox-chip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.checkbox-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
}

.checkbox-chip input {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

/* Filter / toolbar bars */
.filter-bar,
.user-filter-bar,
.attendance-filter-bar,
.tasks-filter-bar,
.employee-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--stack-gap, 8px);
    margin-bottom: var(--section-gap-sm, 10px);
}

.compact-toolbar {
    gap: var(--stack-gap, 8px) !important;
    margin-bottom: var(--section-gap-sm, 10px) !important;
}

#main-app .compact-toolbar.attendance-filter-bar,
.compact-toolbar.attendance-filter-bar {
    padding: 10px 12px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.user-leave-sub-nav {
    gap: 4px;
}

/* ===== Unified search input icon (SVG background) ===== */
.search-input-field {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M229.66,218.34l-50.06-50.07a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.31-11.31ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z' fill='%2364748b'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
    background-size: 15px 15px;
    padding-left: 34px !important;
}

.search-box {
    flex: 1;
    min-width: 250px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 95, 115, 0.1);
}

.filter-group {
    display: flex;
    gap: calc(var(--spacing-unit) * 1);
    flex-wrap: wrap;
}

.filter-group select {
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    background-color: var(--bg-card);
    cursor: pointer;
    min-width: 140px;
}

.filter-group select option {
    background-color: var(--bg-surface-1);
    color: var(--text-primary);
}

[data-theme="light"] .filter-group select option {
    background-color: #ffffff;
    color: #1a1a1a;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Results Info */
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: calc(var(--spacing-unit) * 1.5);
    padding: calc(var(--spacing-unit) * 1) calc(var(--spacing-unit) * 1.5);
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    color: var(--text-secondary);
}

.btn-export {
    padding: 8px 16px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-export:hover {
    background-color: var(--primary-color);
    color: var(--text-on-brand, #ffffff);
}

/* Table Responsive Wrapper — horizontal scroll fallback */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px;
}
.table-responsive::-webkit-scrollbar {
    height: 6px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

/* Table header row with column toggle */
.table-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.table-header-row h3 {
    margin: 0;
}

/* Column toggle dropdown */
.column-toggle-container {
    position: relative;
}
.column-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    padding: 6px 12px;
    border-radius: 8px;
}
.column-toggle-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 200px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 8px 0;
    z-index: 500;
}
.column-toggle-header {
    padding: 6px 14px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}
.column-toggle-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.column-toggle-item:hover {
    background: var(--bg-hover);
}
.column-toggle-item input[type="checkbox"] {
    accent-color: var(--primary-color);
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.column-toggle-item input[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}
.column-toggle-actions {
    padding: 8px 14px 4px;
    border-top: 1px solid var(--border-color);
    margin-top: 4px;
    display: flex;
    justify-content: flex-end;
}

/* Hidden column class */
.col-hidden {
    display: none !important;
}

/* Data Table Modernization */
.users-table-wrapper {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: auto; /* Enable horizontal scroll */
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    background: var(--bg-card);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8125rem;
    min-width: 800px;
}

.data-table th {
    background-color: var(--bg-surface-1);
    color: var(--text-secondary);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: var(--text-color);
}

.data-table tbody tr {
    transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
    background-color: var(--bg-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* === Module Access Matrix Polish === */
#company-modules-table {
    border-spacing: 0;
    border-collapse: collapse;
}

#company-modules-table th.sticky-name,
#company-modules-table td.sticky-name {
    position: sticky;
    left: 0;
    z-index: 5;
    background: var(--bg-surface-2);
    border-right: 2px solid var(--border-color);
}

#company-modules-table thead th.sticky-name {
    z-index: 15;
}

#company-modules-table .module-select-col {
    width: 40px;
    text-align: center;
}

#company-modules-table .sticky-name {
    min-width: 200px;
}

#company-modules-table .module-sort-col {
    min-width: 100px;
    cursor: pointer;
}

#company-modules-table .module-header {
    text-align: center;
    min-width: 88px;
    vertical-align: middle;
}

.module-header-inner {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.module-header-inner i {
    font-size: 14px;
}

.module-emp-link {
    color: var(--primary-color, var(--brand-color));
    text-decoration: none;
    font-weight: 600;
}

.module-emp-link:hover {
    text-decoration: underline;
}

.module-cell {
    padding: 6px 8px !important;
    text-align: center;
    position: relative;
}

.module-cell-control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 28px;
}

.matrix-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--brand-color);
}

#company-modules-table .module-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin: 0;
    border-radius: 50%;
    background: var(--brand-color);
    color: var(--text-on-brand, #fff);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
}

#company-modules-table .module-indicator.is-off,
.module-access-legend .module-indicator.is-off {
    background: var(--text-secondary);
}

.module-cell.override-enabled {
    background: rgba(46, 204, 113, 0.12);
    box-shadow: inset 3px 0 0 #27ae60;
}

.module-cell.override-disabled {
    background: rgba(231, 76, 60, 0.10);
    box-shadow: inset 3px 0 0 #c0392b;
}

.module-cell.company-disabled {
    opacity: 0.72;
}

.module-access-intro {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-surface-1);
}

.module-access-intro-main h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 6px;
    color: var(--text-primary);
}

.module-access-intro-main p,
.module-access-note {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.45;
}

.module-access-core-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.module-access-core-list span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.2;
}

.module-access-tools {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.module-preset-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.module-preset-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

.module-preset-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.module-preset-btn {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 999px;
}

.module-preset-hint {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.module-access-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin: 0;
}

.module-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.3;
}

.module-access-legend .module-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin: 0;
    border-radius: 50%;
    background: var(--brand-color);
    color: var(--text-on-brand, #fff);
    font-size: 10px;
    font-weight: 700;
}

.module-access-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 14px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.module-access-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
    flex: 1 1 180px;
}

.module-access-field-search {
    flex: 2 1 240px;
}

.module-access-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.module-access-field select,
.module-access-search input {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
}

.module-access-search {
    position: relative;
}

.module-access-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.module-access-search input {
    padding-left: 36px;
}

.module-access-filter-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.module-access-filter-actions .btn-secondary,
.module-access-filter-actions .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 14px;
    border-radius: 8px;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .module-preset-actions {
        width: 100%;
    }

    .module-preset-btn {
        flex: 1 1 calc(50% - 8px);
        justify-content: center;
    }

    .module-access-filter-actions {
        width: 100%;
    }

    .module-access-filter-actions .btn-secondary,
    .module-access-filter-actions .btn-primary {
        flex: 1 1 auto;
        justify-content: center;
    }
}

.emp-name-wrapper {
    display: flex;
    flex-direction: column;
}

.emp-position-badge {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}


