/* ==================== IMPERSONATE FEATURE ==================== */

/* Top banner when impersonating */
.impersonate-banner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100000;
    background: linear-gradient(135deg, #dc3545, #b02a37);
    color: #fff;
    padding: 4px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 32px;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}
.impersonate-banner.active {
    display: flex;
}
.impersonate-banner i {
    font-size: 0.85rem;
}
.impersonate-banner .imp-user-email {
    color: #ffc9cf;
    font-weight: 400;
}
.impersonate-banner .imp-exit-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 2px 12px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    margin-left: 8px;
    transition: background 0.15s;
}
.impersonate-banner .imp-exit-btn:hover {
    background: rgba(255,255,255,0.35);
}

/* Push app content down when banner is active */
body.impersonating .app-sidebar {
    top: 32px;
    height: calc(100dvh - 32px);
    height: calc(100vh - 32px);
}
body.impersonating .main-content-wrapper {
    padding-top: 32px;
}
body.impersonating .main-header {
    top: 32px;
}
body.impersonating .impersonate-banner {
    display: flex;
}

/* Menu item with NEW badge */
.sidebar-profile-menu-item .imp-new-badge {
    background: #dc3545;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: auto;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ==================== IMPERSONATE MODAL ==================== */
.imp-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100001;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.imp-modal-overlay.active {
    display: flex;
}
.imp-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 1400px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* Modal header */
.imp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8f9fa;
}
.imp-modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #212529;
}
.imp-modal-header h3 i {
    color: #dc3545;
}
.imp-modal-close {
    border: none;
    background: none;
    font-size: 1.2rem;
    color: #6c757d;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}
.imp-modal-close:hover {
    background: #e9ecef;
    color: #212529;
}

/* Search bar */
.imp-search-wrap {
    padding: 12px 20px;
    border-bottom: 1px solid #e5e7eb;
}
.imp-search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.15s;
    background: #fff;
}
.imp-search-input:focus {
    border-color: #1E6332;
    box-shadow: 0 0 0 3px rgba(30, 99, 50,0.1);
}
.imp-search-wrap {
    position: relative;
}
.imp-search-wrap i {
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd;
    font-size: 0.85rem;
}

/* User list container */
.imp-user-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    min-height: 200px;
}

/* 3-column grid layout */
.imp-columns {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0;
    height: 100%;
    min-height: 300px;
}
.imp-column {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e5e7eb;
    min-height: 0;
}
.imp-column:last-child {
    border-right: none;
}

/* Column header */
.imp-column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 2px solid;
    flex-shrink: 0;
}
.imp-column-header i {
    font-size: 0.85rem;
}
.imp-column-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #374151;
}
.imp-column-count {
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: auto;
}

/* Column scrollable list */
.imp-column-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 6px;
}
.imp-column-empty {
    text-align: center;
    padding: 24px 8px;
    color: #9ca3af;
    font-size: 0.8rem;
    font-style: italic;
}

/* User card (inside columns) */
.imp-user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s;
    border: 1px solid transparent;
}
.imp-user-item:hover {
    background: #F4F0E9;
    border-color: #E8DFD0;
}
.imp-user-item.imp-self {
    opacity: 0.5;
    cursor: default;
}
.imp-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1E6332, #214A3E);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.imp-user-details {
    flex: 1;
    min-width: 0;
}
.imp-user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.imp-user-name small {
    color: #9ca3af;
    font-weight: 400;
}
.imp-user-email-text {
    font-size: 0.72rem;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Role status badge on user cards */
.imp-user-status {
    font-size: 0.62rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
    white-space: nowrap;
}
.imp-user-status.employee {
    background: #f5f3ff;
    color: #7c3aed;
}
.imp-user-status.admin {
    background: #fffbeb;
    color: #b45309;
}
.imp-user-status.standard {
    background: #f0f9ff;
    color: #0369a1;
}

/* Loading & empty state */
.imp-loading, .imp-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-size: 0.9rem;
}
.imp-loading i, .imp-empty i {
    font-size: 1.5rem;
    margin-bottom: 8px;
    display: block;
}

/* Footer — total count */
.imp-modal-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f8f9fa;
    font-size: 0.78rem;
    color: #6c757d;
}

/* ==================== CONFIRMATION PANEL ==================== */
.imp-confirm-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 32px 40px;
    text-align: center;
    min-height: 350px;
}
.imp-confirm-icon {
    font-size: 2.2rem;
    color: #dc3545;
    margin-bottom: 20px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #fef2f2;
    display: flex;
    align-items: center;
    justify-content: center;
}
.imp-confirm-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1E6332, #214A3E);
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    box-shadow: 0 4px 16px rgba(30, 99, 50, 0.25);
}
.imp-confirm-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 4px;
}
.imp-confirm-email {
    font-size: 0.88rem;
    color: #6c757d;
    margin-bottom: 12px;
}
.imp-confirm-role {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 24px;
}
.imp-confirm-warning {
    font-size: 0.82rem;
    color: #6b7280;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 20px;
    max-width: 420px;
    line-height: 1.5;
    margin-bottom: 28px;
}
.imp-confirm-warning i {
    color: #3b82f6;
    margin-right: 4px;
}
.imp-confirm-actions {
    display: flex;
    gap: 12px;
}
.imp-confirm-cancel {
    padding: 10px 24px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.imp-confirm-cancel:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}
.imp-confirm-btn {
    padding: 10px 28px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #dc3545, #b02a37);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}
.imp-confirm-btn:hover {
    background: linear-gradient(135deg, #c82333, #9b1d2a);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
    transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 768px) {
    .imp-modal {
        max-width: 100%;
        max-height: 90vh;
        border-radius: 12px;
    }
    .imp-columns {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    .imp-column {
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }
    .imp-column:last-child {
        border-bottom: none;
    }
    .imp-column-list {
        max-height: 200px;
    }
    .impersonate-banner {
        font-size: 0.7rem;
        padding: 4px 10px;
    }
}
