/**
 * UX Enhancements CSS
 * Comprehensive UX improvements for Skitterskoon
 *
 * @package Skitterskoon
 */

/* ===================================
   CSS VARIABLES FOR UX
   =================================== */

:root {
    --ux-primary: #37726E;
    --ux-primary-dark: #2a5654;
    --ux-primary-light: #7EC7A8;
    --ux-accent: #F2FC32;
    --ux-success: #10b981;
    --ux-warning: #f59e0b;
    --ux-error: #ef4444;
    --ux-info: #3b82f6;
    --ux-white: #ffffff;
    --ux-gray-50: #f9fafb;
    --ux-gray-100: #f3f4f6;
    --ux-gray-200: #e5e7eb;
    --ux-gray-300: #d1d5db;
    --ux-gray-400: #9ca3af;
    --ux-gray-500: #6b7280;
    --ux-gray-600: #4b5563;
    --ux-gray-700: #374151;
    --ux-gray-800: #1f2937;
    --ux-gray-900: #111827;
    --ux-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --ux-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --ux-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --ux-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --ux-radius-sm: 6px;
    --ux-radius: 8px;
    --ux-radius-lg: 12px;
    --ux-radius-xl: 16px;
    --ux-radius-full: 9999px;
    --ux-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --ux-transition: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --ux-transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================
   1. LOADING STATES & BUTTON FEEDBACK
   =================================== */

/* Button loading state */
.btn-loading,
.button-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.85;
}

.btn-loading .btn-text,
.button-loading .btn-text {
    visibility: hidden;
}

.btn-loading .btn-spinner,
.button-loading .btn-spinner {
    display: inline-flex !important;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.btn-spinner {
    display: none;
}

/* Spinner animation */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner-lg {
    width: 28px;
    height: 28px;
    border-width: 3px;
}

.spinner-primary {
    border-color: rgba(55, 114, 110, 0.2);
    border-top-color: var(--ux-primary);
}

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

/* Page/section loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: var(--ux-transition);
}

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

.loading-overlay .loading-content {
    text-align: center;
}

.loading-overlay .loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--ux-gray-200);
    border-top-color: var(--ux-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

.loading-overlay .loading-text {
    color: var(--ux-gray-600);
    font-size: 1rem;
    font-weight: 500;
}

/* ===================================
   2. SKELETON LOADING SCREENS
   =================================== */

.skeleton {
    background: linear-gradient(90deg,
        var(--ux-gray-200) 0%,
        var(--ux-gray-100) 50%,
        var(--ux-gray-200) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--ux-radius-sm);
}

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

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
    border-radius: 4px;
}

.skeleton-text:last-child {
    width: 80%;
}

.skeleton-title {
    height: 1.5em;
    width: 60%;
    margin-bottom: 1em;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-avatar-lg {
    width: 80px;
    height: 80px;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    border-radius: var(--ux-radius);
}

.skeleton-card {
    padding: 20px;
    background: var(--ux-white);
    border-radius: var(--ux-radius-lg);
    box-shadow: var(--ux-shadow-sm);
}

.skeleton-button {
    height: 44px;
    width: 120px;
    border-radius: var(--ux-radius);
}

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

.skeleton-stat-card .skeleton-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--ux-radius);
    flex-shrink: 0;
}

.skeleton-stat-card .skeleton-content {
    flex: 1;
}

.skeleton-stat-card .skeleton-value {
    height: 2rem;
    width: 60%;
    margin-bottom: 8px;
}

.skeleton-stat-card .skeleton-label {
    height: 1rem;
    width: 80%;
}

/* ===================================
   3. EMPTY STATES
   =================================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    background: var(--ux-gray-50);
    border-radius: var(--ux-radius-xl);
    border: 2px dashed var(--ux-gray-200);
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
    color: var(--ux-gray-400);
}

.empty-state-icon svg {
    width: 100%;
    height: 100%;
    stroke-width: 1.5;
}

.empty-state-illustration {
    width: 200px;
    height: 160px;
    margin-bottom: 24px;
    opacity: 0.8;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ux-gray-800);
    margin-bottom: 8px;
}

.empty-state-description {
    font-size: 1rem;
    color: var(--ux-gray-500);
    max-width: 400px;
    margin-bottom: 24px;
    line-height: 1.6;
}

.empty-state-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--ux-primary);
    color: var(--ux-white);
    border-radius: var(--ux-radius);
    font-weight: 600;
    text-decoration: none;
    transition: var(--ux-transition);
}

.empty-state-action:hover {
    background: var(--ux-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--ux-shadow);
}

.empty-state-action svg {
    width: 20px;
    height: 20px;
}

/* Empty state variants */
.empty-state-sm {
    padding: 40px 20px;
}

.empty-state-sm .empty-state-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 16px;
}

.empty-state-sm .empty-state-title {
    font-size: 1.1rem;
}

.empty-state-sm .empty-state-description {
    font-size: 0.9rem;
}

/* ===================================
   4. TOAST NOTIFICATIONS
   =================================== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    pointer-events: none;
}

@media (max-width: 480px) {
    .toast-container {
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--ux-white);
    border-radius: var(--ux-radius-lg);
    box-shadow: var(--ux-shadow-lg);
    border-left: 4px solid var(--ux-gray-400);
    pointer-events: auto;
    animation: toast-slide-in 0.3s ease-out;
    transition: var(--ux-transition);
}

.toast.toast-exiting {
    animation: toast-slide-out 0.3s ease-in forwards;
}

@keyframes toast-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toast-slide-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.toast-icon svg {
    width: 16px;
    height: 16px;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--ux-gray-800);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.9rem;
    color: var(--ux-gray-600);
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--ux-gray-400);
    cursor: pointer;
    border-radius: 4px;
    transition: var(--ux-transition-fast);
}

.toast-close:hover {
    background: var(--ux-gray-100);
    color: var(--ux-gray-600);
}

/* Toast variants */
.toast-success {
    border-left-color: var(--ux-success);
}

.toast-success .toast-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--ux-success);
}

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

.toast-error .toast-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--ux-error);
}

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

.toast-warning .toast-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--ux-warning);
}

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

.toast-info .toast-icon {
    background: rgba(59, 130, 246, 0.1);
    color: var(--ux-info);
}

/* Toast with progress bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    animation: toast-progress 5s linear forwards;
}

@keyframes toast-progress {
    from { width: 100%; }
    to { width: 0%; }
}

/* ===================================
   5. FORM VALIDATION STYLING
   =================================== */

/* Input states */
.form-control,
.form-input,
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
textarea,
select {
    transition: border-color var(--ux-transition-fast), box-shadow var(--ux-transition-fast);
}

.form-control:focus,
.form-input:focus,
input:focus,
textarea:focus,
select:focus {
    border-color: var(--ux-primary);
    box-shadow: 0 0 0 3px rgba(55, 114, 110, 0.15);
    outline: none;
}

/* Valid state */
.is-valid,
.form-control.is-valid,
input.is-valid,
textarea.is-valid,
select.is-valid {
    border-color: var(--ux-success) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.is-valid:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

/* Invalid state */
.is-invalid,
.form-control.is-invalid,
input.is-invalid,
textarea.is-invalid,
select.is-invalid {
    border-color: var(--ux-error) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='15' y1='9' x2='9' y2='15'%3E%3C/line%3E%3Cline x1='9' y1='9' x2='15' y2='15'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

/* Validation messages */
.validation-message,
.field-error,
.error-message {
    display: none;
    font-size: 0.85rem;
    margin-top: 6px;
    padding-left: 4px;
}

.validation-message.show,
.is-invalid + .validation-message,
.is-invalid + .field-error,
.is-invalid ~ .error-message {
    display: block;
    color: var(--ux-error);
}

.validation-message.success,
.is-valid + .validation-message {
    display: block;
    color: var(--ux-success);
}

/* Form group with validation */
.form-group {
    position: relative;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--ux-gray-700);
}

.form-group .required-indicator {
    color: var(--ux-error);
    margin-left: 2px;
}

/* Real-time validation indicator */
.input-with-validation {
    position: relative;
}

.validation-indicator {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    opacity: 0;
    transition: var(--ux-transition-fast);
}

.validation-indicator.visible {
    opacity: 1;
}

.validation-indicator.checking {
    animation: spin 0.8s linear infinite;
}

/* ===================================
   6. STEP PROGRESS INDICATORS
   =================================== */

.step-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
    padding: 0 20px;
}

