/**
 * 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 */
    --xpredict-primary: #1877f2;
    --xpredict-primary-dark: #166fe5;
    --xpredict-primary-light: #4a90f5;
    --xpredict-primary-hover: #3a82f0;
    --xpredict-secondary: #42b72a;
    --xpredict-secondary-dark: #36a420;

    /* Status Colors */
    --xpredict-success: #00a400;
    --xpredict-warning: #f7b928;
    --xpredict-danger: #fa3e3e;
    --xpredict-info: #1877f2;

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

    /* Neutral Colors - Facebook Gray Scale */
    --xpredict-gray-50: #f0f2f5;
    --xpredict-gray-100: #e4e6eb;
    --xpredict-gray-200: #dcdee3;
    --xpredict-gray-300: #ccd0d5;
    --xpredict-gray-400: #b0b3b8;
    --xpredict-gray-500: #8a8d91;
    --xpredict-gray-600: #65676b;
    --xpredict-gray-700: #4b4d52;
    --xpredict-gray-800: #3a3b3f;
    --xpredict-gray-900: #242526;

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

    /* Notification Colors */
    --xpredict-notification-bg: #e7f3ff;
    --xpredict-notification-border: #1877f2;
    --xpredict-unread-badge: #e41e3f;

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

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

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

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

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

    /* Transitions - Smooth Facebook-style animations */
    --xpredict-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --xpredict-transition-fast: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    --xpredict-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(--xpredict-font-family);
    font-size: 14px;
    line-height: 1.5;
    color: var(--xpredict-gray-900);
    background: var(--xpredict-gray-50);
    overflow-x: hidden;
}

/* ========================================
   SIDEBAR - ICON ONLY (CLAUDE STYLE)
   ======================================== */

.xauth-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--xpredict-sidebar-collapsed-width);
    height: 100vh;
    background: white;
    border-right: 1px solid var(--xpredict-border);
    display: flex;
    flex-direction: column;
    padding: 0;
    z-index: var(--z-sidebar);
    overflow-x: hidden;
}

.xauth-sidebar-header {
    display: none; /* Hidden in icon-only mode */
}

.xauth-sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 8px;
    overflow-x: hidden;
}

.xauth-sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.xauth-sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--xpredict-gray-300);
    border-radius: 2px;
}

.xauth-nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--xpredict-border-radius);
    background: transparent;
    color: var(--xpredict-gray-600);
    text-decoration: none;
    transition: var(--xpredict-transition-fast);
    position: relative;
    cursor: pointer;
    border: none;
}

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

.xauth-nav-item.active {
    background: var(--xpredict-notification-bg);
    color: var(--xpredict-primary);
}

.xauth-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.xauth-nav-icon svg {
    width: 20px;
    height: 20px;
}

.xauth-nav-text {
    display: none; /* Hidden in icon-only mode */
}

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

/* Tooltip */
.xauth-nav-tooltip,
.xauth-nav-item::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 12px;
    padding: 6px 12px;
    background: var(--xpredict-gray-900);
    color: white;
    font-size: 13px;
    border-radius: var(--xpredict-border-radius);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--xpredict-transition-fast);
    z-index: calc(var(--z-topbar) + 50);
}

.xauth-nav-item:hover::after {
    opacity: 1;
}

/* Sidebar Footer */
.xauth-sidebar-footer {
    padding: 8px;
    border-top: 1px solid var(--xpredict-border);
}

/* Sidebar Toggle - Hidden in new design */
.xauth-sidebar-toggle {
    display: none;
}

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

.xauth-topbar {
    background: white;
    border-bottom: 1px solid var(--xpredict-border);
    position: fixed;
    top: 0;
    left: var(--xpredict-sidebar-collapsed-width);
    right: 0;
    z-index: var(--z-topbar);
    height: var(--xpredict-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(--xpredict-gray-100);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--xpredict-transition-fast);
}

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

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

.xauth-notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--xpredict-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(--xpredict-border-radius);
    box-shadow: var(--xpredict-shadow-xl);
    border: 1px solid var(--xpredict-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(--xpredict-border);
}

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

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

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

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

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

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

.xauth-notification-tab.active {
    color: var(--xpredict-primary);
    border-bottom-color: var(--xpredict-primary);
    font-weight: var(--xpredict-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(--xpredict-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(--xpredict-border);
    background: white;
    cursor: pointer;
    transition: var(--xpredict-transition-fast);
}

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

.xauth-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--xpredict-primary) 0%, var(--xpredict-primary-hover) 100%);
    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(--xpredict-gray-900);
    line-height: 1.2;
}

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

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

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

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

