/**
 * XAUTH Module - Design System 2.0
 * Based on Xpredict Design System (Identical Theme)
 * Claude-style sidebar + Facebook-inspired colors
 */

/* ========================================
   CSS VARIABLES - XPREDICT THEME (IDENTICAL)
   ======================================== */

:root {
    /* Primary Colors - Facebook-Inspired Theme */
    --xauth-primary: var(--x-header-primary, #0C5E94);
    --xauth-primary-dark: var(--x-header-primary-dark, var(--x-primary-dark));
    --xauth-primary-light: #1D7DC0;
    --xauth-primary-hover: #0A4E7C;
    --xauth-secondary: var(--x-secondary);
    --xauth-secondary-dark: #36a420;

    /* Status Colors */
    --xauth-success: #00a400;
    --xauth-warning: #f7b928;
    --xauth-danger: #fa3e3e;
    --xauth-info: var(--x-header-primary, #0C5E94);

    /* Text Colors - Facebook Style */
    --xauth-text-primary: #050505;
    --xauth-text-secondary: #65676b;
    --xauth-text-tertiary: #8a8d91;
    --xauth-text-dark: #1c1e21;
    --xauth-text-light: #65676b;
    --xauth-text-muted: #8a8d91;

    /* Neutral Colors - Facebook Gray Scale */
    --xauth-gray-50: #f0f2f5;
    --xauth-gray-100: #e4e6eb;
    --xauth-gray-200: #dcdee3;
    --xauth-gray-300: #ccd0d5;
    --xauth-gray-400: #b0b3b8;
    --xauth-gray-500: #8a8d91;
    --xauth-gray-600: #65676b;
    --xauth-gray-700: #4b4d52;
    --xauth-gray-800: var(--x-text-tertiary);
    --xauth-gray-900: #242526;

    /* Background */
    --xauth-background: #ffffff;
    --xauth-background-secondary: #f0f2f5;
    --xauth-background-hover: rgba(0, 0, 0, 0.05);
    --xauth-background-active: rgba(0, 0, 0, 0.1);
    --xauth-border: #e4e6eb;
    --xauth-border-light: #dcdee3;

    /* Notification Colors */
    --xauth-notification-bg: #e7f3ff;
    --xauth-notification-border: var(--x-header-primary, #0C5E94);
    --xauth-unread-badge: #e41e3f;

    /* Spacing */
    --xauth-spacing-xs: 0.25rem;
    --xauth-spacing-sm: 0.5rem;
    --xauth-spacing-md: 1rem;
    --xauth-spacing-lg: 1.5rem;
    --xauth-spacing-xl: 2rem;
    --xauth-spacing-2xl: 3rem;

    /* Typography */
    --xauth-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --xauth-font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    --xauth-font-weight-normal: 400;
    --xauth-font-weight-medium: 500;
    --xauth-font-weight-semibold: 600;
    --xauth-font-weight-bold: 700;

    /* Borders - Facebook uses more rounded corners */
    --xauth-border-radius: 8px;
    --xauth-border-radius-sm: 6px;
    --xauth-border-radius-lg: 12px;
    --xauth-border-radius-xl: 16px;
    --xauth-border-radius-full: 9999px;

    /* Shadows - Softer, Facebook-style shadows */
    --xauth-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --xauth-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --xauth-shadow-md: 0 2px 12px rgba(0, 0, 0, 0.12);
    --xauth-shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
    --xauth-shadow-xl: 0 12px 28px rgba(0, 0, 0, 0.18);

    /* Layout */
    --xauth-sidebar-width: 280px;
    --xauth-sidebar-collapsed-width: 56px;
    --xauth-topbar-height: 60px;

    /* Transitions - Smooth Facebook-style animations */
    --xauth-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --xauth-transition-fast: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    --xauth-transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-Index */
    --z-sidebar: 950;
    --z-topbar: 1000;
    --z-dropdown: 1100;
    --z-modal: 1200;
    --z-toast: 1300;
}

/* ========================================
   RESET & BASE STYLES
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--xauth-font-family);
    font-size: 14px;
    line-height: 1.5;
    color: var(--xauth-gray-900);
    background: var(--xauth-gray-50);
    overflow-x: hidden;
}

/* Sidebar styles loaded from /shared/css/sidebar.css */

/* ========================================
   TOP BAR
   ======================================== */

.xauth-topbar {
    background: white;
    border-bottom: 1px solid var(--xauth-border);
    position: fixed;
    top: 0;
    left: var(--xauth-sidebar-collapsed-width);
    right: 0;
    z-index: var(--z-topbar);
    height: var(--xauth-topbar-height);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 16px;
}

.xauth-topbar-logo {
    display: flex;
    align-items: center;
    margin-right: 24px;
}

.xauth-topbar-logo img {
    height: 36px;
    width: auto;
}

.xauth-topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Notification Center */
.xauth-notification-container {
    position: relative;
}

.xauth-notification-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--xauth-gray-100);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--xauth-transition-fast);
}

