/* MednBot Enterprise Portal — Light Theme System
   Apple/AWS/Stripe-inspired professional light theme
   Overrides --admin-* variables for light mode while preserving all component styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --admin-bg: #F5F7FA;
    --admin-surface: #FFFFFF;
    --admin-surface-alt: #F0F2F5;
    --admin-primary: #4F46E5;
    --admin-primary-hover: #4338CA;
    --admin-success: #059669;
    --admin-warning: #D97706;
    --admin-danger: #DC2626;
    --admin-info: #2563EB;
    --admin-accent: #4F46E5;

    --admin-text-primary: #111827;
    --admin-text-secondary: #374151;
    --admin-text-muted: #6B7280;

    --admin-border: #E5E7EB;
    --admin-border-light: #F3F4F6;
    --admin-hover: rgba(79, 70, 229, 0.06);

    --admin-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --admin-shadow-lg: 0 4px 12px -1px rgba(0, 0, 0, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
    --admin-glow: 0 0 0 3px rgba(79, 70, 229, 0.12);

    --admin-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --admin-transition-fast: all 0.15s ease;

    --admin-radius: 10px;
    --admin-radius-sm: 6px;
    --admin-radius-lg: 14px;

    --sidebar-width: 256px;
    --sidebar-collapsed-width: 68px;
    --topbar-height: 56px;
    --sidebar-bg: #FFFFFF;
    --sidebar-border: #E5E7EB;
    --sidebar-hover: #F5F7FA;
    --sidebar-active-bg: rgba(79, 70, 229, 0.08);
    --sidebar-active-text: #4F46E5;
    --sidebar-section-text: #9CA3AF;
}

[data-portal="admin"] {
    --admin-primary: #4F46E5;
    --admin-primary-hover: #4338CA;
    --admin-accent: #4F46E5;
    --sidebar-active-bg: rgba(79, 70, 229, 0.08);
    --sidebar-active-text: #4F46E5;
}

[data-portal="customer"] {
    --admin-primary: #0D9488;
    --admin-primary-hover: #0F766E;
    --admin-accent: #0D9488;
    --sidebar-active-bg: rgba(13, 148, 136, 0.08);
    --sidebar-active-text: #0D9488;
}

[data-portal="doctor"] {
    --admin-primary: #2563EB;
    --admin-primary-hover: #1D4ED8;
    --admin-accent: #2563EB;
    --sidebar-active-bg: rgba(37, 99, 235, 0.08);
    --sidebar-active-text: #2563EB;
}

.portal-light {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--admin-bg);
    color: var(--admin-text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   SIDEBAR LAYOUT SYSTEM
   ============================================ */
.portal-layout {
    display: flex;
    min-height: 100vh;
}

.portal-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.portal-sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.portal-sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    min-height: 56px;
    flex-shrink: 0;
    position: relative;
}

.portal-sidebar-header .sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.portal-sidebar-header .sidebar-user-text {
    overflow: hidden;
    min-width: 0;
}

.collapsed .portal-sidebar-header .sidebar-user-text {
    display: none;
}

.sidebar-toggle {
    position: absolute;
    right: -12px;
    top: 28px;
    width: 24px;
    height: 24px;
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--admin-text-muted);
    font-size: 0.625rem;
    transition: var(--admin-transition);
    z-index: 10;
    box-shadow: var(--admin-shadow);
}

.sidebar-toggle:hover {
    background: var(--admin-primary);
    color: white;
    border-color: var(--admin-primary);
}

.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

.sidebar-notification-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--admin-text-muted);
    font-size: 1.1rem;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    flex-shrink: 0;
    background: var(--sidebar-hover);
}

.sidebar-notification-btn:hover {
    color: var(--admin-primary);
    background: rgba(99, 102, 241, 0.15);
    transform: scale(1.1);
}

.sidebar-notification-btn.has-notifications {
    color: #f59e0b;
    animation: bell-pulse 2s ease-in-out infinite;
}