.step-progress-item {
    display: flex;
    align-items: center;
    position: relative;
}

.step-progress-item:not(:last-child)::after {
    content: '';
    width: 60px;
    height: 2px;
    background: var(--ux-gray-200);
    margin: 0 12px;
    transition: var(--ux-transition);
}

.step-progress-item.completed:not(:last-child)::after {
    background: var(--ux-primary);
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    background: var(--ux-gray-200);
    color: var(--ux-gray-500);
    transition: var(--ux-transition);
    position: relative;
    z-index: 1;
}

.step-progress-item.completed .step-number {
    background: var(--ux-primary);
    color: var(--ux-white);
}

.step-progress-item.completed .step-number::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E") center/16px no-repeat;
}

.step-progress-item.completed .step-number span {
    visibility: hidden;
}

.step-progress-item.active .step-number {
    background: var(--ux-primary);
    color: var(--ux-white);
    box-shadow: 0 0 0 4px rgba(55, 114, 110, 0.2);
}

.step-label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--ux-gray-500);
    white-space: nowrap;
    transition: var(--ux-transition);
}

.step-progress-item.active .step-label,
.step-progress-item.completed .step-label {
    color: var(--ux-primary);
    font-weight: 500;
}

/* Responsive step progress */
@media (max-width: 600px) {
    .step-progress-item:not(:last-child)::after {
        width: 30px;
        margin: 0 6px;
    }

    .step-number {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .step-label {
        font-size: 0.7rem;
    }
}

@media (max-width: 400px) {
    .step-label {
        display: none;
    }
}

/* ===================================
   7. MOBILE BOTTOM NAVIGATION
   =================================== */

.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--ux-white);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }

    /* Add padding to body to prevent content from being hidden */
    body.has-mobile-nav {
        padding-bottom: 70px;
    }
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    color: var(--ux-gray-500);
    text-decoration: none;
    transition: var(--ux-transition-fast);
    border-radius: var(--ux-radius);
    min-width: 64px;
}

.mobile-nav-item:hover,
.mobile-nav-item:active {
    color: var(--ux-primary);
    background: rgba(55, 114, 110, 0.05);
}

.mobile-nav-item.active {
    color: var(--ux-primary);
}

.mobile-nav-item.active .mobile-nav-icon {
    background: rgba(55, 114, 110, 0.1);
}

.mobile-nav-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    border-radius: var(--ux-radius-sm);
    transition: var(--ux-transition-fast);
}

.mobile-nav-icon svg {
    width: 22px;
    height: 22px;
    stroke-width: 2;
}

.mobile-nav-label {
    font-size: 0.7rem;
    font-weight: 500;
}

/* Mobile nav badge */
.mobile-nav-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--ux-error);
    color: var(--ux-white);
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: var(--ux-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===================================
   8. STICKY CTA
   =================================== */

.sticky-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--ux-primary) 0%, var(--ux-primary-dark) 100%);
    padding: 16px 20px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 999;
    box-shadow: 0 -4px 20px rgba(55, 114, 110, 0.3);
    transform: translateY(100%);
    transition: transform var(--ux-transition);
}

.sticky-cta.visible {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .sticky-cta {
        display: flex;
    }
}

.sticky-cta-content {
    flex: 1;
    min-width: 0;
}

.sticky-cta-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ux-white);
    margin-bottom: 2px;
}

.sticky-cta-subtitle {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
}

.sticky-cta-button {
    flex-shrink: 0;
    padding: 12px 24px;
    background: var(--ux-accent);
    color: var(--ux-primary-dark);
    font-weight: 700;
    border-radius: var(--ux-radius);
    text-decoration: none;
    transition: var(--ux-transition-fast);
    white-space: nowrap;
}

.sticky-cta-button:hover {
    background: #e5ef2e;
    transform: scale(1.02);
}

/* ===================================
   9. FLOATING ACTION BUTTON
   =================================== */

.floating-action-btn {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--ux-accent);
    color: var(--ux-primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--ux-shadow-lg);
    z-index: 998;
    cursor: pointer;
    border: none;
    transition: var(--ux-transition);
}

.floating-action-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--ux-shadow-xl);
}

.floating-action-btn svg {
    width: 24px;
    height: 24px;
}

/* FAB with menu */
.fab-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 998;
}

.fab-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: var(--ux-transition);
}

.fab-container.open .fab-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.fab-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--ux-white);
    border-radius: var(--ux-radius-full);
    box-shadow: var(--ux-shadow);
    text-decoration: none;
    color: var(--ux-gray-700);
    white-space: nowrap;
    transition: var(--ux-transition-fast);
}

.fab-menu-item:hover {
    background: var(--ux-gray-50);
    transform: translateX(-4px);
}

.fab-menu-item svg {
    width: 20px;
    height: 20px;
    color: var(--ux-primary);
}

@media (max-width: 768px) {
    .floating-action-btn,
    .fab-container {
        bottom: 100px;
    }
}

/* ===================================
   10. GLOBAL SEARCH
   =================================== */

.global-search {
    position: relative;
}

.global-search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 2px solid var(--ux-gray-200);
    border-radius: var(--ux-radius-full);
    font-size: 0.95rem;
    background: var(--ux-white);
    transition: var(--ux-transition-fast);
}

.global-search-input:focus {
    border-color: var(--ux-primary);
    box-shadow: 0 0 0 4px rgba(55, 114, 110, 0.1);
    outline: none;
}

.global-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--ux-gray-400);
    pointer-events: none;
}

.global-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--ux-gray-200);
    border: none;
    border-radius: 50%;
    color: var(--ux-gray-500);
    cursor: pointer;
    transition: var(--ux-transition-fast);
}

.global-search-input:not(:placeholder-shown) + .global-search-icon + .global-search-clear {
    display: flex;
}

.global-search-clear:hover {
    background: var(--ux-gray-300);
}

/* Search results dropdown */
.global-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--ux-white);
    border-radius: var(--ux-radius-lg);
    box-shadow: var(--ux-shadow-xl);
    max-height: 400px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--ux-transition);
    z-index: 1000;
}

.global-search.active .global-search-results {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-results-section {
    padding: 12px 0;
    border-bottom: 1px solid var(--ux-gray-100);
}

.search-results-section:last-child {
    border-bottom: none;
}

.search-results-title {
    padding: 0 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ux-gray-500);
    margin-bottom: 8px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--ux-gray-700);
    text-decoration: none;
    transition: var(--ux-transition-fast);
}

.search-result-item:hover {
    background: var(--ux-gray-50);
}

.search-result-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ux-gray-100);
    border-radius: var(--ux-radius);
    color: var(--ux-primary);
    flex-shrink: 0;
}

.search-result-icon svg {
    width: 18px;
    height: 18px;
}

.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-weight: 500;
    color: var(--ux-gray-800);
    margin-bottom: 2px;
}

.search-result-meta {
    font-size: 0.8rem;
    color: var(--ux-gray-500);
}

