/* Roles Management Styles - Site-wide reusable styles */
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+Pro:wght@400;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
    --primary-blue: #0d6efd;
    --primary-blue-dark: #0a58ca;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    /* Darker grays */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    --bg-page: #f1f5f9;
    --bg-card: #ffffff;
    --bg-subtle: #e2e8f0;

    --border-light: #cbd5e1;
    --border-medium: #94a3b8;

    /* Role colors */
    --role-president: #7c3aed;
    --role-counselor: #2563eb;
    --role-secretary: #059669;
    --role-clerk: #0891b2;
    --role-bishop: #dc2626;
    --role-support: #ea580c;

    --font-serif: 'Source Serif Pro', 'Georgia', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.04);
}

/* Page Layout */
.roles-page {
    min-height: 100vh;
    background: var(--bg-page);
    font-family: var(--font-sans);
    padding: 32px 20px;
}

.roles-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Page Header */
.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 15px;
    font-weight: 400;
    color: var(--text-secondary);
    margin: 0;
}

/* Alert Box */
.alert-box {
    background: #fef3c7;
    border-left: 4px solid var(--warning);
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 6px;
    font-size: 14px;
    color: #92400e;
}

/* Data Card & Table */
.data-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--bg-subtle);
    border-bottom: 2px solid var(--border-light);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s ease;
}

.data-table tbody tr:hover {
    background: #eff6ff;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table td {
    padding: 12px 16px;
    vertical-align: middle;
}

/* User Cell */
.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-mono);
    flex-shrink: 0;
}

