/* Specific styles for user management page */

#sessionToken {
    font-size: 0.8em;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.users-container {
    margin-top: 20px;
    background-color: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.users-container h3 {
    margin-bottom: 15px;
    font-size: 24px;
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Animation for verification status */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.verifying {
    animation: pulse 1.5s infinite;
    color: var(--text-light);
}

.coming-soon {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-light);
    border: 2px dashed rgba(107, 70, 255, 0.2);
    border-radius: 12px;
    margin-top: 30px;
}

.coming-soon i {
    font-size: 60px;
    margin-bottom: 20px;
    color: var(--primary);
    opacity: 0.6;
}

.coming-soon p {
    font-size: 18px;
}

/* User list styles */
.users-list {
    margin-top: 30px;
}

.user-item {
    background-color: var(--gray);
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    border-left: 4px solid var(--primary);
    transition: opacity 0.3s ease;
}

.user-item:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Style for transitioning items */
.user-item.transitioning {
    opacity: 0.5;
    pointer-events: none;
}

.user-info-row {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-details-column {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 18px;
    margin-bottom: 4px;
}

.user-created {
    font-size: 12px;
    color: var(--text-light);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Role select styles */
.role-select-container {
    position: relative;
}

.role-select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 2px solid var(--primary);
    background-color: white;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    appearance: none;
    padding-right: 30px;
    transition: all 0.3s ease;
}

.role-select:hover {
    background-color: rgba(107, 70, 255, 0.05);
}

.role-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(107, 70, 255, 0.2);
}

.role-select-container::after {
    content: '\f078';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    pointer-events: none;
}

.role-select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
    border-color: #dddddd;
    color: #888;
}

/* Style for dropdown options based on permissions */
.role-select option[disabled] {
    color: #999;
    font-style: italic;
}

/* Super admin warning in dropdown */
.role-select option[data-irreversible="true"] {
    color: #ff9800;
    font-weight: bold;
}

/* Delete button styles */
.delete-user-btn {
    background-color: #ff4f4f;
    color: white;
    border: none;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.delete-user-btn:hover {
    background-color: #e53935;
    transform: scale(1.05);
}

.delete-user-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.delete-user-btn:disabled:hover {
    background-color: #cccccc;
    transform: none;
}

/* Error message styles */
.error-message {
    text-align: center;
    padding: 20px;
    background-color: rgba(255, 79, 79, 0.1);
    color: #e53935;
    border-radius: 8px;
    margin-top: 20px;
}

/* Role-specific styling */
.user-item[data-user-rank="s_admin"] {
    border-left-color: #ff9800;
}

.user-item[data-user-rank="admin"] {
    border-left-color: #9c27b0;
}

.user-item[data-user-rank="patron"] {  /* Fixed spelling from 'parton' to 'patron' */
    border-left-color: #2196f3;
}

.user-item[data-user-rank="user"] {
    border-left-color: #4caf50;
}

/* Self tag styles */
.self-tag {
    background-color: var(--primary);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    vertical-align: middle;
    font-weight: normal;
}

/* Rank badges for visual indication */
.rank-badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    vertical-align: middle;
    font-weight: normal;
    color: white;
}

.rank-badge.s-admin {
    background-color: #ff9800;
}

.rank-badge.admin {
    background-color: #9c27b0;
}

.rank-badge.patron {
    background-color: #2196f3;
}

.rank-badge.user {
    background-color: #4caf50;
}

/* Notification system */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    font-weight: 500;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    max-width: 350px;
}

.notification.success {
    background-color: rgba(76, 175, 80, 0.9);
    color: white;
}

.notification.error {
    background-color: rgba(244, 67, 54, 0.9);
    color: white;
}

/* Batch user deletion styles */
.batch-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    margin-bottom: 20px;
    padding: 12px 20px;
    background-color: var(--gray);
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.batch-actions.has-selected {
    background-color: rgba(107, 70, 255, 0.05);
    border-left: 4px solid var(--primary);
}

.selection-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.3s ease;
}

.deselect-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0;
    pointer-events: none;
}

.deselect-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.deselect-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--primary);
}

.deselect-btn i {
    font-size: 12px;
}

.selection-info .active {
    color: var(--primary);
    font-weight: 600;
}

#selectionCounter {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

#selectionCounter.active {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 3px 8px rgba(107, 70, 255, 0.3);
}

/* User selection checkbox - wider hitbox */
.user-select {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    cursor: pointer;
    padding: 8px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.user-select:hover {
    background-color: rgba(107, 70, 255, 0.1);
}

.user-select:hover .user-select-checkbox {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 2px rgba(107, 70, 255, 0.2);
}

.user-select-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    border-radius: 3px;
    border: 2px solid var(--primary);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    position: relative;
    background-color: white;
    transition: all 0.2s ease;
}

.user-select-checkbox:checked {
    background-color: var(--primary);
}