.search-no-results {
    padding: 40px 20px;
    text-align: center;
    color: var(--ux-gray-500);
}

/* Search loading state */
.global-search.loading .global-search-results::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--ux-primary), var(--ux-primary-light), var(--ux-primary));
    background-size: 200% 100%;
    animation: search-loading 1s ease-in-out infinite;
}

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

/* ===================================
   11. ADDITIONAL MICRO-INTERACTIONS
   =================================== */

/* Ripple effect on buttons */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn-ripple:active::after {
    width: 200px;
    height: 200px;
}

/* Card hover effects */
.card-interactive {
    transition: transform var(--ux-transition), box-shadow var(--ux-transition);
}

.card-interactive:hover {
    transform: translateY(-4px);
    box-shadow: var(--ux-shadow-lg);
}

/* Pulse animation for notifications */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Shake animation for errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Slide up animation */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.4s ease-out;
}

/* Scale in animation */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in {
    animation: scaleIn 0.3s ease-out;
}

/* ===================================
   12. MODAL ACCESSIBILITY & MOBILE
   =================================== */

/* Base modal styles for all modal types */
.modal,
.broker-modal,
.client-modal,
.admin-modal,
.employee-modal,
.salesperson-modal,
[class*="-modal"]:not(.toast-modal) {
    /* Ensure modals have proper stacking */
    z-index: 9999;
}

/* Modal backdrop/overlay - when modal is active */
.modal.active,
.broker-modal.active,
.client-modal.active,
.admin-modal.active,
.employee-modal.active,
.salesperson-modal.active,
[class*="-modal"].active:not(.toast-modal),
.modal.show,
.modal.open,
.modal.visible {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* Modal content container - responsive sizing */
.modal-content,
.broker-modal-content,
.client-modal-content,
.admin-modal-content,
.employee-modal-content,
.salesperson-modal-content,
[class*="-modal-content"] {
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile modal improvements */
@media (max-width: 768px) {
    .modal-content,
    .broker-modal-content,
    .client-modal-content,
    .admin-modal-content,
    .employee-modal-content,
    .salesperson-modal-content,
    [class*="-modal-content"] {
        width: 95% !important;
        max-width: 95% !important;
        max-height: 85vh;
        margin: auto;
        border-radius: var(--ux-radius-lg);
    }
}

@media (max-width: 480px) {
    /* Bottom sheet style modals on small screens */
    .modal-content,
    .broker-modal-content,
    .client-modal-content,
    .admin-modal-content,
    .employee-modal-content,
    .salesperson-modal-content,
    [class*="-modal-content"] {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh;
        margin: 0;
        border-radius: var(--ux-radius-xl) var(--ux-radius-xl) 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
    }

    /* Adjust modal header for mobile */
    .modal-header,
    .broker-modal-header,
    .client-modal-header,
    .admin-modal-header,
    [class*="-modal-header"] {
        position: sticky;
        top: 0;
        background: inherit;
        z-index: 1;
        padding: 16px 20px;
        border-bottom: 1px solid var(--ux-gray-200);
    }

    /* Add drag handle indicator for mobile modals */
    .modal-content::before,
    .broker-modal-content::before,
    .client-modal-content::before,
    .admin-modal-content::before,
    [class*="-modal-content"]::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: var(--ux-gray-300);
        border-radius: 2px;
        margin: 8px auto 0;
    }

    /* Modal body padding adjustment */
    .modal-body,
    .broker-modal-body,
    .client-modal-body,
    .admin-modal-body,
    [class*="-modal-body"] {
        padding: 16px 20px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    /* Ensure form inputs are large enough for touch */
    .modal input,
    .modal select,
    .modal textarea,
    [class*="-modal"] input,
    [class*="-modal"] select,
    [class*="-modal"] textarea {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
        min-height: 44px;
    }
}

/* Modal close button accessibility */
.modal-close,
.broker-modal-close,
.client-modal-close,
.admin-modal-close,
[class*="-modal-close"] {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--ux-transition-fast);
}

.modal-close:hover,
.broker-modal-close:hover,
.client-modal-close:hover,
.admin-modal-close:hover,
[class*="-modal-close"]:hover {
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--ux-radius);
}

.modal-close:focus,
.broker-modal-close:focus,
.client-modal-close:focus,
.admin-modal-close:focus,
[class*="-modal-close"]:focus {
    outline: 2px solid var(--ux-primary);
    outline-offset: 2px;
}

/* Improve focus visibility for modal elements */
.modal *:focus,
[class*="-modal"] *:focus {
    outline: 2px solid var(--ux-primary);
    outline-offset: 2px;
}

.modal button:focus,
.modal a:focus,
.modal input:focus,
.modal select:focus,
.modal textarea:focus,
[class*="-modal"] button:focus,
[class*="-modal"] a:focus,
[class*="-modal"] input:focus,
[class*="-modal"] select:focus,
[class*="-modal"] textarea:focus {
    outline: 2px solid var(--ux-primary);
    outline-offset: 2px;
}

/* Skip focus outline for mouse users, keep for keyboard */
.modal *:focus:not(:focus-visible),
[class*="-modal"] *:focus:not(:focus-visible) {
    outline: none;
}

.modal *:focus-visible,
[class*="-modal"] *:focus-visible {
    outline: 2px solid var(--ux-primary);
    outline-offset: 2px;
}

/* Ensure modal overlay prevents body scroll */
body.modal-open,
body.has-modal {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Modal animation improvements */
@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 480px) {
    .modal-content,
    .broker-modal-content,
    .client-modal-content,
    .admin-modal-content,
    [class*="-modal-content"] {
        animation: modalSlideUp 0.3s ease-out;
    }
}

@media (min-width: 481px) {
    .modal.active .modal-content,
    .broker-modal.active .broker-modal-content,
    .client-modal.active .client-modal-content,
    .admin-modal.active .admin-modal-content,
    [class*="-modal"].active [class*="-modal-content"] {
        animation: modalFadeIn 0.2s ease-out;
    }
}

/* ===================================
   13. PASSWORD STRENGTH METER
   =================================== */

.password-strength-container {
    margin-top: 12px;
}

.password-strength-bar {
    height: 6px;
    background: var(--ux-gray-200);
    border-radius: var(--ux-radius-full);
    overflow: hidden;
    margin-bottom: 12px;
}

.password-strength-fill {
    height: 100%;
    width: 0;
    border-radius: var(--ux-radius-full);
    transition: width var(--ux-transition), background-color var(--ux-transition);
}

.password-strength-fill.strength-0 {
    width: 0;
    background: var(--ux-gray-300);
}

.password-strength-fill.strength-1 {
    width: 20%;
    background: var(--ux-error);
}

.password-strength-fill.strength-2 {
    width: 40%;
    background: #f97316;
}

.password-strength-fill.strength-3 {
    width: 60%;
    background: var(--ux-warning);
}

.password-strength-fill.strength-4 {
    width: 80%;
    background: #84cc16;
}

.password-strength-fill.strength-5 {
    width: 100%;
    background: var(--ux-success);
}

.password-strength-label {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.password-strength-text {
    color: var(--ux-gray-600);
}

.password-strength-text.weak {
    color: var(--ux-error);
}

.password-strength-text.fair {
    color: var(--ux-warning);
}

.password-strength-text.good {
    color: #84cc16;
}

.password-strength-text.strong {
    color: var(--ux-success);
}

.password-requirements {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

@media (max-width: 480px) {
    .password-requirements {
        grid-template-columns: 1fr;
    }
}

.password-requirement {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--ux-gray-500);
    transition: color var(--ux-transition-fast);
}

.password-requirement.met {
    color: var(--ux-success);
}

.password-requirement-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--ux-gray-200);
    transition: background var(--ux-transition-fast);
}

