/* Enterprise Admin Panel Styles */
:root {
    /* Theme colors - Updated for modern enterprise look */
    --bs-primary: #2563eb;
    --bs-secondary: #64748b;
    --bs-success: #10b981;
    --bs-info: #0ea5e9;
    --bs-warning: #f59e0b;
    --bs-danger: #ef4444;
    --bs-light: #f8fafc;
    --bs-muted: #94a3b8;
    --bs-dark: #1e293b;

    /* Neutral colors */
    --bs-white: #ffffff;
    --bs-black: #000000;
    --bs-gray-50: #f8fafc;
    --bs-gray-100: #f1f5f9;
    --bs-gray-200: #e2e8f0;
    --bs-gray-300: #cbd5e1;
    --bs-gray-400: #94a3b8;
    --bs-gray-500: #64748b;
    --bs-gray-600: #475569;
    --bs-gray-700: #334155;
    --bs-gray-800: #1e293b;
    --bs-gray-900: #0f172a;

    /* Layout variables */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --navbar-height: 70px;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Animation */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* RGB values for alpha transparency */
    --bs-primary-rgb: 37, 99, 235;
    --bs-secondary-rgb: 100, 116, 139;
    --bs-success-rgb: 16, 185, 129;
    --bs-info-rgb: 14, 165, 233;
    --bs-warning-rgb: 245, 158, 11;
    --bs-danger-rgb: 239, 68, 68;
    --bs-light-rgb: 248, 250, 252;
    --bs-dark-rgb: 30, 41, 59;
}

/* === Global Styles === */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bs-gray-50);
    color: var(--bs-gray-800);
    line-height: 1.6;
}

/* === Layout Structure === */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    margin-top: var(--navbar-height);
    margin-right: 0;
    transition: margin-right 0.3s ease;
    min-width: 0; /* Allow content to shrink */
}

/* Adjust main content when chat is expanded */
.main-content.chat-expanded {
    margin-right: 400px !important;
}

/* Force chat panel positioning */
.ai-chat-panel {
    position: fixed !important;
    top: 60px !important;
    right: 0 !important;
    width: 400px !important;
    height: calc(100vh - 60px) !important;
    z-index: 1000 !important;
    background: #ffffff !important;
    border-left: 1px solid #e5e7eb !important;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1) !important;
}

.content-wrapper {
    padding: 2rem;
}

/* === Top Navigation === */
.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: var(--bs-white);
    border-bottom: 1px solid var(--bs-gray-200);
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 1.5rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: var(--bs-gray-900);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--bs-gray-600);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background-color: var(--bs-gray-100);
    color: var(--bs-gray-900);
}

.logo {
    height: 32px;
    margin-right: 0.75rem;
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--bs-primary);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.action-btn {
    position: relative;
    background: none;
    border: none;
    color: var(--bs-gray-600);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.action-btn:hover {
    background-color: var(--bs-gray-100);
    color: var(--bs-gray-900);
}

.notification-badge {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background-color: var(--bs-danger);
    color: white;
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
    min-width: 1.25rem;
    text-align: center;
}

.user-profile {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.user-profile:hover {
    background-color: var(--bs-gray-100);
}

.user-avatar {
    font-size: 2rem;
    color: var(--bs-gray-600);
    margin-right: 0.75rem;
}

.user-info {
    text-align: left;
    margin-right: 0.5rem;
}

.user-name {
    font-weight: 600;
    color: var(--bs-gray-900);
    font-size: 0.875rem;
}

.user-role {
    color: var(--bs-gray-500);
    font-size: 0.75rem;
}

/* === Sidebar === */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: var(--bs-white);
    border-right: 1px solid var(--bs-gray-200);
    overflow-y: auto;
    z-index: 900;
    transition: var(--transition);
}

.sidebar-content {
    padding: 1.5rem 0;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section-title {
    display: flex;
    align-items: center;
    padding: 0.5rem 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--bs-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-section-title i {
    margin-right: 0.5rem;
    font-size: 1rem;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--bs-gray-700);
    text-decoration: none;
    transition: var(--transition);
    border-radius: 0;
    position: relative;
}

.nav-link:hover {
    background-color: var(--bs-gray-100);
    color: var(--bs-gray-900);
}

.nav-link.active {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--bs-primary);
    border-right: 3px solid var(--bs-primary);
}

.nav-link i {
    margin-right: 0.75rem;
    font-size: 1.125rem;
    width: 1.25rem;
    text-align: center;
}

.nav-text {
    flex: 1;
    font-weight: 500;
}

/* === Page Header === */
.page-header {
    background: var(--bs-white);
    border-bottom: 1px solid var(--bs-gray-200);
    margin: -2rem -2rem 2rem -2rem;
    padding: 2rem;
}

.page-header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--bs-gray-900);
    margin: 0;
}