.user-select-checkbox:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* User item selected state */
.user-item:has(.user-select-checkbox:checked) {
    background-color: rgba(107, 70, 255, 0.05);
}

/* Super admin non-selectable styling */
.user-item[data-user-rank="s_admin"] .user-select {
    opacity: 0.5;
    cursor: not-allowed;
}

.user-item[data-user-rank="s_admin"] .user-select-checkbox {
    border-color: #ccc;
    background-color: #f5f5f5;
}

/* Danger button for batch deletion */
.btn.danger {
    background-color: #ff4f4f;
    color: white;
    transition: all 0.3s ease;
    font-weight: 500;
    padding: 8px 15px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transform: translateY(10px);
    box-shadow: 0 3px 8px rgba(244, 67, 54, 0.2);
}

.btn.danger.visible {
    opacity: 1;
    transform: translateY(0);
}

.btn.danger:hover {
    background-color: #e53935;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(229, 57, 53, 0.3);
}

.btn.danger i {
    font-size: 14px;
}

/* Animation for deleting users */
.user-item.deleting {
    opacity: 0.5;
    background-color: rgba(244, 67, 54, 0.1);
    transform: translateX(100%);
    transition: opacity 0.5s ease, transform 0.5s ease, background-color 0.5s ease;
}

/* Batch deletion modal */
.batch-deletion-modal {
    width: 600px;
    max-width: 90%;
}

.progress-container {
    margin-bottom: 15px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--gray);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-inner {
    height: 100%;
    width: 0;
    background-color: var(--primary);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 14px;
    color: var(--text);
    text-align: center;
}

.progress-details {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--gray);
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    background-color: #f9f9f9;
}

.success-item, .error-item, .info-item {
    padding: 8px;
    margin-bottom: 5px;
    border-radius: 4px;
    display: flex;
    align-items: center;
}

.success-item {
    background-color: rgba(76, 175, 80, 0.1);
    color: #43a047;
}

.error-item {
    background-color: rgba(244, 67, 54, 0.1);
    color: #e53935;
}

.info-item {
    background-color: rgba(33, 150, 243, 0.1);
    color: #1976d2;
}

.success-item i, .error-item i, .info-item i {
    margin-right: 8px;
    font-size: 16px;
}

/* Modal styles (reused from subjects section if not already present) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal {
    background-color: white;
    border-radius: 10px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--gray);
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--gray);
    display: flex;
    justify-content: flex-end;
}

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

/* Users header with refresh button */
.users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.users-header h3 {
    margin-bottom: 0;
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    padding: 8px 15px;
    transition: all 0.3s ease;
}

.refresh-btn i {
    font-size: 14px;
}

.refresh-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive styles */
@media (max-width: 480px) {
    /* Header adjustments */
    .users-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .users-header h3 {
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }
    
    .refresh-btn {
        width: 100%;
        justify-content: center;
    }
    
    .users-stats {
        text-align: center;
    }
    
    /* Improved user item layout for mobile */
    .user-item {
        padding: 12px 10px;
        margin-bottom: 15px;
        position: relative; /* Keep this for proper positioning context */
    }
    
    .user-info-row {
        display: flex; /* Ensure flex display */
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center; /* Vertically align checkbox and user-details-column */
        padding: 5px;
    }
    
    .user-details-column {
        display: flex;
        flex-direction: row;
        align-items: center;
        flex: 1; /* Allow it to grow next to the checkbox */
        min-width: 0; /* Helps with text-overflow ellipsis in children */
    }
    
    /* Position checkbox to the left of username */
    .user-select {
        position: static;
        margin-right: 12px;
        width: 34px;
        min-width: 34px;
        height: 34px;
        padding: 6px;
    }
    
    /* Username with proper spacing after checkbox */
    .user-name {
        text-align: left;
        padding: 0;
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%; /* Username takes full width of its parent .user-details-column */
    }
    
    /* Hide creation date on mobile */
    .user-created {
        display: none;
    }
    
    /* Reorganize action items to include checkbox */
    .user-actions {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-top: 10px;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        margin-top: 12px; /* Added margin for spacing when wrapped */
    }
    
    /* Adjust role selector width to make room for checkbox */
    .role-select-container {
        width: 70%;
        max-width: 200px;
    }
    
    /* Create a wrapper div for the delete button and checkbox */
    .action-buttons-right {
        display: flex;
        align-items: center;
        gap: 5px;
    }
    
    /* Fix role select dropdown */
    .role-select {
        width: 100%;
        padding-right: 35px;
        font-size: 13px;
    }
    /* Fix self tag positioning */
    .self-tag {
        margin-left: 4px;
        font-size: 9px;
        padding: 1px 5px;
    }

    /* Layout for user items that are transitioning */
    .user-item.transitioning {
        height: 80px; /* Fixed height for transitioning items */
    }
}