.password-requirement.met .password-requirement-icon {
    background: var(--ux-success);
    color: white;
}

.password-requirement-icon svg {
    width: 10px;
    height: 10px;
}

/* ===================================
   14. DATA TABLE ENHANCEMENTS
   =================================== */

.data-table-wrapper {
    position: relative;
    background: var(--ux-white);
    border-radius: var(--ux-radius-lg);
    box-shadow: var(--ux-shadow-sm);
    overflow: hidden;
}

.data-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid var(--ux-gray-100);
    flex-wrap: wrap;
}

.data-table-search {
    position: relative;
    flex: 1;
    max-width: 300px;
}

.data-table-search input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 1px solid var(--ux-gray-200);
    border-radius: var(--ux-radius);
    font-size: 0.9rem;
    transition: var(--ux-transition-fast);
}

.data-table-search input:focus {
    border-color: var(--ux-primary);
    box-shadow: 0 0 0 3px rgba(55, 114, 110, 0.1);
    outline: none;
}

.data-table-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--ux-gray-400);
    pointer-events: none;
}

.data-table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Enhanced table styling */
table.data-table,
.data-table table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ux-gray-600);
    background: var(--ux-gray-50);
    border-bottom: 2px solid var(--ux-gray-200);
    white-space: nowrap;
    user-select: none;
}

.data-table th.sortable {
    cursor: pointer;
    transition: background var(--ux-transition-fast);
}

.data-table th.sortable:hover {
    background: var(--ux-gray-100);
}

.data-table th .sort-indicator {
    display: inline-flex;
    margin-left: 6px;
    opacity: 0.3;
    transition: opacity var(--ux-transition-fast);
}

.data-table th.sorted .sort-indicator {
    opacity: 1;
    color: var(--ux-primary);
}

.data-table th.sorted.asc .sort-indicator svg {
    transform: rotate(180deg);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--ux-gray-100);
    color: var(--ux-gray-700);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--ux-transition-fast);
}

.data-table tbody tr:hover {
    background: var(--ux-gray-50);
}

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

/* Table actions column */
.data-table .actions-cell {
    text-align: right;
    white-space: nowrap;
}

.data-table .action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--ux-gray-500);
    border-radius: var(--ux-radius-sm);
    cursor: pointer;
    transition: var(--ux-transition-fast);
}

.data-table .action-btn:hover {
    background: var(--ux-gray-100);
    color: var(--ux-primary);
}

.data-table .action-btn svg {
    width: 16px;
    height: 16px;
}

/* Pagination */
.data-table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-top: 1px solid var(--ux-gray-100);
    flex-wrap: wrap;
    gap: 12px;
}

.data-table-pagination-info {
    font-size: 0.9rem;
    color: var(--ux-gray-500);
}

.data-table-pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.data-table-pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--ux-gray-200);
    background: var(--ux-white);
    color: var(--ux-gray-700);
    border-radius: var(--ux-radius);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--ux-transition-fast);
}

.data-table-pagination-btn:hover:not(:disabled) {
    background: var(--ux-gray-50);
    border-color: var(--ux-gray-300);
}

.data-table-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.data-table-pagination-btn.active {
    background: var(--ux-primary);
    border-color: var(--ux-primary);
    color: var(--ux-white);
}

.data-table-pagination-btn svg {
    width: 16px;
    height: 16px;
}

/* No results state */
.data-table-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--ux-gray-500);
}

.data-table-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Responsive table */
@media (max-width: 768px) {
    .data-table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .data-table-search {
        max-width: none;
    }

    .data-table-wrapper {
        overflow-x: auto;
    }

    .data-table th,
    .data-table td {
        padding: 12px;
        font-size: 0.85rem;
    }
}

/* ===================================
   15. SIDEBAR NAVIGATION
   =================================== */

/* Sidebar overlay for mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: var(--ux-transition);
}

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

/* Sidebar collapse button */
.sidebar-collapse-btn {
    position: absolute;
    top: 20px;
    right: -12px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ux-white);
    border: 1px solid var(--ux-gray-200);
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    box-shadow: var(--ux-shadow-sm);
    transition: var(--ux-transition-fast);
}

.sidebar-collapse-btn:hover {
    background: var(--ux-gray-50);
    border-color: var(--ux-gray-300);
}

.sidebar-collapse-btn svg {
    transition: transform var(--ux-transition);
}

/* Collapsed sidebar state */
.sidebar.collapsed,
.broker-sidebar.collapsed,
.client-sidebar.collapsed,
.admin-sidebar.collapsed {
    width: 70px !important;
}

.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .nav-item-text,
.sidebar.collapsed .sidebar-user-info,
.broker-sidebar.collapsed .sidebar-logo-text,
.broker-sidebar.collapsed .nav-item-text,
.broker-sidebar.collapsed .sidebar-user-info,
.client-sidebar.collapsed .sidebar-logo-text,
.client-sidebar.collapsed .nav-item-text,
.client-sidebar.collapsed .sidebar-user-info,
.admin-sidebar.collapsed .sidebar-logo-text,
.admin-sidebar.collapsed .nav-item-text,
.admin-sidebar.collapsed .sidebar-user-info {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar.collapsed .nav-item,
.broker-sidebar.collapsed .nav-item,
.client-sidebar.collapsed .nav-item,
.admin-sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .nav-item-icon,
.broker-sidebar.collapsed .nav-item-icon,
.client-sidebar.collapsed .nav-item-icon,
.admin-sidebar.collapsed .nav-item-icon {
    margin-right: 0;
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .nav-item:hover::after,
.broker-sidebar.collapsed .nav-item:hover::after,
.client-sidebar.collapsed .nav-item:hover::after,
.admin-sidebar.collapsed .nav-item:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 12px;
    padding: 8px 12px;
    background: var(--ux-gray-800);
    color: var(--ux-white);
    font-size: 0.85rem;
    border-radius: var(--ux-radius);
    white-space: nowrap;
    z-index: 1000;
    box-shadow: var(--ux-shadow);
}

/* Main content adjustment when sidebar collapsed */
.main-content.sidebar-collapsed,
.dashboard-content.sidebar-collapsed {
    margin-left: 70px !important;
}

/* Mobile sidebar styles */
@media (max-width: 991px) {
    .sidebar-collapse-btn {
        display: none;
    }

    .sidebar,
    .broker-sidebar,
    .client-sidebar,
    .admin-sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px !important;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform var(--ux-transition);
    }

    .sidebar.mobile-open,
    .broker-sidebar.mobile-open,
    .client-sidebar.mobile-open,
    .admin-sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content,
    .dashboard-content {
        margin-left: 0 !important;
    }
}

/* ===================================
   16. ONBOARDING TOUR
   =================================== */

.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: var(--ux-transition);
}

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

.tour-highlight {
    position: relative;
    z-index: 9999 !important;
    box-shadow: 0 0 0 4px var(--ux-primary), 0 0 0 9999px rgba(0, 0, 0, 0.5);
    border-radius: var(--ux-radius);
    animation: tour-pulse 2s ease-in-out infinite;
}

@keyframes tour-pulse {
    0%, 100% {
        box-shadow: 0 0 0 4px var(--ux-primary), 0 0 0 9999px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(55, 114, 110, 0.5), 0 0 0 9999px rgba(0, 0, 0, 0.5);
    }
}

.tour-tooltip {
    position: fixed;
    z-index: 10000;
    background: var(--ux-white);
    border-radius: var(--ux-radius-lg);
    box-shadow: var(--ux-shadow-xl);
    max-width: 360px;
    width: 90%;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--ux-transition);
}