.page-subtitle {
    color: var(--bs-gray-600);
    margin: 0.5rem 0 0 0;
    font-size: 1rem;
}

.page-actions {
    display: flex;
    gap: 0.75rem;
}

/* === Dashboard Content === */
.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    background: var(--bs-white);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--bs-gray-200);
    display: flex;
    align-items: center;
}

.metric-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    color: white;
    font-size: 1.25rem;
}

.metric-content {
    flex: 1;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--bs-gray-900);
    line-height: 1;
}

.metric-label {
    color: var(--bs-gray-600);
    font-size: 0.875rem;
    margin: 0.25rem 0;
}

.metric-trend {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 600;
}

.metric-trend.positive {
    color: var(--bs-success);
}

.metric-trend.negative {
    color: var(--bs-danger);
}

.metric-trend.neutral {
    color: var(--bs-gray-600);
}

.metric-trend i {
    margin-right: 0.25rem;
}

/* === Content Cards === */
.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: 800px;
}

.content-card {
    background: var(--bs-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--bs-gray-200);
    overflow: hidden;
}

.content-card.full-width {
    grid-column: 1 / -1;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--bs-gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--bs-gray-900);
    margin: 0;
}

.card-content {
    padding: 1.5rem;
}

/* === Activity List === */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.activity-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    color: var(--bs-gray-900);
    font-size: 0.875rem;
}

.activity-subtitle {
    color: var(--bs-gray-600);
    font-size: 0.875rem;
    margin: 0.125rem 0;
}

.activity-timestamp {
    color: var(--bs-gray-500);
    font-size: 0.75rem;
}

/* === Quick Actions === */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quick-action-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--bs-gray-50);
    border-radius: var(--border-radius);
    text-decoration: none;
    transition: var(--transition);
    border: 1px solid transparent;
}

.quick-action-item:hover {
    background: var(--bs-gray-100);
    border-color: var(--bs-gray-200);
    transform: translateY(-1px);
}

.quick-action-item i {
    font-size: 1.25rem;
    color: var(--bs-primary);
    margin-right: 1rem;
    width: 1.5rem;
    text-align: center;
}

.quick-action-item span {
    flex: 1;
    font-weight: 500;
    color: var(--bs-gray-900);
}

.quick-action-item small {
    color: var(--bs-gray-500);
    font-size: 0.75rem;
}

/* === Status Components === */
.status-indicator {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--bs-gray-600);
}

.status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bs-gray-50);
    border-radius: var(--border-radius);
}

.status-label {
    font-weight: 500;
    color: var(--bs-gray-700);
}

.status-value {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--bs-gray-600);
}

/* === Authentication Page === */
.auth-required {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-content {
    text-align: center;
    max-width: 400px;
}

.auth-icon {
    font-size: 4rem;
    color: var(--bs-gray-400);
    margin-bottom: 1.5rem;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--bs-gray-900);
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--bs-gray-600);
    margin-bottom: 2rem;
}

/* === Button Styles === */
.btn {
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: white;
}

.btn-primary:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
}

.btn-outline-primary {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background-color: var(--bs-primary);
    color: white;
}

.btn-outline-secondary {
    color: var(--bs-gray-600);
    border-color: var(--bs-gray-300);
    background: transparent;
}

.btn-outline-secondary:hover {
    background-color: var(--bs-gray-100);
    border-color: var(--bs-gray-400);
}

/* === Dropdown Styles === */
.dropdown-menu {
    border: 1px solid var(--bs-gray-200);
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius);
    margin-top: 0.5rem;
}

.dropdown-item {
    color: var(--bs-gray-700);
    transition: var(--transition);
}

.dropdown-item:hover {
    background-color: var(--bs-gray-100);
    color: var(--bs-gray-900);
}

.notification-dropdown {
    min-width: 320px;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--bs-gray-100);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item i {
    margin-right: 0.75rem;
    margin-top: 0.125rem;
    font-size: 1rem;
}

.notification-title {
    font-weight: 500;
    color: var(--bs-gray-900);
    font-size: 0.875rem;
}

.notification-time {
    color: var(--bs-gray-500);
    font-size: 0.75rem;
    margin-top: 0.125rem;
}

/* === Error UI === */
#blazor-error-ui {
    display: none !important; /* Force hide default error UI */
}

#blazor-error-ui .dismiss {
    display: none !important;
}

/* === Reconnection Modal === */
#reconnect-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

#reconnect-modal > div {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    text-align: center;
    max-width: 400px;
}

#reconnect-modal p {
    margin: 1rem 0 0 0;
    color: var(--bs-gray-700);
    font-weight: 500;
}