@keyframes bell-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.sidebar-notification-badge {
    position: absolute;
    top: -2px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--admin-danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--sidebar-bg);
    line-height: 1;
}

.collapsed .sidebar-notification-btn {
    display: none;
}

.portal-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--admin-border) transparent;
}

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

.portal-sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.portal-sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--admin-border);
    border-radius: 2px;
}

.sidebar-section {
    margin-bottom: 4px;
}

.sidebar-section-label {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--sidebar-section-text);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 20px 20px 6px 20px;
    white-space: nowrap;
    overflow: hidden;
}

.collapsed .sidebar-section-label {
    text-align: center;
    padding: 16px 8px 6px 8px;
    font-size: 0;
}

.collapsed .sidebar-section-label::after {
    content: '\2022';
    font-size: 0.75rem;
    color: var(--sidebar-section-text);
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    color: var(--admin-text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: var(--admin-transition-fast);
    white-space: nowrap;
    border-left: 3px solid transparent;
    margin: 1px 0;
    cursor: pointer;
    line-height: 1.4;
}

.sidebar-nav-item i {
    width: 18px;
    text-align: center;
    font-size: 0.875rem;
    flex-shrink: 0;
    color: var(--admin-text-muted);
    transition: var(--admin-transition-fast);
}

.sidebar-nav-item span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--admin-text-primary);
    text-decoration: none;
}

.sidebar-nav-item:hover i {
    color: var(--admin-primary);
}

.sidebar-nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-left-color: var(--sidebar-active-text);
    font-weight: 600;
}

.sidebar-nav-item.active i {
    color: var(--sidebar-active-text);
}

.collapsed .sidebar-nav-item {
    padding: 10px 0;
    justify-content: center;
    border-left: none;
}

.collapsed .sidebar-nav-item span {
    display: none;
}

.collapsed .sidebar-nav-item i {
    width: auto;
    font-size: 1rem;
}

.sidebar-submenu {
    display: none;
    padding-left: 0;
}

.sidebar-submenu.show {
    display: block;
}

.sidebar-submenu .sidebar-nav-item {
    padding-left: 48px;
    font-size: 0.8125rem;
    font-weight: 400;
    border-left: none;
}

.sidebar-submenu .sidebar-nav-item.active {
    font-weight: 600;
    border-left: none;
    background: var(--sidebar-active-bg);
}

.sidebar-nav-item .submenu-arrow {
    margin-left: auto;
    font-size: 0.625rem;
    transition: transform 0.2s ease;
    color: var(--admin-text-muted);
}

.sidebar-nav-item[aria-expanded="true"] .submenu-arrow {
    transform: rotate(90deg);
}

.portal-sidebar-footer {
    border-top: 1px solid var(--sidebar-border);
    padding: 12px 16px;
    flex-shrink: 0;
    display: none;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--admin-radius-sm);
    transition: var(--admin-transition-fast);
    cursor: pointer;
    text-decoration: none;
    color: var(--admin-text-primary);
}