.tour-tooltip.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tour-tooltip-content {
    padding: 20px;
}

.tour-tooltip-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ux-gray-800);
    margin-bottom: 8px;
}

.tour-tooltip-text {
    font-size: 0.95rem;
    color: var(--ux-gray-600);
    line-height: 1.6;
    margin: 0;
}

.tour-tooltip-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--ux-gray-50);
    border-top: 1px solid var(--ux-gray-200);
    border-radius: 0 0 var(--ux-radius-lg) var(--ux-radius-lg);
}

.tour-tooltip-progress {
    font-size: 0.85rem;
    color: var(--ux-gray-500);
    font-weight: 500;
}

.tour-tooltip-actions {
    display: flex;
    gap: 8px;
}

.tour-btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--ux-radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--ux-transition-fast);
}

.tour-btn-skip {
    background: transparent;
    color: var(--ux-gray-500);
}

.tour-btn-skip:hover {
    color: var(--ux-gray-700);
    background: var(--ux-gray-100);
}

.tour-btn-prev {
    background: var(--ux-gray-200);
    color: var(--ux-gray-700);
}

.tour-btn-prev:hover {
    background: var(--ux-gray-300);
}

.tour-btn-primary {
    background: var(--ux-primary);
    color: var(--ux-white);
}

.tour-btn-primary:hover {
    background: var(--ux-primary-dark);
}

/* Tour tooltip arrow */
.tour-tooltip::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--ux-white);
    transform: rotate(45deg);
}

.tour-tooltip[data-position="bottom"]::before {
    top: -6px;
    left: 50%;
    margin-left: -6px;
    box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.05);
}

.tour-tooltip[data-position="top"]::before {
    bottom: -6px;
    left: 50%;
    margin-left: -6px;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.05);
}

.tour-tooltip[data-position="left"]::before {
    right: -6px;
    top: 50%;
    margin-top: -6px;
    box-shadow: 2px -2px 4px rgba(0, 0, 0, 0.05);
}

.tour-tooltip[data-position="right"]::before {
    left: -6px;
    top: 50%;
    margin-top: -6px;
    box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.05);
}

/* ===================================
   17. NOTIFICATION CENTER
   =================================== */

.notification-center {
    position: relative;
}

.notification-center-floating {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.notification-trigger {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: var(--ux-radius);
    transition: var(--ux-transition-fast);
}

.notification-trigger:hover {
    background: rgba(55, 114, 110, 0.1);
}

.notification-trigger svg {
    color: var(--ux-gray-600);
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--ux-error);
    color: var(--ux-white);
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: var(--ux-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s ease-in-out infinite;
}

.notification-panel {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 380px;
    max-width: 95vw;
    background: var(--ux-white);
    border-radius: var(--ux-radius-lg);
    box-shadow: var(--ux-shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--ux-transition);
    z-index: 1001;
}

.notification-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

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

.notification-panel-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ux-gray-800);
    margin: 0;
}

.notification-mark-all {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--ux-gray-500);
    border-radius: var(--ux-radius);
    cursor: pointer;
    transition: var(--ux-transition-fast);
}

.notification-mark-all:hover {
    background: var(--ux-gray-100);
    color: var(--ux-primary);
}

.notification-panel-body {
    max-height: 400px;
    overflow-y: auto;
}

.notification-list {
    padding: 8px 0;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background var(--ux-transition-fast);
}

.notification-item:hover {
    background: var(--ux-gray-50);
}

.notification-item.unread {
    background: rgba(55, 114, 110, 0.05);
}

.notification-item.unread:hover {
    background: rgba(55, 114, 110, 0.1);
}

.notification-item-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.notification-item-icon.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--ux-info);
}

.notification-item-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--ux-success);
}

.notification-item-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--ux-warning);
}

.notification-item-icon.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--ux-error);
}

.notification-item-icon svg {
    width: 18px;
    height: 18px;
}

.notification-item-content {
    flex: 1;
    min-width: 0;
}

.notification-item-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--ux-gray-800);
    margin-bottom: 2px;
}

.notification-item-message {
    font-size: 0.85rem;
    color: var(--ux-gray-600);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-item-time {
    font-size: 0.75rem;
    color: var(--ux-gray-400);
    margin-top: 4px;
}

.notification-item-dismiss {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--ux-gray-400);
    border-radius: var(--ux-radius-sm);
    cursor: pointer;
    opacity: 0;
    transition: var(--ux-transition-fast);
}

.notification-item:hover .notification-item-dismiss {
    opacity: 1;
}

.notification-item-dismiss:hover {
    background: var(--ux-gray-200);
    color: var(--ux-gray-600);
}

.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--ux-gray-400);
}

.notification-empty svg {
    margin-bottom: 12px;
    opacity: 0.5;
}

.notification-empty p {
    margin: 0;
    font-size: 0.9rem;
}

/* Mobile notification panel */
@media (max-width: 480px) {
    .notification-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: var(--ux-radius-xl) var(--ux-radius-xl) 0 0;
        max-height: 70vh;
    }

    .notification-panel::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: var(--ux-gray-300);
        border-radius: 2px;
        margin: 8px auto;
    }
}

/* ===================================
   18. FIELD ERROR MESSAGE
   =================================== */

.field-error-message {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--ux-error);
    margin-top: 6px;
    animation: fadeIn 0.2s ease-out;
}

.field-error-message::before {
    content: '';
    width: 14px;
    height: 14px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E") center/contain no-repeat;
    flex-shrink: 0;
}

/* ===================================
   19. DARK MODE
   =================================== */

/* Dark mode CSS variables */
[data-theme="dark"] {
    --ux-primary: #7EC7A8;
    --ux-primary-dark: #5fb08d;
    --ux-primary-light: #a8dbc4;
    --ux-white: #1a1a2e;
    --ux-gray-50: #16213e;
    --ux-gray-100: #1f2937;
    --ux-gray-200: #374151;
    --ux-gray-300: #4b5563;
    --ux-gray-400: #6b7280;
    --ux-gray-500: #9ca3af;
    --ux-gray-600: #d1d5db;
    --ux-gray-700: #e5e7eb;
    --ux-gray-800: #f3f4f6;
    --ux-gray-900: #f9fafb;
    --ux-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --ux-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --ux-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --ux-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] body,
body.dark-mode {
    background-color: #0f0f23;
    color: var(--ux-gray-700);
}

[data-theme="dark"] .toast,
[data-theme="dark"] .modal-content,
[data-theme="dark"] [class*="-modal-content"],
[data-theme="dark"] .notification-panel,
[data-theme="dark"] .autocomplete-dropdown,
[data-theme="dark"] .keyboard-shortcuts-content {
    background: var(--ux-gray-100);
    border-color: var(--ux-gray-200);
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: var(--ux-gray-100);
    border-color: var(--ux-gray-300);
    color: var(--ux-gray-700);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--ux-gray-400);
}

/* Theme toggle button */
.theme-toggle {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--ux-radius);
    cursor: pointer;
    color: var(--ux-gray-600);
    transition: var(--ux-transition-fast);
}

.theme-toggle:hover {
    background: rgba(55, 114, 110, 0.1);
    color: var(--ux-primary);
}

.theme-toggle-floating {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 999;
    background: var(--ux-white);
    box-shadow: var(--ux-shadow-lg);
    border-radius: 50%;
}

/* ===================================
   20. KEYBOARD SHORTCUTS MODAL
   =================================== */

.keyboard-shortcuts-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: var(--ux-transition);
}

.keyboard-shortcuts-modal.active {
    opacity: 1;
    visibility: visible;
}