/* === Modal Styles === */
.modal {
    padding-top: 60px !important;
}

[role="dialog"] {
    padding-top: 60px !important;
}

/* === Responsive Design === */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .content-wrapper {
        padding: 1rem;
    }

    .page-header {
        margin: -1rem -1rem 1rem -1rem;
        padding: 1rem;
    }

    .page-header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .status-grid {
        grid-template-columns: 1fr;
    }
}

/* === Utility Classes === */
.text-primary {
    color: var(--bs-primary) !important;
}

.text-secondary {
    color: var(--bs-secondary) !important;
}

.text-success {
    color: var(--bs-success) !important;
}

.text-info {
    color: var(--bs-info) !important;
}

.text-warning {
    color: var(--bs-warning) !important;
}

.text-danger {
    color: var(--bs-danger) !important;
}

.bg-primary {
    background-color: var(--bs-primary) !important;
}

.bg-secondary {
    background-color: var(--bs-secondary) !important;
}

.bg-success {
    background-color: var(--bs-success) !important;
}

.bg-info {
    background-color: var(--bs-info) !important;
}

.bg-warning {
    background-color: var(--bs-warning) !important;
}

.bg-danger {
    background-color: var(--bs-danger) !important;
}

/* === iOS Style Toggle Switch === */
.form-check-input[type="checkbox"] {
    width: 48px;
    height: 28px;
    border-radius: 14px;
    background-color: #e2e8f0;
    border: none;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.form-check-input[type="checkbox"]:before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.form-check-input[type="checkbox"]:checked {
    background-color: var(--bs-success);
    border-color: var(--bs-success);
}

.form-check-input[type="checkbox"]:checked:before {
    transform: translateX(20px);
}

.form-check-input[type="checkbox"]:focus {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06), 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-check-input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Hide the default label for toggle switches */
.form-check-label:empty {
    margin-left: 0;
}

/* === AI Chat Panel Styles === */
.ai-chat-panel {
    position: fixed;
    top: 60px;
    right: 0;
    width: 380px;
    height: calc(100vh - 60px);
    background: #ffffff;
    border-left: 1px solid #e5e7eb;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: transform 0.3s ease;
}

.ai-chat-panel.collapsed {
    transform: translateX(340px);
}

.ai-chat-panel.expanded {
    transform: translateX(0);
}

/* Chat Header */
.ai-chat-panel .chat-header {
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 20px;
}

.ai-chat-panel .chat-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-chat-panel .chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
    color: #374151;
}

.ai-chat-panel .chat-title i {
    color: #3b82f6;
    font-size: 18px;
}

.ai-chat-panel .status-indicator {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.ai-chat-panel .status-indicator.online {
    background: #dcfce7;
    color: #166534;
}

.ai-chat-panel .status-indicator.typing {
    background: #fef3c7;
    color: #92400e;
}

.ai-chat-panel .status-indicator.loading {
    background: #dbeafe;
    color: #1e40af;
}

.ai-chat-panel .chat-toggle-btn {
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #6b7280;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-chat-panel .chat-toggle-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* Chat Content */
.ai-chat-panel .chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

/* Messages Container */
.ai-chat-panel .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: calc(100vh - 300px); /* Ensure proper scrolling */
    min-height: 200px; /* Minimum height for content */
}

.ai-chat-panel .chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-panel .chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.ai-chat-panel .chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Welcome Message */
.ai-chat-panel .welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.ai-chat-panel .welcome-icon {
    font-size: 48px;
    color: #3b82f6;
    margin-bottom: 16px;
}

.ai-chat-panel .welcome-message h4 {
    color: #374151;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 18px;
}

.ai-chat-panel .welcome-message p {
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 24px 0;
    color: #6b7280;
}

/* Welcome Suggestions */
.ai-chat-panel .welcome-suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-chat-panel .suggestion-btn {
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
}

.ai-chat-panel .suggestion-btn:hover {
    background: #f8fafc;
    border-color: #9ca3af;
}

.ai-chat-panel .suggestion-btn i {
    font-size: 16px;
    color: #6b7280;
}

/* Message Styles */
.ai-chat-panel .message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.ai-chat-panel .user-message {
    flex-direction: row-reverse;
}

.ai-chat-panel .message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.ai-chat-panel .user-message .message-avatar {
    background: #3b82f6;
    color: white;
}

.ai-chat-panel .ai-message .message-avatar {
    background: #f3f4f6;
    color: #6b7280;
}

.ai-chat-panel .message-content {
    flex: 1;
    max-width: 280px;
}

.ai-chat-panel .message-text {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.ai-chat-panel .user-message .message-text {
    background: #3b82f6;
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-chat-panel .ai-message .message-text {
    background: #f9fafb;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.ai-chat-panel .message-time {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 6px;
    font-weight: 500;
}

.ai-chat-panel .user-message .message-time {
    text-align: right;
}

.ai-chat-panel .ai-message .message-time {
    text-align: left;
}

/* Typing Indicator */
.ai-chat-panel .typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 12px;
    width: fit-content;
    border: 1px solid #e5e7eb;
}

.ai-chat-panel .typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s infinite ease-in-out;
}

.ai-chat-panel .typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.ai-chat-panel .typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input Area */
.ai-chat-panel .chat-input-area {
    border-top: 1px solid #e5e7eb;
    padding: 20px;
    background: #ffffff;
}

.ai-chat-panel .chat-input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.ai-chat-panel .chat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: border-color 0.2s ease;
    font-family: inherit;
    background: #ffffff;
}