.sidebar-user-info:hover {
    background: var(--sidebar-hover);
    text-decoration: none;
    color: var(--admin-text-primary);
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--admin-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8125rem;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.6875rem;
    color: var(--admin-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collapsed .sidebar-user-name,
.collapsed .sidebar-user-role {
    display: none;
}

/* ============================================
   TOP BAR
   ============================================ */
.portal-topbar {
    height: var(--topbar-height);
    background: var(--admin-surface);
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 1030;
    gap: 16px;
    max-width: 1400px;
    width: 100%;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

.topbar-brand-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    flex-shrink: 0;
}

.topbar-brand-link:hover {
    text-decoration: none;
}

.topbar-brand-icon {
    font-size: 1.25rem;
    color: var(--admin-primary);
    transition: var(--admin-transition-fast);
}

.topbar-brand-link:hover .topbar-brand-icon {
    color: var(--admin-primary-hover);
    transform: scale(1.05);
}

.topbar-brand-text {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--admin-text-primary);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.topbar-brand-link:hover .topbar-brand-text {
    color: var(--admin-primary);
}

.topbar-center {
    /* Center the logo against the topbar's box (not its content-box),
       so the logo's horizontal center matches the page's content
       column center. The previous `left:0; right:0; flex-center`
       approach computed the center after subtracting the topbar's
       horizontal padding, which made the logo appear pushed right
       on wide viewports (the empty-state copy below it is centered
       inside .portal-content's full width, not after padding). */
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    pointer-events: none;
}

.topbar-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.portal-topbar:hover .topbar-logo {
    opacity: 0.85;
}

.topbar-mobile-toggle {
    display: none;
    background: none;
    border: none;
    padding: 6px;
    color: var(--admin-text-secondary);
    cursor: pointer;
    font-size: 1.125rem;
    border-radius: var(--admin-radius-sm);
}

.topbar-mobile-toggle:hover {
    background: var(--sidebar-hover);
    color: var(--admin-text-primary);
}

.topbar-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: var(--admin-text-muted);
}

.topbar-breadcrumbs a {
    color: var(--admin-text-muted);
    text-decoration: none;
    transition: var(--admin-transition-fast);
}

.topbar-breadcrumbs a:hover {
    color: var(--admin-primary);
}

.topbar-breadcrumbs .breadcrumb-sep {
    font-size: 0.625rem;
    color: var(--admin-border);
}

.topbar-breadcrumbs .breadcrumb-current {
    color: var(--admin-text-primary);
    font-weight: 500;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 1;
    min-width: 0;
    margin-left: auto;
}

.topbar-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--admin-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--admin-text-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: var(--admin-transition-fast);
    position: relative;
    text-decoration: none;
}

.topbar-icon-btn:hover {
    background: var(--sidebar-hover);
    color: var(--admin-text-primary);
}

.topbar-icon-btn .notification-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--admin-danger);
    border-radius: 50%;
    border: 2px solid var(--admin-surface);
}

.topbar-version {
    font-size: 0.6875rem;
    color: var(--admin-text-muted);
    background: var(--admin-surface-alt);
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
    white-space: nowrap;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.portal-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.sidebar-collapsed-active .portal-main {
    margin-left: var(--sidebar-collapsed-width);
}

.portal-content {
    flex: 1;
    padding: 28px 32px;
    max-width: 1400px;
    width: 100%;
}

.enterprise-container {
    padding: 0;
    max-width: none;
    margin: 0;
}

/* ============================================
   PAGE HEADER PATTERN
   ============================================ */
.page-header-enterprise {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title-enterprise {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--admin-text-primary);
    margin-bottom: 4px;
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    background-clip: unset;
}

.page-subtitle-enterprise {
    color: var(--admin-text-muted);
    font-size: 0.875rem;
    margin: 0;
    font-weight: 400;
}

/* ============================================
   ENTERPRISE CARDS — Light Theme
   ============================================ */
.enterprise-card {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    transition: var(--admin-transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--admin-shadow);
}

.enterprise-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--admin-primary), var(--admin-info));
    opacity: 0;
    transition: var(--admin-transition);
}

.enterprise-card:hover {
    border-color: var(--admin-border);
    box-shadow: var(--admin-shadow-lg);
    transform: translateY(-1px);
}

.enterprise-card:hover::before {
    opacity: 1;
}

.enterprise-card .card-header {
    background: var(--admin-surface-alt);
    border-bottom: 1px solid var(--admin-border);
    padding: 16px 20px;
    font-weight: 600;
}

.enterprise-card .card-header h5 {
    color: var(--admin-text-primary);
}

.enterprise-card .card-body {
    padding: 20px;
}

/* ============================================
   STAT CARDS
   ============================================ */