.keyboard-shortcuts-content {
    background: var(--ux-white);
    border-radius: var(--ux-radius-xl);
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--ux-shadow-xl);
    animation: modalFadeIn 0.2s ease-out;
}

.keyboard-shortcuts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--ux-gray-200);
}

.keyboard-shortcuts-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ux-gray-800);
    margin: 0;
}

.keyboard-shortcuts-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--ux-gray-500);
    border-radius: var(--ux-radius);
    cursor: pointer;
    transition: var(--ux-transition-fast);
}

.keyboard-shortcuts-close:hover {
    background: var(--ux-gray-100);
    color: var(--ux-gray-700);
}

.keyboard-shortcuts-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.keyboard-shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.keyboard-shortcuts-category h3 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ux-gray-500);
    margin-bottom: 12px;
}

.keyboard-shortcuts-category ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.keyboard-shortcuts-category li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--ux-gray-100);
}

.keyboard-shortcuts-category li:last-child {
    border-bottom: none;
}

.shortcut-keys {
    display: flex;
    gap: 4px;
}

.shortcut-keys kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--ux-gray-100);
    border: 1px solid var(--ux-gray-200);
    border-radius: var(--ux-radius-sm);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ux-gray-700);
    text-transform: capitalize;
}

.shortcut-desc {
    font-size: 0.9rem;
    color: var(--ux-gray-600);
}

/* ===================================
   21. DRAG AND DROP
   =================================== */

[draggable="true"] {
    cursor: grab;
}

[draggable="true"]:active {
    cursor: grabbing;
}

.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.drop-zone-active {
    outline: 2px dashed var(--ux-primary);
    outline-offset: -2px;
    background: rgba(55, 114, 110, 0.05);
}

.drop-indicator {
    height: 3px;
    background: var(--ux-primary);
    border-radius: 2px;
    margin: 4px 0;
    animation: pulse 1s ease-in-out infinite;
}

.drag-handle {
    cursor: grab;
    padding: 8px;
    color: var(--ux-gray-400);
    transition: color var(--ux-transition-fast);
}

.drag-handle:hover {
    color: var(--ux-gray-600);
}

.drag-handle svg {
    width: 16px;
    height: 16px;
}

/* Draggable item styling */
.draggable-item {
    position: relative;
    background: var(--ux-white);
    border: 1px solid var(--ux-gray-200);
    border-radius: var(--ux-radius);
    padding: 12px 16px;
    margin-bottom: 8px;
    transition: var(--ux-transition-fast);
}

.draggable-item:hover {
    border-color: var(--ux-gray-300);
    box-shadow: var(--ux-shadow-sm);
}

.draggable-item.dragging {
    box-shadow: var(--ux-shadow-lg);
    z-index: 100;
}

/* ===================================
   22. INLINE EDITING
   =================================== */

.editable-cell {
    position: relative;
    cursor: pointer;
    transition: background var(--ux-transition-fast);
}

.editable-cell:hover {
    background: var(--ux-gray-50);
}

.editable-cell::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7'%3E%3C/path%3E%3Cpath d='M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z'%3E%3C/path%3E%3C/svg%3E") center/contain no-repeat;
    opacity: 0;
    transition: opacity var(--ux-transition-fast);
}

.editable-cell:hover::after {
    opacity: 1;
}

.editable-cell.editing {
    padding: 4px;
    background: var(--ux-white);
}

.editable-cell.editing::after {
    display: none;
}

.inline-edit-input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--ux-primary);
    border-radius: var(--ux-radius);
    font-size: inherit;
    font-family: inherit;
    background: var(--ux-white);
    outline: none;
}

.inline-edit-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    justify-content: flex-end;
}

.inline-edit-save,
.inline-edit-cancel {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--ux-radius-sm);
    cursor: pointer;
    transition: var(--ux-transition-fast);
}

.inline-edit-save {
    background: var(--ux-success);
    color: white;
}

.inline-edit-save:hover {
    background: #0d9668;
}

.inline-edit-cancel {
    background: var(--ux-gray-200);
    color: var(--ux-gray-600);
}

.inline-edit-cancel:hover {
    background: var(--ux-gray-300);
}

.editable-cell.just-edited {
    animation: cellHighlight 2s ease-out;
}

@keyframes cellHighlight {
    0% {
        background: rgba(16, 185, 129, 0.2);
    }
    100% {
        background: transparent;
    }
}

/* ===================================
   23. BREADCRUMBS
   =================================== */

.breadcrumbs {
    padding: 12px 0;
    margin-bottom: 16px;
}

.breadcrumbs-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.breadcrumbs-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.breadcrumbs-link,
.breadcrumbs-text {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--ux-radius);
    font-size: 0.9rem;
    color: var(--ux-gray-600);
    text-decoration: none;
    transition: var(--ux-transition-fast);
}

.breadcrumbs-link:hover {
    background: var(--ux-gray-100);
    color: var(--ux-primary);
}

.breadcrumbs-item.current .breadcrumbs-text {
    color: var(--ux-gray-800);
    font-weight: 500;
}

.breadcrumbs-separator {
    color: var(--ux-gray-400);
    display: flex;
    align-items: center;
}

.breadcrumbs-link svg,
.breadcrumbs-text svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ===================================
   24. CONTEXTUAL HELP
   =================================== */

.contextual-help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    background: transparent;
    border: none;
    color: var(--ux-gray-400);
    cursor: pointer;
    vertical-align: middle;
    transition: color var(--ux-transition-fast);
}

.contextual-help-icon:hover {
    color: var(--ux-primary);
}

.contextual-help-tooltip {
    position: fixed;
    z-index: 10002;
    max-width: 300px;
    padding: 12px 16px;
    background: var(--ux-gray-800);
    color: var(--ux-white);
    border-radius: var(--ux-radius);
    font-size: 0.85rem;
    line-height: 1.5;
    box-shadow: var(--ux-shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(5px);
    transition: var(--ux-transition-fast);
}

.contextual-help-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.contextual-help-tooltip.above {
    transform: translateY(-5px);
}

.contextual-help-tooltip.above.visible {
    transform: translateY(0);
}

.contextual-help-content {
    margin-right: 20px;
}

.contextual-help-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--ux-gray-400);
    cursor: pointer;
    border-radius: var(--ux-radius-sm);
    transition: var(--ux-transition-fast);
}

.contextual-help-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--ux-white);
}

/* First time hints */
.first-time-hint {
    position: fixed;
    z-index: 10001;
    max-width: 280px;
    background: var(--ux-primary);
    color: var(--ux-white);
    border-radius: var(--ux-radius-lg);
    box-shadow: var(--ux-shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--ux-transition);
}

.first-time-hint.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.first-time-hint-content {
    padding: 16px;
}