.ai-chat-panel .chat-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ai-chat-panel .chat-input:disabled {
    background-color: #f9fafb;
    cursor: not-allowed;
    opacity: 0.7;
}

.ai-chat-panel .send-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: none;
    background: #3b82f6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
    font-size: 16px;
}

.ai-chat-panel .send-btn:hover:not(:disabled) {
    background: #2563eb;
}

.ai-chat-panel .send-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.ai-chat-panel .send-btn.loading {
    background: #9ca3af;
}

.ai-chat-panel .spin {
    animation: spin 1s linear infinite;
}

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

/* Chat Actions */
.ai-chat-panel .chat-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.ai-chat-panel .action-btn {
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #6b7280;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 60px;
    justify-content: center;
}

.ai-chat-panel .action-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.ai-chat-panel .action-text {
    font-size: 12px;
    font-weight: 500;
}

/* === Responsive Design for Chat Panel === */
@media (max-width: 768px) {
    .main-content.chat-expanded {
        margin-right: 0; /* Don't adjust main content on mobile */
    }

    .ai-chat-panel {
        width: 100vw !important;
        right: 0 !important;
    }

    .ai-chat-panel.collapsed {
        transform: translateX(calc(100vw - 40px)) !important;
    }

    .ai-chat-panel .action-text {
        display: none;
    }

    .ai-chat-panel .action-btn {
        min-width: 44px;
        padding: 8px;
    }
}

/* Ensure content wrapper doesn't overflow */
.content-wrapper {
    max-width: 100%;
    overflow-x: hidden;
}

/* === FORCE LAYOUT TO WORK === */
/* Override any conflicting styles */
.admin-layout {
    display: flex !important;
    min-height: 100vh !important;
}

.main-content {
    flex: 1 !important;
    margin-left: var(--sidebar-width) !important;
    margin-top: var(--navbar-height) !important;
    margin-right: 0 !important;
    transition: margin-right 0.3s ease !important;
    min-width: 0 !important;
    position: relative !important;
    z-index: 1 !important;
}

.main-content.chat-expanded {
    margin-right: 400px !important;
}


/* Ensure no other elements interfere */
* {
    box-sizing: border-box !important;
}

/* Force the layout to respect our rules */
body, html {
    overflow-x: hidden !important;
}

/* AI Chat Panel */
.ai-chat-panel {
    position: fixed !important;
    top: 60px !important;
    right: 0 !important;
    width: 400px !important;
    height: calc(100vh - 60px) !important;
    z-index: 9999 !important;
    background: #ffffff !important;
    border-left: 1px solid #e5e7eb !important;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1) !important;
    display: flex !important;
    flex-direction: column !important;
    transition: all 0.3s ease !important;
}

.ai-chat-panel.expanded {
    right: 0 !important;
    display: flex !important;
}

.ai-chat-panel.collapsed {
    display: none !important;
}

.main-content {
    margin-right: 0 !important;
    transition: margin-right 0.3s ease !important;
}

.main-content.chat-expanded {
    margin-right: 400px !important;
}

/* Chat status indicator */
.chat-status {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 12px !important;
    color: #6b7280 !important;
}

.status-dot {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    background: #10b981 !important;
}

/* Navigation Chat Toggle Button */
.chat-toggle-nav {
    background: #3b82f6 !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    margin-right: 12px !important;
    transition: all 0.2s ease !important;
    position: relative !important;
}

.chat-toggle-nav:hover {
    background: #2563eb !important;
    transform: scale(1.05) !important;
}

.chat-toggle-nav .bi-robot {
    font-size: 18px !important;
}

.chat-indicator {
    position: absolute !important;
    top: -2px !important;
    right: -2px !important;
    width: 8px !important;
    height: 8px !important;
    background: #ef4444 !important;
    border-radius: 50% !important;
    border: 2px solid white !important;
}

.user-avatar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.user-picture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bi-person-circle {
    display: block;
    visibility: hidden;
}
