/* components.css - Ultra-Premium UI Components */

/* Cards & Glassmorphism */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
    position: relative;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-glass);
}

.card-interactive:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--brand-glow);
}

/* Stat Cards */
.stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    overflow: hidden;
    position: relative;
}

.stat-card::after {
    content: '';
    position: absolute;
    right: -20px;
    bottom: -20px;
    width: 90px;
    height: 90px;
    background: var(--stat-glow, rgba(59, 130, 246, 0.08));
    border-radius: 50%;
    filter: blur(20px);
    pointer-events: none;
}

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--stat-bg, rgba(59, 130, 246, 0.1));
    color: var(--stat-color, var(--brand-primary));
    flex-shrink: 0;
    transition: transform var(--transition-normal);
}

.stat-card:hover .stat-icon-wrapper {
    transform: scale(1.1) rotate(4deg);
}

/* Buttons */
.btn {
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    font-family: inherit;
    text-decoration: none;
    user-select: none;
    white-space: nowrap;
}

.btn:active:not(:disabled) {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: var(--brand-gradient);
    color: #ffffff;
    box-shadow: var(--shadow-sm), var(--shadow-glow-brand);
}

.btn-primary:hover:not(:disabled) {
    background: var(--brand-gradient-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md), var(--shadow-glow-brand);
}

.btn-success {
    background: var(--success-gradient);
    color: #ffffff;
    box-shadow: var(--shadow-sm), var(--shadow-glow-success);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md), var(--shadow-glow-success);
}

.btn-danger {
    background: var(--danger-gradient);
    color: #ffffff;
    box-shadow: var(--shadow-sm), var(--shadow-glow-danger);
}

.btn-outline {
    background: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
    background: var(--bg-muted);
    border-color: var(--text-muted);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: var(--radius-xs);
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    border-radius: var(--radius);
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 50%;
    width: 38px;
    height: 38px;
}

/* Sidebar & Navigation */
#sidebar-container {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    z-index: 100;
    transition: transform var(--transition-smooth);
    flex-shrink: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar {
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    margin-bottom: 0.2rem;
    position: relative;
}

.nav-item:hover {
    background-color: var(--bg-muted);
    color: var(--text-primary);
    transform: translateX(3px);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--brand-primary);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: var(--brand-primary);
    border-radius: 0 4px 4px 0;
}

.nav-item i { 
    width: 18px; 
    height: 18px; 
    transition: transform var(--transition-fast); 
    flex-shrink: 0;
}

.nav-item:hover i { 
    transform: scale(1.15); 
}

/* Badges & Status Indicators */
.badge {
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.725rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    text-transform: uppercase;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
    animation: pulseGlow 2s infinite ease-in-out;
}

.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.badge-info { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-border); }
.badge-brand { background: rgba(59, 130, 246, 0.1); color: var(--brand-primary); border: 1px solid rgba(59, 130, 246, 0.2); }

/* Advanced Data Grid Toolbar & Table */
.data-grid-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius) var(--radius);
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    background: var(--bg-surface);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

td {
    padding: 1.1rem 1.25rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9rem;
}

tbody tr { 
    transition: background-color var(--transition-fast), transform var(--transition-fast); 
}

tbody tr:hover { 
    background-color: var(--bg-muted); 
}

.checkbox-cell {
    width: 44px;
    text-align: center;
    vertical-align: middle !important;
}

.custom-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--brand-primary);
    border-radius: 4px;
}

.selected-count {
    font-size: 0.8rem;
    color: var(--brand-primary);
    font-weight: 700;
    background: rgba(59, 130, 246, 0.12);
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
}

/* Command Palette Overlay */
.cmd-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-primary);
}

.cmd-item:hover, .cmd-item.selected {
    background: rgba(59, 130, 246, 0.08);
    color: var(--brand-primary);
    transform: translateX(4px);
}

.cmd-item i { 
    color: var(--text-secondary); 
    width: 20px; 
    height: 20px;
}

.cmd-item:hover i {
    color: var(--brand-primary);
}