.xauth-notification-btn:hover {
    background: var(--xauth-gray-200);
}

.xauth-notification-btn svg {
    width: 20px;
    height: 20px;
    color: var(--xauth-gray-900);
    stroke-width: 2;
}

.xauth-notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--xauth-danger);
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.xauth-notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: 480px;
    background: white;
    border-radius: var(--xauth-border-radius);
    box-shadow: var(--xauth-shadow-xl);
    border: 1px solid var(--xauth-border);
    overflow: hidden;
    z-index: var(--z-dropdown);
    display: none;
}

.xauth-notification-dropdown.show {
    display: block;
}

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

.xauth-notification-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--xauth-gray-900);
}

.xauth-notification-mark-all {
    background: none;
    border: none;
    color: var(--xauth-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 4px;
    transition: var(--xauth-transition-fast);
}

.xauth-notification-mark-all:hover {
    background: var(--xauth-notification-bg);
}

/* Notification Tabs */
.xauth-notification-tabs {
    display: flex;
    padding: 0 16px;
    gap: 8px;
    border-bottom: 1px solid var(--xauth-border);
}

.xauth-notification-tab {
    flex: 1;
    padding: 12px 8px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: var(--xauth-font-weight-medium);
    color: var(--xauth-gray-600);
    cursor: pointer;
    transition: var(--xauth-transition);
    white-space: nowrap;
}

.xauth-notification-tab:hover {
    color: var(--xauth-primary);
    background: var(--xauth-gray-50);
}

.xauth-notification-tab.active {
    color: var(--xauth-primary);
    border-bottom-color: var(--xauth-primary);
    font-weight: var(--xauth-font-weight-semibold);
}

.xauth-notification-list {
    max-height: 360px;
    overflow-y: auto;
}

.xauth-notification-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: var(--xauth-gray-500);
}

.xauth-notification-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    stroke-width: 1.5;
}

.xauth-notification-empty p {
    font-size: 14px;
    margin: 0;
}

.xauth-user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 8px;
    border: 1px solid var(--xauth-border);
    background: white;
    cursor: pointer;
    transition: var(--xauth-transition-fast);
}

.xauth-user-btn:hover {
    background: var(--xauth-background-hover);
    border-color: var(--xauth-gray-300);
}

.xauth-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--xauth-primary, var(--x-header-primary, #0C5E94));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}


.xauth-user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--xauth-gray-900);
    line-height: 1.2;
}

.xauth-user-chevron {
    width: 20px;
    height: 20px;
    color: var(--xauth-gray-600);
    stroke-width: 2;
    transition: var(--xauth-transition-fast);
}

.xauth-user-btn:hover .xauth-user-chevron {
    color: var(--xauth-gray-900);
}

/* ========================================
   MAIN CONTENT WRAPPER
   ======================================== */