/* Avatar colors by role - hierarchical system */
/* Leadership Trio - Purple-Blue shades with even intensity progression */
.avatar-president {
    background: linear-gradient(135deg, #c7d2fe 0%, #a5b4fc 100%);
    color: #312e81;
    border: 1px solid #818cf8;
}

.avatar-counselor-1 {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #3730a3;
    border: 1px solid #a5b4fc;
}

.avatar-counselor-2 {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    color: #4338ca;
    border: 1px solid #c7d2fe;
}

/* Administrative - Green/Blue shades */
.avatar-secretary {
    background: linear-gradient(135deg, #a7f3d0 0%, #6ee7b7 100%);
    color: #065f46;
    border: 1px solid #34d399;
}

.avatar-clerk {
    background: linear-gradient(135deg, #cffafe 0%, #a5f3fc 100%);
    color: #155e75;
    border: 1px solid #67e8f9;
}

.avatar-assistant-secretary {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #047857;
    border: 1px solid #6ee7b7;
}

.avatar-assistant-clerk {
    background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
    color: #0891b2;
    border: 1px solid #99f6e4;
}

/* High Leadership - Distinct colors */
.avatar-bishop {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.avatar-high-counselor {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    color: #9a3412;
    border: 1px solid #fb923c;
}

/* Tech Support */
.avatar-support {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border: 1px solid #fcd34d;
}

.avatar-default {
    background: linear-gradient(135deg, #f8fafc 0%, var(--bg-subtle) 100%);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

/* User Details */
.user-details {
    min-width: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 2px 0;
}

.user-email {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    margin: 0;
    font-family: var(--font-mono);
}

/* Role Badges */
.roles-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
    font-family: var(--font-mono);
    white-space: nowrap;
}

.role-badge.primary-role {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #2563eb 100%);
    color: white;
    border: none;
}

/* Leadership Trio - Purple-Blue shades with even intensity progression */
.role-badge.role-president {
    background: linear-gradient(135deg, #c7d2fe 0%, #a5b4fc 100%);
    color: #312e81;
    border: 1px solid #818cf8;
}

.role-badge.role-counselor-1 {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #3730a3;
    border: 1px solid #a5b4fc;
}

.role-badge.role-counselor-2 {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    color: #4338ca;
    border: 1px solid #c7d2fe;
}

/* Administrative - Green/Blue shades */
.role-badge.role-secretary {
    background: linear-gradient(135deg, #a7f3d0 0%, #6ee7b7 100%);
    color: #065f46;
    border: 1px solid #34d399;
}

.role-badge.role-clerk {
    background: linear-gradient(135deg, #cffafe 0%, #a5f3fc 100%);
    color: #155e75;
    border: 1px solid #67e8f9;
}

.role-badge.role-assistant-secretary {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #047857;
    border: 1px solid #6ee7b7;
}

.role-badge.role-assistant-clerk {
    background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
    color: #0891b2;
    border: 1px solid #99f6e4;
}

/* High Leadership - Distinct colors */
.role-badge.role-bishop {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.role-badge.role-high-counselor {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    color: #9a3412;
    border: 1px solid #fb923c;
}

/* Tech Support */
.role-badge.role-support {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* Default */
.role-badge.role-default {
    background: linear-gradient(135deg, #f8fafc 0%, var(--bg-subtle) 100%);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

/* Empty State */
.empty-state {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}

/* Edit Button */
.btn-edit {
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border-medium);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.btn-edit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    opacity: 0;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

.btn-edit svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-edit:hover {
    border-color: #3b82f6;
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.btn-edit:hover::before {
    opacity: 1;
}

.btn-edit:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

/* Modern Modal Redesign */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    z-index: 1050;
    animation: fadeIn 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-glass {
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.16), 0 12px 24px rgba(0, 0, 0, 0.12);
    z-index: 1051;
    overflow: hidden;
    animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.26, 0.64, 1);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-page);
    flex-shrink: 0;
}

.modal-title {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.01em;
}

.btn-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-size: 24px;
    line-height: 1;
    padding: 0;
}

.btn-close:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.modal-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-intro {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Roles Grid */
.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.role-item {
    padding: 14px 16px;
    background: var(--bg-page);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.role-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.08) 0%, rgba(59, 130, 246, 0.08) 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.role-item:hover {
    background: white;
    border-color: var(--border-medium);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.role-item:hover::before {
    opacity: 1;
}

.role-item.selected {
    background: white;
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.role-item.selected::before {
    opacity: 1;
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.12) 0%, rgba(59, 130, 246, 0.12) 100%);
}

.role-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.role-checkbox input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #3b82f6;
}

.role-checkbox label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    flex: 1;
    user-select: none;
}

/* Modal Footer */
.modal-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: var(--bg-page);
    flex-shrink: 0;
}

.btn-cancel {
    padding: 10px 20px;
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border-medium);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-save {
    padding: 10px 24px;
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-save:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.btn-save:active {
    transform: translateY(0);
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 48px 20px;
}

.loading-text {
    font-size: 15px;
    color: var(--text-secondary);
}

/* Scrollbar Styling */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mobile Cards */
.mobile-cards {
    display: none;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .roles-page {
        padding: 20px 16px;
    }

    .page-header {
        margin-bottom: 20px;
    }

    .page-title {
        font-size: 24px;
    }

    .data-card {
        display: none;
    }

    .mobile-cards {
        display: block;
    }

    .user-card {
        background: var(--bg-card);
        border: 1px solid var(--border-light);
        border-radius: 8px;
        padding: 12px;
        margin-bottom: 10px;
        box-shadow: var(--shadow-sm);
    }

    .user-card-header {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 12px;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--border-light);
    }

    .card-avatar {
        width: 36px;
        height: 36px;
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 13px;
        font-weight: 600;
        font-family: var(--font-mono);
    }

    .card-info h3 {
        font-size: 14px;
        font-weight: 600;
        color: var(--text-primary);
        margin: 0 0 2px 0;
    }

    .card-info p {
        font-size: 12px;
        color: var(--text-secondary);
        margin: 0;
        font-family: var(--font-mono);
    }

    .card-roles {
        margin-bottom: 12px;
    }

    .card-roles-label {
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        color: var(--text-secondary);
        margin-bottom: 6px;
        letter-spacing: 0.05em;
    }

    .btn-edit {
        width: 100%;
        height: auto;
        padding: 8px;
        font-size: 14px;
    }
}