/* Global Floating Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
    max-width: 420px;
    width: calc(100vw - 4rem);
}

.toast {
    pointer-events: auto;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    color: var(--text-primary);
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.3s ease;
    backdrop-filter: blur(16px);
    position: relative;
    overflow: hidden;
}

.toast.toast-hiding {
    opacity: 0;
    transform: translateX(100%) scale(0.9);
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--toast-color, var(--brand-primary));
}

.toast-icon {
    width: 20px;
    height: 20px;
    color: var(--toast-color, var(--brand-primary));
    flex-shrink: 0;
    margin-top: 2px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.825rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    transition: color var(--transition-fast);
}

.toast-close:hover {
    color: var(--text-primary);
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(100%) translateY(20px); }
    to { opacity: 1; transform: translateX(0) translateY(0); }
}

/* Modal and Dialog System */
.app-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    padding: 1rem;
}

.app-dialog-overlay.active {
    opacity: 1;
    visibility: visible;
}

.app-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-xl);
    transform: translateY(20px) scale(0.95);
    transition: transform var(--transition-normal);
}

.app-dialog-overlay.active .app-dialog {
    transform: translateY(0) scale(1);
}

.app-dialog-header {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.app-dialog-message {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.app-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Library ID Card Preview Styling */
.id-card-preview {
    width: 340px;
    height: 215px;
    border-radius: 12px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #fff;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.15);
}

.id-card-preview::before {
    content: '';
    position: absolute;
    right: -40px;
    top: -40px;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(59,130,246,0.3) 0%, transparent 70%);
    pointer-events: none;
}

/* Mobile Toast Positioning */
@media (max-width: 768px) {
    #toast-container {
        bottom: calc(var(--mobile-nav-height) + 1rem);
        right: 1rem;
        left: 1rem;
        width: auto;
    }
}

/* Mobile Responsive Table Containment */
@media (max-width: 768px) {
    .table-responsive, .table-container {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        display: block !important;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        margin-bottom: 1rem;
        box-sizing: border-box;
    }

    .table-responsive table, .table-container table {
        min-width: 520px;
        width: 100%;
    }

    .data-grid-toolbar {
        padding: 0.75rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .table-footer {
        padding: 0.75rem;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
}

/* ==========================================================================
   NOTIFICATION DRAWER & NOTIFICATION CENTER
   ========================================================================== */
.notification-drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.notification-drawer-backdrop.active {
    display: block;
    opacity: 1;
}

.notification-drawer {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 92vw;
    height: 100vh;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.25);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transition: right var(--transition-normal) cubic-bezier(0.16, 1, 0.3, 1);
}

.notification-drawer.active {
    right: 0;
}

.notification-item {
    display: flex;
    gap: 0.85rem;
    padding: 0.95rem 1.15rem;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
    cursor: pointer;
    position: relative;
}

.notification-item:hover {
    background: var(--bg-hover);
}

.notification-item.unread {
    background: rgba(59, 130, 246, 0.04);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--brand-primary);
}

/* ==========================================================================
   PREMIUM ADMIN MESSENGER & HELPDESK
   ========================================================================== */
.floating-messenger-btn {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--brand-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px var(--brand-glow), 0 4px 12px rgba(0,0,0,0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    z-index: 950;
    transition: transform var(--transition-bounce), box-shadow var(--transition-normal);
}

.floating-messenger-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 28px var(--brand-glow), 0 6px 16px rgba(0,0,0,0.3);
}

.messenger-window {
    position: fixed;
    bottom: 5.5rem;
    right: 1.5rem;
    width: 380px;
    max-width: 92vw;
    height: 540px;
    max-height: 80vh;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 950;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.96);
    opacity: 0;
    transition: all var(--transition-bounce);
}

.messenger-window.active {
    display: flex;
    transform: translateY(0) scale(1);
    opacity: 1;
}

.chat-bubble-incoming {
    align-self: flex-start;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 14px 14px 14px 2px;
    padding: 0.65rem 0.95rem;
    max-width: 82%;
    font-size: 0.86rem;
    line-height: 1.4;
    box-shadow: var(--shadow-xs);
}