.xauth-main-wrapper {
    margin-left: var(--xauth-sidebar-collapsed-width);
    padding-top: var(--xauth-topbar-height);
    min-height: 100vh;
    background: var(--xauth-gray-50);
}

.xauth-content {
    padding: 24px;
}

/* ========================================
   BUTTONS
   ======================================== */

.xauth-btn {
    background: var(--xauth-gray-50);
    color: var(--xauth-gray-900);
    padding: 10px 20px;
    border-radius: var(--xauth-border-radius);
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: var(--xauth-transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.xauth-btn:hover {
    background: var(--xauth-gray-100);
}

.xauth-btn-primary {
    background: var(--xauth-primary);
    color: white;
    box-shadow: var(--xauth-shadow-sm);
}

.xauth-btn-primary:hover {
    background: var(--xauth-primary-hover);
}

.xauth-btn-secondary {
    background: var(--xauth-gray-50);
    color: var(--xauth-gray-900);
}

.xauth-btn-success {
    background: var(--xauth-success);
    color: white;
}

.xauth-btn-success:hover {
    background: #2d9544;
}

.xauth-btn-danger {
    background: var(--xauth-danger);
    color: white;
}

.xauth-btn-danger:hover {
    background: var(--x-danger-dark);
}

.xauth-btn-warning {
    background: var(--xauth-warning);
    color: white;
}

.xauth-btn-info {
    background: var(--xauth-info);
    color: white;
}

.xauth-btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.xauth-btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

.xauth-btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
   SUBTABS (for Sessions section)
   ======================================== */

.xauth-subtabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--xauth-border);
    padding-bottom: 12px;
}

.xauth-subtab {
    background: var(--xauth-gray-50);
    color: var(--xauth-gray-700);
    padding: 10px 16px;
    border-radius: var(--xauth-border-radius);
    font-weight: 500;
    font-size: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--xauth-transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.xauth-subtab:hover {
    background: var(--xauth-gray-100);
    color: var(--xauth-gray-900);
}

.xauth-subtab.active {
    background: var(--xauth-primary);
    color: white;
    border-color: var(--xauth-primary);
}

.xauth-subtab .xauth-nav-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.xauth-subtab:not(.active) .xauth-nav-badge {
    background: var(--xauth-danger);
    color: white;
}

/* ========================================
   CARDS
   ======================================== */

.xauth-card {
    background: white;
    border-radius: var(--xauth-border-radius);
    box-shadow: var(--xauth-shadow-sm);
    padding: 20px;
    margin-bottom: 16px;
}

.xauth-card-header {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--xauth-border);
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.xauth-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--xauth-gray-900);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.xauth-card-actions {
    display: flex;
    gap: 8px;
}

.xauth-card-body {
    padding: 0;
}

/* ========================================
   TABLES
   ======================================== */

.xauth-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--xauth-border-radius);
    overflow: hidden;
}

.xauth-table thead {
    background: var(--xauth-gray-50);
}

.xauth-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--xauth-gray-600);
    border-bottom: 1px solid var(--xauth-border);
}

.xauth-table tbody tr {
    border-bottom: 1px solid var(--xauth-border);
    transition: var(--xauth-transition-fast);
}

.xauth-table tbody tr:hover {
    background: #f7f8fa;
}

.xauth-table td {
    padding: 16px;
    font-size: 14px;
    color: var(--xauth-gray-900);
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

.xauth-form-group {
    margin-bottom: 16px;
}

.xauth-form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--xauth-gray-900);
}

.xauth-form-group input[type="text"],
.xauth-form-group input[type="email"],
.xauth-form-group input[type="password"],
.xauth-form-group input[type="number"],
.xauth-form-group input[type="tel"],
.xauth-form-group textarea,
.xauth-form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--xauth-border);
    border-radius: var(--xauth-border-radius);
    font-size: 14px;
    color: var(--xauth-gray-900);
    background: white;
    transition: var(--xauth-transition-fast);
}