.stats-enterprise {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card-enterprise {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    padding: 20px;
    transition: var(--admin-transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--admin-shadow);
}

.stat-card-enterprise::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient, linear-gradient(90deg, var(--admin-primary), var(--admin-info)));
    transition: var(--admin-transition);
}

.stat-card-enterprise:hover {
    transform: translateY(-2px);
    box-shadow: var(--admin-shadow-lg);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--admin-text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--admin-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    margin-left: auto;
}

/* ============================================
   TABLES
   ============================================ */
.table-enterprise {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    overflow: hidden;
    box-shadow: var(--admin-shadow);
}

.table-enterprise table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
}

.table-enterprise th {
    background: var(--admin-surface-alt);
    color: var(--admin-text-muted);
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 1px solid var(--admin-border);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
}

.table-enterprise td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--admin-border-light);
    vertical-align: middle;
    color: var(--admin-text-primary);
    font-size: 0.875rem;
}

.table-enterprise tbody tr {
    transition: var(--admin-transition-fast);
}

.table-enterprise tbody tr:hover {
    background: var(--admin-hover);
}

.table-enterprise tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-enterprise {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--admin-radius-sm);
    transition: var(--admin-transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.8125rem;
}

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

.btn-enterprise-primary:hover {
    background: var(--admin-primary-hover);
    border-color: var(--admin-primary-hover);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--admin-shadow-lg);
}

.btn-enterprise-secondary {
    background: var(--admin-surface);
    color: var(--admin-text-primary);
    border-color: var(--admin-border);
}

.btn-enterprise-secondary:hover {
    background: var(--admin-surface-alt);
    border-color: var(--admin-primary);
    color: var(--admin-primary);
}

.btn-enterprise-success {
    background: var(--admin-success);
    color: white;
    border-color: var(--admin-success);
}

.btn-enterprise-success:hover {
    background: #047857;
    border-color: #047857;
    color: white;
}

.btn-enterprise-danger {
    background: var(--admin-danger);
    color: white;
    border-color: var(--admin-danger);
}

.btn-enterprise-danger:hover {
    background: #B91C1C;
    border-color: #B91C1C;
    color: white;
}

.btn-action {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    color: var(--admin-text-muted);
    padding: 6px;
    border-radius: var(--admin-radius-sm);
    transition: var(--admin-transition-fast);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
}

.btn-action:hover {
    background: var(--admin-hover);
    color: var(--admin-primary);
    border-color: var(--admin-primary);
}

/* ============================================
   BADGES
   ============================================ */