.chat-bubble-outgoing {
    align-self: flex-end;
    background: var(--brand-gradient);
    color: white;
    border-radius: 14px 14px 2px 14px;
    padding: 0.65rem 0.95rem;
    max-width: 82%;
    font-size: 0.86rem;
    line-height: 1.4;
    box-shadow: 0 2px 8px var(--brand-glow);
}

.typing-dot {
    width: 5px;
    height: 5px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   ULTRA-PREMIUM TOPBAR & CONTROLS DESIGN SYSTEM
   ========================================================================== */
.app-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    background: var(--bg-glass-strong);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 80;
    height: var(--topbar-height);
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
    overflow: visible;
}

.topbar-nav-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.topbar-btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    flex-shrink: 0;
}

.topbar-btn-icon:hover {
    color: var(--brand-primary);
    background: var(--bg-surface);
    border-color: var(--brand-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.topbar-divider {
    width: 1px;
    height: 18px;
    background: var(--border-color);
    margin: 0 0.15rem;
    flex-shrink: 0;
}

.topbar-search-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-xs);
    width: 240px;
    max-width: 100%;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.topbar-search-box:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.topbar-campus-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 0.25rem 0.65rem;
    transition: all var(--transition-fast);
    height: 32px;
    box-sizing: border-box;
    cursor: pointer;
    flex-shrink: 0;
}

.topbar-campus-chip:hover {
    background: var(--bg-surface);
    border-color: var(--brand-primary);
}

.topbar-campus-chip select {
    background: transparent;
    border: none;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
    max-width: 140px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    padding: 0 0.15rem 0 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    line-height: normal;
}

.topbar-campus-chip select option {
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.5rem;
}

.topbar-clock-box {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg-muted);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
    white-space: nowrap;
    flex-shrink: 0;
}

.topbar-profile-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.55rem 0.2rem 0.25rem;
    border-radius: var(--radius-full);
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    flex-shrink: 0;
}

.topbar-profile-chip:hover {
    background: var(--bg-surface);
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-sm);
}

.topbar-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 290px;
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: fadeInDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.topbar-popover.active {
    display: flex;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.topbar-badge-counter {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #ffffff !important;
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.55);
    line-height: 1;
    z-index: 10;
    pointer-events: none;
}

[data-theme="dark"] .topbar-badge-counter {
    border-color: var(--bg-surface, #1e293b);
}

@keyframes badgePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    display: inline-block;
    box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
    animation: pulseDot 2s infinite;
    flex-shrink: 0;
}

@keyframes pulseDot {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.popover-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.popover-item:hover {
    background: var(--bg-muted);
    color: var(--brand-primary);
}

/* ==========================================================================
   ENHANCED MOBILE & DESKTOP RESPONSIVE ADAPTATIONS
   ========================================================================== */
#mobile-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1040;
    display: none;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

#mobile-sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (min-width: 1025px) {
    #sidebar-container {
        position: sticky;
        top: 0;
        width: var(--sidebar-width);
        height: 100vh;
        z-index: 100;
        transform: none !important;
        display: flex;
        flex-direction: column;
    }

    .mobile-sidebar-close {
        display: none !important;
    }

    #mobile-menu-btn {
        display: none !important;
    }
}