.xauth-form-group input:focus,
.xauth-form-group textarea:focus,
.xauth-form-group select:focus {
    outline: none;
    border-color: var(--xauth-primary);
    box-shadow: 0 0 0 3px var(--xauth-notification-bg);
}

.xauth-form-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--xauth-gray-600);
}

.xauth-form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.xauth-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.xauth-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border: 2px solid var(--xauth-border);
    border-radius: 4px;
    cursor: pointer;
    accent-color: var(--xauth-primary);
}

/* ========================================
   DROPDOWNS
   ======================================== */

.xauth-dropdown {
    position: relative;
    display: inline-block;
}

.xauth-dropdown-menu {
    position: fixed;
    background: white;
    border-radius: var(--xauth-border-radius);
    box-shadow: var(--xauth-shadow-lg);
    min-width: 180px;
    padding: 8px;
    z-index: 99999;
    display: none;
}

.xauth-dropdown-menu.show {
    display: block;
}

.xauth-dropdown-item {
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--xauth-transition-fast);
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--xauth-gray-900);
    text-decoration: none;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
}

.xauth-dropdown-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.xauth-dropdown-item:hover {
    background: var(--xauth-gray-50);
}

.xauth-dropdown-item.danger {
    color: var(--xauth-danger);
}

.xauth-dropdown-divider {
    height: 1px;
    background: var(--xauth-border);
    margin: 8px 0;
}

/* ========================================
   MODALS
   ======================================== */

.xauth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none !important;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: 20px;
}

.xauth-modal-overlay.active,
.xauth-modal-overlay.show {
    display: flex !important;
}

.xauth-modal {
    background: white;
    border-radius: var(--xauth-border-radius);
    box-shadow: var(--xauth-shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

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

.xauth-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--xauth-gray-900);
    margin: 0;
}

.xauth-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--xauth-gray-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--xauth-transition-fast);
}

.xauth-modal-close:hover {
    background: var(--xauth-gray-100);
}

.xauth-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

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

/* ========================================
   STATS CARDS
   ======================================== */

.xauth-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.xauth-stat-card {
    background: white;
    border-radius: var(--xauth-border-radius);
    padding: 20px;
    box-shadow: var(--xauth-shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
}

.xauth-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--xauth-border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.xauth-stat-content {
    flex: 1;
}

.xauth-stat-label {
    font-size: 13px;
    color: var(--xauth-gray-600);
    margin-bottom: 4px;
}

.xauth-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--xauth-gray-900);
}

/* ========================================
   TAB CONTENT
   ======================================== */

.xauth-tab-content {
    display: none;
}

.xauth-tab-content.active {
    display: block;
}

/* ========================================
   BADGES
   ======================================== */

.xauth-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.xauth-badge-success {
    background: var(--x-success-bg);
    color: var(--x-success-dark);
}

.xauth-badge-warning {
    background: var(--x-warning-bg);
    color: var(--x-warning-dark);
}

.xauth-badge-danger {
    background: var(--x-danger-bg);
    color: var(--x-danger-dark);
}

.xauth-badge-info {
    background: var(--xauth-notification-bg);
    color: var(--xauth-primary);
}