.first-time-hint-content p {
    margin: 0 0 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.first-time-hint-dismiss {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: var(--ux-radius);
    color: var(--ux-white);
    font-weight: 600;
    cursor: pointer;
    transition: var(--ux-transition-fast);
}

.first-time-hint-dismiss:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===================================
   25. PROGRESS INDICATORS
   =================================== */

.progress-indicator {
    background: var(--ux-white);
    border-radius: var(--ux-radius);
    padding: 16px;
    box-shadow: var(--ux-shadow-sm);
    margin-bottom: 12px;
    transition: var(--ux-transition);
}

.progress-indicator.removing {
    opacity: 0;
    transform: translateX(20px);
}

.progress-indicator.complete .progress-bar-fill {
    background: var(--ux-success);
}

.progress-indicator.error .progress-bar-fill {
    background: var(--ux-error);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-label {
    font-size: 0.9rem;
    color: var(--ux-gray-700);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.progress-info {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--ux-gray-500);
}

.progress-bar-track {
    height: 8px;
    background: var(--ux-gray-200);
    border-radius: var(--ux-radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--ux-primary);
    border-radius: var(--ux-radius-full);
    transition: width var(--ux-transition);
}

.progress-cancel {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--ux-gray-400);
    cursor: pointer;
    border-radius: var(--ux-radius-sm);
    transition: var(--ux-transition-fast);
}

.progress-cancel:hover {
    background: var(--ux-gray-100);
    color: var(--ux-error);
}

/* Circle progress */
.progress-indicator-circle {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-circle {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-circle-track {
    fill: none;
    stroke: var(--ux-gray-200);
    stroke-width: 8;
}

.progress-circle-fill {
    fill: none;
    stroke: var(--ux-primary);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset var(--ux-transition);
}

.progress-circle-content {
    position: absolute;
    text-align: center;
}

.progress-circle-content .progress-percentage {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ux-gray-800);
}

.progress-circle-content .progress-label {
    font-size: 0.75rem;
    color: var(--ux-gray-500);
}

/* ===================================
   26. AUTOCOMPLETE
   =================================== */

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--ux-white);
    border: 1px solid var(--ux-gray-200);
    border-radius: var(--ux-radius);
    box-shadow: var(--ux-shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--ux-transition-fast);
}

.autocomplete-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.autocomplete-section-title {
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ux-gray-500);
    background: var(--ux-gray-50);
    border-bottom: 1px solid var(--ux-gray-100);
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background var(--ux-transition-fast);
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: var(--ux-gray-50);
}

.autocomplete-item mark {
    background: rgba(55, 114, 110, 0.2);
    color: var(--ux-primary);
    padding: 0 2px;
    border-radius: 2px;
}

.autocomplete-recent svg {
    color: var(--ux-gray-400);
    flex-shrink: 0;
}

.autocomplete-empty {
    padding: 20px;
    text-align: center;
    color: var(--ux-gray-500);
    font-size: 0.9rem;
}

/* ===================================
   27. STICKY TABLE HEADERS
   =================================== */

.sticky-table-wrapper {
    position: relative;
    max-height: 600px;
    overflow: auto;
    border-radius: var(--ux-radius-lg);
    border: 1px solid var(--ux-gray-200);
}

.sticky-table-wrapper table {
    width: 100%;
    border-collapse: collapse;
}

.sticky-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--ux-white);
}

.sticky-header th {
    background: var(--ux-gray-50);
    box-shadow: 0 1px 0 var(--ux-gray-200);
}

.sticky-column {
    position: sticky;
    left: 0;
    z-index: 5;
    background: var(--ux-white);
    box-shadow: 1px 0 0 var(--ux-gray-200);
}

.sticky-header .sticky-column {
    z-index: 15;
}

/* Scroll shadows */
.sticky-table-wrapper.scrolled-left::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(to right, rgba(0,0,0,0.05), transparent);
    pointer-events: none;
    z-index: 20;
}

.sticky-table-wrapper.scrolled-right::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(to left, rgba(0,0,0,0.05), transparent);
    pointer-events: none;
    z-index: 20;
}

/* ===================================
   28. HIGH CONTRAST MODE
   =================================== */

.high-contrast {
    --ux-primary: #000000;
    --ux-primary-dark: #000000;
    --ux-white: #ffffff;
    --ux-gray-50: #ffffff;
    --ux-gray-100: #f0f0f0;
    --ux-gray-200: #cccccc;
    --ux-gray-300: #999999;
    --ux-gray-400: #666666;
    --ux-gray-500: #333333;
    --ux-gray-600: #1a1a1a;
    --ux-gray-700: #000000;
    --ux-gray-800: #000000;
    --ux-gray-900: #000000;
}

.high-contrast * {
    border-color: #000000 !important;
}

.high-contrast a,
.high-contrast button {
    text-decoration: underline;
}

.high-contrast input,
.high-contrast textarea,
.high-contrast select {
    border: 2px solid #000000 !important;
}

.high-contrast :focus {
    outline: 3px solid #000000 !important;
    outline-offset: 2px !important;
}

/* ===================================
   29. ADDITIONAL UTILITY CLASSES
   =================================== */

/* Visually hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible only for keyboard */
.focus-visible:focus:not(:focus-visible) {
    outline: none;
}

.focus-visible:focus-visible {
    outline: 2px solid var(--ux-primary);
    outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .theme-toggle,
    .notification-center,
    .keyboard-shortcuts-modal,
    .toast-container,
    .sidebar-collapse-btn,
    .mobile-bottom-nav,
    .floating-action-btn,
    .offline-indicator,
    .dashboard-controls,
    .widget-controls,
    .table-export-controls {
        display: none !important;
    }

    .breadcrumbs {
        margin-bottom: 20px;
    }

    body {
        background: white !important;
        color: black !important;
    }
}

/* =========================================================================
   SECTION 30: OFFLINE MODE / PWA SUPPORT
   ========================================================================= */

.offline-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--ux-warning);
    color: #000;
    padding: 12px 24px;
    border-radius: var(--ux-radius-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    font-size: 14px;
    box-shadow: var(--ux-shadow-lg);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
}

.offline-indicator.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

.offline-indicator svg {
    flex-shrink: 0;
}

/* Offline badge for buttons/links */
.offline-disabled {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.offline-disabled::after {
    content: 'Hors ligne';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--ux-gray-800);
    color: var(--ux-white);
    padding: 4px 8px;
    border-radius: var(--ux-radius);
    font-size: 11px;
    white-space: nowrap;
}

/* =========================================================================
   SECTION 31: REAL-TIME PRESENCE INDICATORS
   ========================================================================= */

.presence-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--ux-white);
    background: var(--ux-gray-400);
    transition: background-color var(--ux-transition);
}

.presence-dot.presence-online {
    background: var(--ux-success);
}

.presence-dot.presence-away {
    background: var(--ux-warning);
}

.presence-dot.presence-busy {
    background: var(--ux-error);
}

.presence-dot.presence-offline {
    background: var(--ux-gray-400);
}

/* Presence dot on avatars */
.avatar,
.user-avatar,
[data-user-id] {
    position: relative;
}

.avatar .presence-dot,
.user-avatar .presence-dot {
    width: 10px;
    height: 10px;
    bottom: 2px;
    right: 2px;
}

/* Larger presence dots for user cards */
.user-card .presence-dot {
    width: 14px;
    height: 14px;
    bottom: -2px;
    right: -2px;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--ux-gray-100);
    border-radius: var(--ux-radius);
    font-size: 13px;
    color: var(--ux-gray-600);
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--ux-gray-400);
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-4px);
    }
}

.typing-text {
    font-style: italic;
}

/* Online users counter */
.online-users-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--ux-success);
    color: white;
    border-radius: var(--ux-radius-full);
    font-size: 12px;
    font-weight: 500;
}

.online-users-count::before {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

/* =========================================================================
   SECTION 32: CUSTOMIZABLE DASHBOARD WIDGETS
   ========================================================================= */

.dashboard-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--ux-gray-50);
    border-radius: var(--ux-radius-lg);
    align-items: center;
}

.dashboard-edit-btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hidden-widgets-dropdown {
    position: relative;
}

.hidden-widgets-dropdown .dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: var(--ux-white);
    border: 1px solid var(--ux-gray-200);
    border-radius: var(--ux-radius);
    box-shadow: var(--ux-shadow-lg);
    z-index: 100;
    display: none;
    padding: 8px 0;
}

.hidden-widgets-dropdown:hover .dropdown-content,
.hidden-widgets-dropdown:focus-within .dropdown-content {
    display: block;
}

.hidden-widgets-dropdown .dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: background-color var(--ux-transition);
}