.badge-enterprise {
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-enterprise-success {
    background: rgba(5, 150, 105, 0.1);
    color: var(--admin-success);
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.badge-enterprise-warning {
    background: rgba(217, 119, 6, 0.1);
    color: var(--admin-warning);
    border: 1px solid rgba(217, 119, 6, 0.2);
}

.badge-enterprise-danger {
    background: rgba(220, 38, 38, 0.1);
    color: var(--admin-danger);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.badge-enterprise-info {
    background: rgba(37, 99, 235, 0.1);
    color: var(--admin-info);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.badge-enterprise-primary {
    background: rgba(79, 70, 229, 0.1);
    color: var(--admin-primary);
    border: 1px solid rgba(79, 70, 229, 0.2);
}

/* ============================================
   FORM CONTROLS
   ============================================ */
.form-control-enterprise {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    color: var(--admin-text-primary);
    border-radius: var(--admin-radius-sm);
    padding: 8px 12px;
    transition: var(--admin-transition);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
}

.form-control-enterprise:focus {
    background: var(--admin-surface);
    border-color: var(--admin-primary);
    box-shadow: var(--admin-glow);
    color: var(--admin-text-primary);
    outline: none;
}

.form-control-enterprise::placeholder {
    color: var(--admin-text-muted);
}

/* ============================================
   NOTIFICATIONS
   ============================================ */
.notification-indicator {
    position: relative;
}

.notification-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--admin-danger);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 9999px;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--admin-surface);
}

/* ============================================
   HEALTH INDICATORS (for admin topbar)
   ============================================ */
.health-indicators {
    display: flex;
    gap: 4px;
    align-items: center;
    overflow: hidden;
    flex-shrink: 1;
    min-width: 0;
}

.health-indicator {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: var(--admin-transition);
    cursor: pointer;
}

.health-indicator.online {
    background: rgba(5, 150, 105, 0.1);
    color: var(--admin-success);
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.health-indicator.warning {
    background: rgba(217, 119, 6, 0.1);
    color: var(--admin-warning);
    border: 1px solid rgba(217, 119, 6, 0.2);
}

.health-indicator.error {
    background: rgba(220, 38, 38, 0.1);
    color: var(--admin-danger);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.health-indicator.unknown {
    background: rgba(107, 114, 128, 0.1);
    color: var(--admin-text-muted);
    border: 1px solid rgba(107, 114, 128, 0.2);
}

.health-indicator.checking {
    background: rgba(37, 99, 235, 0.1);
    color: var(--admin-info);
    border: 1px solid rgba(37, 99, 235, 0.2);
    animation: health-checking 1.5s ease-in-out infinite;
}

@keyframes health-checking {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.health-indicator:hover {
    transform: scale(1.15);
}

.health-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background: var(--admin-text-primary);
    color: white;
    padding: 4px 10px;
    border-radius: var(--admin-radius-sm);
    font-size: 0.6875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: var(--admin-transition);
    z-index: 1050;
    margin-top: 4px;
}

.health-indicator:hover .health-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(10px);
}

/* ============================================
   HEALTH INDICATOR ITEMS (Superuser Dashboard)
   ============================================ */
.compact-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(107, 114, 128, 0.3);
    flex-shrink: 0;
    transition: background 0.3s ease;
}

.compact-status-dot.status-online {
    background: #059669;
    box-shadow: 0 0 4px rgba(5, 150, 105, 0.4);
}

.compact-status-dot.status-warning {
    background: #d97706;
    box-shadow: 0 0 4px rgba(217, 119, 6, 0.4);
}

.compact-status-dot.status-error {
    background: #dc2626;
    box-shadow: 0 0 4px rgba(220, 38, 38, 0.4);
}

.compact-status-dot.status-unknown {
    background: rgba(107, 114, 128, 0.3);
}

.health-indicator-item {
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.health-indicator-item:hover {
    background: rgba(99, 102, 241, 0.04);
}

.health-indicator-item:focus {
    outline: none;
}

/* ============================================
   IMPERSONATION BANNER
   ============================================ */
.impersonation-banner {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: white;
    padding: 8px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1050;
}

.impersonation-banner .btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.4);
    color: white;
    padding: 4px 12px;
    border-radius: var(--admin-radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--admin-transition-fast);
}

.impersonation-banner .btn:hover {
    background: rgba(255,255,255,0.35);
}

/* ============================================
   DROPDOWN MENUS (Bootstrap Override)
   ============================================ */
.dropdown-menu {
    background: var(--admin-surface) !important;
    border: 1px solid var(--admin-border) !important;
    border-radius: var(--admin-radius) !important;
    box-shadow: var(--admin-shadow-lg) !important;
    padding: 6px !important;
    list-style: none !important;
}

.dropdown-item {
    color: var(--admin-text-secondary) !important;
    padding: 8px 14px !important;
    border-radius: var(--admin-radius-sm) !important;
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
    transition: var(--admin-transition-fast) !important;
}

.dropdown-item:hover {
    background: var(--admin-hover) !important;
    color: var(--admin-primary) !important;
}

.dropdown-item.active,
.dropdown-item:active {
    background: var(--sidebar-active-bg) !important;
    color: var(--sidebar-active-text) !important;
}