.xauth-badge-primary {
    background: var(--xauth-notification-bg);
    color: var(--xauth-primary);
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.xauth-toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.xauth-toast {
    background: white;
    border-radius: var(--xauth-border-radius);
    box-shadow: var(--xauth-shadow-lg);
    padding: 16px;
    min-width: 300px;
    max-width: 400px;
    border-left: 4px solid var(--xauth-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.xauth-toast-success {
    border-left-color: var(--xauth-success);
}

.xauth-toast-error {
    border-left-color: var(--xauth-danger);
}

.xauth-toast-warning {
    border-left-color: var(--xauth-warning);
}

.xauth-toast-info {
    border-left-color: var(--xauth-info);
}

/* ========================================
   USER AVATAR
   ======================================== */

.xauth-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--xauth-primary, var(--x-header-primary, #0C5E94));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    box-shadow: var(--xauth-shadow-sm);
}

.xauth-user-avatar.sm {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.xauth-user-avatar.lg {
    width: 56px;
    height: 56px;
    font-size: 20px;
}

.xauth-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* ========================================
   SEARCH BAR
   ======================================== */

.xauth-search-bar {
    position: relative;
    display: flex;
    align-items: center;
}

.xauth-search-icon {
    position: absolute;
    left: 12px;
    color: var(--xauth-gray-600);
    pointer-events: none;
}

.xauth-search-input {
    width: 300px;
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--xauth-border);
    border-radius: var(--xauth-border-radius);
    font-size: 14px;
    color: var(--xauth-gray-900);
    background: white;
    transition: var(--xauth-transition-fast);
}

.xauth-search-input:focus {
    outline: none;
    border-color: var(--xauth-primary);
    box-shadow: 0 0 0 3px var(--xauth-notification-bg);
}

/* ========================================
   ROLES GRID
   ======================================== */

.xauth-roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.xauth-role-card {
    background: white;
    border-radius: var(--xauth-border-radius);
    padding: 20px;
    box-shadow: var(--xauth-shadow-sm);
    border-left: 4px solid var(--xauth-primary);
}

.xauth-role-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.xauth-role-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--xauth-gray-900);
}

.xauth-role-card-actions {
    display: flex;
    gap: 4px;
}

/* ========================================
   ACTIVITY ITEMS (XPREDICT STOCK ALERTS STYLE)
   ======================================== */

.xauth-activity-item {
    padding: 12px;
    background: var(--x-bg-secondary);
    margin-bottom: 10px;
    border-radius: 4px;
    border-left: 3px solid var(--xauth-primary);
}

.xauth-activity-item.success {
    border-left-color: var(--xauth-success);
}

.xauth-activity-item.warning {
    border-left-color: var(--xauth-warning);
}

.xauth-activity-item.danger {
    border-left-color: var(--xauth-danger);
}

.xauth-activity-item.info {
    border-left-color: var(--xauth-info);
}

.xauth-activity-content-wrapper {
    display: flex;
    align-items: start;
    gap: 10px;
}

.xauth-activity-icon {
    font-size: 20px;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.xauth-activity-icon.success {
    color: var(--xauth-success);
}

.xauth-activity-icon.warning {
    color: var(--xauth-warning);
}

.xauth-activity-icon.danger {
    color: var(--xauth-danger);
}

.xauth-activity-icon.info {
    color: var(--xauth-primary);
}

.xauth-activity-details {
    flex: 1;
    min-width: 0;
}

.xauth-activity-title {
    color: var(--x-text-primary);
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

.xauth-activity-message {
    color: var(--x-text-tertiary);
    font-size: 13px;
    display: block;
}

.xauth-activity-time {
    color: var(--x-text-tertiary);
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1024px) {
    .xauth-sidebar {
        display: none;
    }

    .xauth-top-bar {
        left: 0;
    }

    .xauth-main-wrapper {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .xauth-card {
        padding: 16px;
    }

    .xauth-top-bar {
        padding: 0 12px;
    }

    .xauth-content {
        padding: 16px;
    }

    .xauth-stats-grid {
        grid-template-columns: 1fr;
    }

    .xauth-form-row {
        grid-template-columns: 1fr;
    }

    .xauth-search-input {
        width: 200px;
    }

    .xauth-page-title h1 {
        font-size: 18px;
    }

    .xauth-page-subtitle {
        display: none;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.xauth-text-center {
    text-align: center;
}

.xauth-text-right {
    text-align: right;
}

.xauth-text-muted {
    color: var(--xauth-gray-600);
}

.xauth-text-bold {
    font-weight: 600;
}

.xauth-hidden {
    display: none !important;
}

.xauth-visible {
    display: block !important;
}

.xauth-mt-1 { margin-top: 4px; }
.xauth-mt-2 { margin-top: 8px; }
.xauth-mt-3 { margin-top: 16px; }
.xauth-mt-4 { margin-top: 24px; }

.xauth-mb-1 { margin-bottom: 4px; }
.xauth-mb-2 { margin-bottom: 8px; }
.xauth-mb-3 { margin-bottom: 16px; }
.xauth-mb-4 { margin-bottom: 24px; }

/* ========================================
   LOADING STATES
   ======================================== */

.xauth-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--xauth-gray-100);
    border-top-color: var(--xauth-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.xauth-skeleton {
    /* shimmer — kept */
    background: linear-gradient(
        90deg,
        var(--xauth-gray-100) 25%,
        var(--xauth-gray-50) 50%,
        var(--xauth-gray-100) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ========================================
   PAGINATION STYLES
   ======================================== */

.xauth-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 0;
}

.xauth-btn[disabled],
.xauth-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.xauth-btn[disabled]:hover,
.xauth-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ========================================
   TOGGLE SWITCH STYLES
   ======================================== */

.xauth-toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.xauth-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.xauth-toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--x-border);
    border-radius: 24px;
    transition: var(--xauth-transition);
}

.xauth-toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 2px;
    top: 2px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: var(--xauth-transition);
}

.xauth-toggle-switch input:checked + .xauth-toggle-slider {
    background: var(--xauth-primary);
}

.xauth-toggle-switch input:checked + .xauth-toggle-slider::before {
    transform: translateX(20px);
}

.xauth-toggle-switch input:focus + .xauth-toggle-slider {
    box-shadow: 0 0 0 3px rgba(12, 94, 148, 0.2);
}

.xauth-toggle-switch input:disabled + .xauth-toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   APP ACCESS CHECKBOXES
   ======================================== */

.app-access-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    background: #ffffff;
    border: 2px solid var(--x-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.app-access-item:hover {
    border-color: var(--xauth-primary-light);
    background: var(--x-bg-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.app-access-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.app-access-item input[type="checkbox"]:checked + .app-access-content {
    opacity: 1;
}

.app-access-item:has(input:checked) {
    border-color: var(--xauth-primary);
    background: rgba(12, 94, 148, 0.08);
    box-shadow: 0 0 0 3px rgba(12, 94, 148, 0.15);
}

.app-access-item:has(input:checked)::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 10px;
    width: 20px;
    height: 20px;
    background: var(--xauth-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
}

.app-access-content {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.app-access-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.app-access-icon svg {
    width: 20px;
    height: 20px;
}

.app-access-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.app-access-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--x-text-primary);
}

.app-access-desc {
    font-size: 11px;
    color: var(--x-text-tertiary);
}

/* Responsive */
@media (max-width: 600px) {
    #app-access-checkboxes {
        grid-template-columns: 1fr !important;
    }
}


/* ============================================
   DARK MODE OVERRIDES
   ============================================ */
[data-theme="dark"] {
    --xauth-text-primary: #f0f2f5;
    --xauth-text-secondary: #b0b3b8;
    --xauth-text-tertiary: #8a8d91;
    --xauth-text-dark: #e4e6eb;
    --xauth-text-light: #b0b3b8;
    --xauth-text-muted: #8a8d91;

    --xauth-gray-50: #242526;
    --xauth-gray-100: var(--x-text-tertiary);
    --xauth-gray-200: #4b4d52;
    --xauth-gray-300: #65676b;
    --xauth-gray-400: #8a8d91;
    --xauth-gray-500: #b0b3b8;
    --xauth-gray-600: #ccd0d5;
    --xauth-gray-700: #dcdee3;
    --xauth-gray-800: #e4e6eb;
    --xauth-gray-900: #f0f2f5;

    --xauth-background: #1a1b1e;
    --xauth-background-secondary: #242526;
    --xauth-background-hover: rgba(255, 255, 255, 0.06);
    --xauth-background-active: rgba(255, 255, 255, 0.1);
    --xauth-border: var(--x-text-tertiary);
    --xauth-border-light: #4b4d52;
}