.xauth-content {
    padding: 24px;
}

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

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

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

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

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

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

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

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

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

.xauth-btn-danger:hover {
    background: #c82333;
}

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

.xauth-btn-info {
    background: var(--xpredict-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;
}

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

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

.xauth-card-header {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--xpredict-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(--xpredict-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(--xpredict-border-radius);
    overflow: hidden;
}

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

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

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

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

.xauth-table td {
    padding: 16px;
    font-size: 14px;
    color: var(--xpredict-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(--xpredict-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(--xpredict-border);
    border-radius: var(--xpredict-border-radius);
    font-size: 14px;
    color: var(--xpredict-gray-900);
    background: white;
    transition: var(--xpredict-transition-fast);
}

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

.xauth-form-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--xpredict-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(--xpredict-border);
    border-radius: 4px;
    cursor: pointer;
    accent-color: var(--xpredict-primary);
}

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

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

.xauth-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: var(--xpredict-border-radius);
    box-shadow: var(--xpredict-shadow-lg);
    min-width: 280px;
    padding: 8px;
    z-index: var(--z-dropdown);
    display: none;
}

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

.xauth-dropdown-item {
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--xpredict-transition-fast);
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--xpredict-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(--xpredict-gray-50);
}

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

.xauth-dropdown-divider {
    height: 1px;
    background: var(--xpredict-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(--xpredict-border-radius);
    box-shadow: var(--xpredict-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(--xpredict-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

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

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

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

.xauth-modal-footer {
    padding: 20px;
    border-top: 1px solid var(--xpredict-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(--xpredict-border-radius);
    padding: 20px;
    box-shadow: var(--xpredict-shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
}

.xauth-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--xpredict-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(--xpredict-gray-600);
    margin-bottom: 4px;
}

.xauth-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--xpredict-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: #d4edda;
    color: #155724;
}

.xauth-badge-warning {
    background: #fff3cd;
    color: #856404;
}

.xauth-badge-danger {
    background: #f8d7da;
    color: #721c24;
}

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

.xauth-badge-primary {
    background: var(--xpredict-notification-bg);
    color: var(--xpredict-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(--xpredict-border-radius);
    box-shadow: var(--xpredict-shadow-lg);
    padding: 16px;
    min-width: 300px;
    max-width: 400px;
    border-left: 4px solid var(--xpredict-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(--xpredict-success);
}

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

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

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

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

.xauth-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--xpredict-primary) 0%, var(--xpredict-info) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    box-shadow: var(--xpredict-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(--xpredict-gray-600);
    pointer-events: none;
}

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

.xauth-search-input:focus {
    outline: none;
    border-color: var(--xpredict-primary);
    box-shadow: 0 0 0 3px var(--xpredict-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(--xpredict-border-radius);
    padding: 20px;
    box-shadow: var(--xpredict-shadow-sm);
    border-left: 4px solid var(--xpredict-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(--xpredict-gray-900);
}

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

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

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

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

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

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

.xauth-activity-item.info {
    border-left-color: var(--xpredict-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(--xpredict-success);
}

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

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

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

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

.xauth-activity-title {
    color: #2c3e50;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

.xauth-activity-message {
    color: #7f8c8d;
    font-size: 13px;
    display: block;
}

.xauth-activity-time {
    color: #95a5a6;
    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(--xpredict-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(--xpredict-gray-100);
    border-top-color: var(--xpredict-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.xauth-skeleton {
    background: linear-gradient(
        90deg,
        var(--xpredict-gray-100) 25%,
        var(--xpredict-gray-50) 50%,
        var(--xpredict-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: #d1d5db;
    border-radius: 24px;
    transition: var(--xpredict-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(--xpredict-transition);
}

.xauth-toggle-switch input:checked + .xauth-toggle-slider {
    background: var(--xpredict-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(24, 119, 242, 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 #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.app-access-item:hover {
    border-color: var(--xpredict-primary-light);
    background: #f8fafc;
    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(--xpredict-primary);
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.15);
}

.app-access-item:has(input:checked)::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 10px;
    width: 20px;
    height: 20px;
    background: var(--xpredict-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: #1f2937;
}

.app-access-desc {
    font-size: 11px;
    color: #6b7280;
}

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