@media (max-width: 1024px) {
    #mobile-menu-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    #sidebar-container {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        width: 280px !important;
        max-width: 85vw !important;
        z-index: 1050 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
        background: var(--bg-surface) !important;
        border-right: 1px solid var(--border-color) !important;
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.35) !important;
        overflow-y: auto !important;
        display: flex !important;
        flex-direction: column !important;
    }

    #sidebar-container.open {
        transform: translateX(0) !important;
    }

    .sidebar {
        position: static !important;
        width: 100% !important;
        min-height: 100% !important;
        transform: none !important;
        box-shadow: none !important;
        padding: 1.25rem 1rem !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .mobile-sidebar-close {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    .topbar-search-box {
        width: 180px;
    }
}

@media (max-width: 768px) {
    .app-topbar {
        padding: 0 0.6rem;
        gap: 0.35rem;
    }

    .topbar-campus-chip {
        max-width: 140px;
        padding: 0.2rem 0.4rem;
    }

    .topbar-campus-chip select {
        max-width: 110px !important;
        font-size: 0.72rem !important;
    }

    .topbar-period-wrapper {
        display: none !important;
    }

    .topbar-search-box {
        width: 110px;
        padding: 0.3rem 0.5rem;
    }

    .topbar-search-box kbd {
        display: none;
    }

    .topbar-search-text {
        font-size: 0.72rem !important;
    }

    .topbar-clock-box {
        display: none !important;
    }

    .topbar-create-text {
        display: none;
    }

    #btn-quick-create-menu {
        padding: 0.35rem 0.45rem !important;
    }

    .topbar-profile-chip span:last-child {
        display: none;
    }

    .topbar-popover {
        width: 260px;
        max-width: 90vw;
        right: -8px;
    }

    /* Universal Responsive Grid & Card Formats */
    .grid-layout, .responsive-grid-2, .responsive-grid-equal, .responsive-grid-3, .responsive-grid-4, .form-grid-2, .form-grid-3, .stats-grid, .modal-form-grid {
        grid-template-columns: 1fr !important;
        gap: 0.85rem !important;
    }

    .card {
        padding: 1.15rem;
        border-radius: var(--radius-md);
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: auto;
    }

    .stat-card {
        padding: 1rem 1.15rem;
        min-width: 0;
    }

    .main-content {
        padding: 0.85rem 0.65rem 8.5rem 0.65rem !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }

    /* Universal Table Scroll Wrapping */
    .table-responsive, .table-container {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--radius-sm);
        display: block;
    }

    /* Universal Dialog / Modal Mobile Adaptation */
    .app-dialog, .modal, .modal-responsive {
        max-width: calc(100vw - 1.25rem) !important;
        width: calc(100vw - 1.25rem) !important;
        max-height: 88vh !important;
        overflow-y: auto !important;
        padding: 1.25rem 0.95rem !important;
        margin: auto !important;
        box-sizing: border-box !important;
    }

    .app-dialog-overlay, .modal-backdrop {
        padding: 0.6rem !important;
        box-sizing: border-box !important;
        z-index: 10000 !important;
    }

    /* Notification Drawer Mobile Size */
    .notification-drawer {
        width: 100vw !important;
        max-width: 100vw !important;
        right: -100vw;
    }

    .notification-drawer.active {
        right: 0 !important;
    }

    /* Floating Messenger Button Mobile Position & Size */
    .floating-messenger-btn {
        bottom: 1rem !important;
        right: 1rem !important;
        width: 44px !important;
        height: 44px !important;
        box-shadow: 0 4px 14px rgba(0,0,0,0.25) !important;
        z-index: 900 !important;
    }

    /* Messenger Window Mobile Size */
    .messenger-window {
        width: calc(100vw - 1.5rem) !important;
        max-width: calc(100vw - 1.5rem) !important;
        right: 0.75rem !important;
        bottom: 4.5rem !important;
        height: 72vh !important;
        max-height: 520px !important;
        z-index: 950 !important;
    }

    /* Responsive Button & Action Bars */
    .action-bar, .filter-bar, .page-header-actions, .header-actions {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }

    .action-bar > *, .filter-bar > *, .page-header-actions > * {
        flex: 1 1 auto;
    }
}

@media (max-width: 480px) {
    .topbar-search-box {
        display: none !important;
    }
    .topbar-campus-chip {
        max-width: 110px;
    }
    .topbar-campus-chip select {
        max-width: 85px !important;
        font-size: 0.7rem !important;
    }
    .app-topbar {
        padding: 0 0.4rem;
        height: 56px;
    }
    .btn {
        padding: 0.55rem 0.85rem;
        font-size: 0.8rem;
    }
    .btn-lg {
        padding: 0.7rem 1.15rem;
        font-size: 0.9rem;
    }
    .modal, .app-dialog {
        padding: 1rem 0.8rem !important;
    }
    .id-card-preview {
        transform: scale(0.85);
        transform-origin: center top;
        margin: 0 auto;
    }
}