.hidden-widgets-dropdown .dropdown-item:hover {
    background: var(--ux-gray-100);
}

/* Dashboard widgets container */
.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    transition: all var(--ux-transition);
}

.dashboard-widgets.editing-mode {
    background: var(--ux-gray-100);
    padding: 20px;
    border-radius: var(--ux-radius-lg);
    border: 2px dashed var(--ux-gray-300);
}

/* Individual widget */
.dashboard-widget {
    position: relative;
    background: var(--ux-white);
    border-radius: var(--ux-radius-lg);
    box-shadow: var(--ux-shadow);
    padding: 20px;
    transition: all var(--ux-transition);
}

.dashboard-widget:hover {
    box-shadow: var(--ux-shadow-md);
}

.editing-mode .dashboard-widget {
    border: 2px solid transparent;
}

.editing-mode .dashboard-widget:hover {
    border-color: var(--ux-primary);
}

/* Widget controls */
.widget-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--ux-transition), visibility var(--ux-transition);
    z-index: 10;
}

.dashboard-widget:hover .widget-controls,
.editing-mode .widget-controls {
    opacity: 1;
    visibility: visible;
}

.widget-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ux-white);
    border: 1px solid var(--ux-gray-200);
    border-radius: var(--ux-radius);
    cursor: pointer;
    transition: all var(--ux-transition);
    color: var(--ux-gray-600);
}

.widget-btn:hover {
    background: var(--ux-gray-100);
    border-color: var(--ux-gray-300);
    color: var(--ux-gray-800);
}

.widget-drag-handle {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ux-white);
    border: 1px solid var(--ux-gray-200);
    border-radius: var(--ux-radius);
    cursor: grab;
    color: var(--ux-gray-400);
    transition: all var(--ux-transition);
}

.widget-drag-handle:hover {
    background: var(--ux-gray-100);
    color: var(--ux-gray-600);
}

.widget-drag-handle:active {
    cursor: grabbing;
}

/* Widget sizes */
.widget-small {
    grid-column: span 1;
}

.widget-medium {
    grid-column: span 1;
}

.widget-large {
    grid-column: span 2;
}

.widget-full {
    grid-column: 1 / -1;
}

@media (max-width: 768px) {
    .widget-large,
    .widget-full {
        grid-column: span 1;
    }
}

/* Widget collapsed state */
.widget-collapsed {
    padding-bottom: 12px;
}

.widget-collapsed .widget-content,
.widget-collapsed > *:not(.widget-controls):not(.widget-title):not(h3):not(h4) {
    display: none;
}

.widget-collapsed .widget-title,
.widget-collapsed h3,
.widget-collapsed h4 {
    margin-bottom: 0;
}

/* Widget hidden */
.widget-hidden {
    display: none !important;
}

/* Widget dragging */
.dashboard-widget.dragging {
    opacity: 0.5;
    transform: scale(0.98);
    box-shadow: var(--ux-shadow-xl);
    z-index: 100;
}

/* Widget title */
.widget-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ux-gray-800);
    margin-bottom: 16px;
    padding-right: 100px; /* Space for controls */
}

/* =========================================================================
   SECTION 33: EXPORT ENHANCEMENTS (PDF/Excel)
   ========================================================================= */

.table-export-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--ux-gray-50);
    border-radius: var(--ux-radius);
    flex-wrap: wrap;
}

.export-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ux-gray-600);
    margin-right: 4px;
}

.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    background: var(--ux-white);
    border: 1px solid var(--ux-gray-300);
    border-radius: var(--ux-radius);
    cursor: pointer;
    transition: all var(--ux-transition);
    color: var(--ux-gray-700);
}

.export-btn:hover {
    background: var(--ux-gray-100);
    border-color: var(--ux-gray-400);
    color: var(--ux-gray-900);
}

.export-btn:active {
    transform: scale(0.98);
}

.export-btn svg {
    flex-shrink: 0;
}

/* Export button variants */
.export-btn[data-format="excel"]:hover {
    border-color: #1D6F42;
    color: #1D6F42;
}

.export-btn[data-format="csv"]:hover {
    border-color: #3B82F6;
    color: #3B82F6;
}

.export-btn[data-format="pdf"]:hover {
    border-color: #DC2626;
    color: #DC2626;
}

.export-btn[data-format="print"]:hover {
    border-color: var(--ux-gray-600);
    color: var(--ux-gray-800);
}

/* Exportable table styling */
table[data-exportable] {
    position: relative;
}

table[data-exportable] thead th {
    background: var(--ux-gray-100);
}

/* Export dropdown (alternative layout) */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.export-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--ux-primary);
    color: white;
    border: none;
    border-radius: var(--ux-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--ux-transition);
}

.export-dropdown-btn:hover {
    background: var(--ux-primary-dark);
}

.export-dropdown-content {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 160px;
    background: var(--ux-white);
    border: 1px solid var(--ux-gray-200);
    border-radius: var(--ux-radius);
    box-shadow: var(--ux-shadow-lg);
    z-index: 100;
    display: none;
    padding: 8px 0;
    margin-top: 4px;
}

.export-dropdown:hover .export-dropdown-content,
.export-dropdown:focus-within .export-dropdown-content {
    display: block;
}

.export-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--ux-gray-700);
    transition: background-color var(--ux-transition);
}

.export-dropdown-item:hover {
    background: var(--ux-gray-100);
}

.export-dropdown-item svg {
    color: var(--ux-gray-500);
}

/* Mobile responsive export controls */
@media (max-width: 576px) {
    .table-export-controls {
        justify-content: center;
    }

    .export-label {
        width: 100%;
        text-align: center;
        margin-bottom: 8px;
    }

    .export-btn {
        flex: 1;
        justify-content: center;
        min-width: 70px;
    }

    .export-btn span {
        display: none;
    }
}

/* =========================================================================
   PHASE 4: DARK MODE ADJUSTMENTS
   ========================================================================= */

[data-theme="dark"] .offline-indicator {
    background: #F59E0B;
    color: #000;
}

[data-theme="dark"] .presence-dot {
    border-color: var(--ux-gray-800);
}

[data-theme="dark"] .typing-indicator {
    background: var(--ux-gray-700);
    color: var(--ux-gray-300);
}

[data-theme="dark"] .dashboard-controls {
    background: var(--ux-gray-800);
}

[data-theme="dark"] .dashboard-widgets.editing-mode {
    background: var(--ux-gray-900);
    border-color: var(--ux-gray-600);
}

[data-theme="dark"] .dashboard-widget {
    background: var(--ux-gray-800);
}

[data-theme="dark"] .widget-btn,
[data-theme="dark"] .widget-drag-handle {
    background: var(--ux-gray-700);
    border-color: var(--ux-gray-600);
    color: var(--ux-gray-300);
}

[data-theme="dark"] .widget-btn:hover,
[data-theme="dark"] .widget-drag-handle:hover {
    background: var(--ux-gray-600);
    color: var(--ux-white);
}

[data-theme="dark"] .table-export-controls {
    background: var(--ux-gray-800);
}

[data-theme="dark"] .export-btn {
    background: var(--ux-gray-700);
    border-color: var(--ux-gray-600);
    color: var(--ux-gray-300);
}

[data-theme="dark"] .export-btn:hover {
    background: var(--ux-gray-600);
    color: var(--ux-white);
}

[data-theme="dark"] .hidden-widgets-dropdown .dropdown-content,
[data-theme="dark"] .export-dropdown-content {
    background: var(--ux-gray-800);
    border-color: var(--ux-gray-600);
}

[data-theme="dark"] .hidden-widgets-dropdown .dropdown-item:hover,
[data-theme="dark"] .export-dropdown-item:hover {
    background: var(--ux-gray-700);
}