.dropdown-item i {
    width: 18px;
    text-align: center;
}

.dropdown-header {
    color: var(--admin-text-muted) !important;
    font-size: 0.6875rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    padding: 10px 14px 4px 14px !important;
}

.dropdown-divider {
    border-color: var(--admin-border) !important;
    margin: 4px 8px !important;
}

.dropdown-menu-wide {
    min-width: 260px;
}

/* ============================================
   FLASH MESSAGES
   ============================================ */
.alert {
    border-radius: var(--admin-radius);
    border: 1px solid;
    font-size: 0.875rem;
}

/* ============================================
   SCROLLBAR (Light)
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--admin-border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--admin-text-muted);
}

/* ============================================
   LOADING STATES
   ============================================ */
.loading-skeleton {
    background: linear-gradient(90deg, var(--admin-surface-alt) 25%, var(--admin-border-light) 50%, var(--admin-surface-alt) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

/* ============================================
   TICKET SYSTEM (adapts via variables)
   ============================================ */
.ticket-number {
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 0.8125rem;
    color: var(--admin-primary);
    font-weight: 600;
    background: rgba(79, 70, 229, 0.06);
    padding: 2px 8px;
    border-radius: var(--admin-radius-sm);
    border: 1px solid rgba(79, 70, 229, 0.12);
}

.ticket-subject a {
    color: var(--admin-text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--admin-transition-fast);
}

.ticket-subject a:hover {
    color: var(--admin-primary);
}

.status-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-open { background: rgba(5, 150, 105, 0.08); color: #059669; border: 1px solid rgba(5, 150, 105, 0.2); }
.status-in_progress { background: rgba(37, 99, 235, 0.08); color: #2563EB; border: 1px solid rgba(37, 99, 235, 0.2); }
.status-pending_customer { background: rgba(217, 119, 6, 0.08); color: #D97706; border: 1px solid rgba(217, 119, 6, 0.2); }
.status-pending_internal { background: rgba(139, 92, 246, 0.08); color: #8B5CF6; border: 1px solid rgba(139, 92, 246, 0.2); }
.status-resolved { background: rgba(16, 185, 129, 0.08); color: #10B981; border: 1px solid rgba(16, 185, 129, 0.2); }
.status-closed { background: rgba(107, 114, 128, 0.08); color: #6B7280; border: 1px solid rgba(107, 114, 128, 0.2); }
.status-escalated { background: rgba(220, 38, 38, 0.08); color: #DC2626; border: 1px solid rgba(220, 38, 38, 0.2); }

.priority-badge { padding: 3px 10px; border-radius: 20px; font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.priority-low { background: rgba(5, 150, 105, 0.08); color: #059669; border: 1px solid rgba(5, 150, 105, 0.2); }
.priority-medium { background: rgba(217, 119, 6, 0.08); color: #D97706; border: 1px solid rgba(217, 119, 6, 0.2); }
.priority-high { background: rgba(234, 88, 12, 0.08); color: #EA580C; border: 1px solid rgba(234, 88, 12, 0.2); }
.priority-urgent { background: rgba(220, 38, 38, 0.08); color: #DC2626; border: 1px solid rgba(220, 38, 38, 0.2); }
.priority-critical { background: rgba(185, 28, 28, 0.08); color: #B91C1C; border: 1px solid rgba(185, 28, 28, 0.2); animation: pulse-critical 2s infinite; }

@keyframes pulse-critical {
    0%, 100% { box-shadow: 0 0 0 0 rgba(185, 28, 28, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(185, 28, 28, 0); }
}

.category-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.6875rem;
    font-weight: 500;
    background: var(--admin-surface-alt);
    color: var(--admin-text-muted);
    border: 1px solid var(--admin-border);
}

.customer-info, .doctor-info, .external-info { display: flex; align-items: center; font-size: 0.8125rem; color: var(--admin-text-secondary); }
.customer-info i { color: var(--admin-primary); }
.doctor-info i { color: var(--admin-success); }
.external-info i { color: var(--admin-warning); }

.assigned-user { display: flex; align-items: center; font-size: 0.8125rem; color: var(--admin-text-secondary); }
.assigned-user i { color: var(--admin-success); }

.age-badge {
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 0.6875rem;
    background: var(--admin-surface-alt);
    color: var(--admin-text-muted);
    padding: 2px 6px;
    border-radius: var(--admin-radius-sm);
    border: 1px solid var(--admin-border);
}

.last-activity {
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 0.6875rem;
    color: var(--admin-text-muted);
}

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

.empty-state { text-align: center; padding: 48px 16px; }
.empty-state i { opacity: 0.3; }
.empty-state h4 { color: var(--admin-text-primary); margin-bottom: 8px; }
.empty-state p { color: var(--admin-text-muted); margin-bottom: 20px; }

.ticket-checkbox, #selectAll { width: 16px; height: 16px; accent-color: var(--admin-primary); cursor: pointer; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.fade-in-up { animation: fadeInUp 0.4s ease forwards; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .portal-sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }
    .portal-sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.1);
    }
    .portal-main {
        margin-left: 0 !important;
    }
    .topbar-mobile-toggle {
        display: flex;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.3);
        z-index: 1035;
    }
    .sidebar-overlay.active {
        display: block;
    }
}

@media (max-width: 768px) {
    .portal-content {
        padding: 16px;
    }
    .topbar-brand-text {
        display: none;
    }
    .stats-enterprise {
        grid-template-columns: 1fr;
    }
    .page-title-enterprise {
        font-size: 1.25rem;
    }
    .stat-value {
        font-size: 1.75rem;
    }
    .action-buttons {
        flex-direction: column;
        gap: 2px;
    }
    .btn-action {
        width: 100%;
        justify-content: flex-start;
        padding: 6px 10px;
    }
    .status-badge, .priority-badge, .category-badge {
        font-size: 0.625rem;
        padding: 2px 6px;
    }
}

/* ============================================
   BACKWARD COMPAT — keep .admin-enterprise working
   ============================================ */
.admin-enterprise {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--admin-bg);
    color: var(--admin-text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Old navbar still works during migration */
.enterprise-navbar {
    background: var(--admin-surface);
    border-bottom: 1px solid var(--admin-border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--admin-shadow);
}

.enterprise-navbar .navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--admin-text-primary);
    text-decoration: none;
}

.enterprise-navbar .navbar-brand:hover {
    color: var(--admin-primary);
}

.enterprise-navbar .navbar-brand img {
    height: 44px;
    width: auto;
    object-fit: contain;
}

.enterprise-navbar .navbar-nav { flex-wrap: nowrap; }

.enterprise-navbar .nav-link {
    color: var(--admin-text-secondary);
    font-weight: 500;
    padding: 0.5rem 0.65rem;
    border-radius: var(--admin-radius-sm);
    transition: var(--admin-transition-fast);
    position: relative;
    white-space: nowrap;
    font-size: 0.8125rem;
}

.enterprise-navbar .nav-link:hover,
.enterprise-navbar .nav-link.active {
    color: var(--admin-primary);
    background: var(--admin-hover);
}

.enterprise-navbar .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--admin-primary);
    border-radius: 50%;
}

/* ============================================
   QUICK ACTION BAR
   ============================================ */
.quick-action-bar {
    background: linear-gradient(135deg, var(--admin-primary) 0%, var(--admin-primary-hover) 100%);
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.quick-action-bar .btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.quick-action-bar .btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

/* ============================================
   AGENT COMMAND CENTER
   ============================================ */
.agent-command-center {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.agent-card {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(79, 70, 229, 0.05) 100%);
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    position: relative;
}

.agent-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.15);
    border-color: var(--admin-primary);
}
