/* Global styles and transitions */
* {
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

body {
    font-family: 'Poppins', sans-serif;
}

/* Loading spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notifications */
.success-notification, .error-notification {
    animation: fadeOut 3s forwards;
    animation-delay: 2s;
}

@keyframes fadeOut {
    from {opacity: 1;}
    to {opacity: 0; visibility: hidden;}
}

/* Search highlight */
.search-highlight {
    background-color: rgba(255, 255, 0, 0.2);
    padding: 0.1em;
    border-radius: 2px;
}

/* Card hover effects */
.user-card, .document-item {
    transition: all 0.2s ease-in-out;
}

.user-card:hover, .document-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Tab transitions */
[data-tab] {
    position: relative;
    transition: all 0.2s ease;
}

[data-tab]::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: currentColor;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.2s ease;
}

[data-tab]:hover::after {
    transform: scaleX(0.8);
}

[data-tab].active::after {
    transform: scaleX(1);
}

/* Form elements */
input, select, textarea {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus, textarea:focus {
    border-color: #4B5563;
    box-shadow: 0 0 0 2px rgba(75, 85, 99, 0.2);
}

button {
    transition: all 0.2s ease;
}

button:active {
    transform: scale(0.98);
}

/* Modal animations */
#user-modal, #profile-modal {
    transition: opacity 0.2s ease;
}

#user-modal.hidden, #profile-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Mobile responsive improvements */
@media (max-width: 768px) {
    .tab-content {
        padding: 1rem;
    }
    
    .grid {
        grid-gap: 1rem;
    }
    
    .mb-8 {
        margin-bottom: 1.5rem;
    }
    
    #user-modal .px-6, #profile-modal .px-6 {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Dark mode scrollbar */
.dark ::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.dark ::-webkit-scrollbar-thumb {
    background: #666;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* Animation for new elements */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Tooltip styles */
.tooltip {
    position: relative;
}

.tooltip:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem;
    background-color: #000;
    color: #fff;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 10;
    opacity: 0;
    animation: fadeIn 0.2s ease-out forwards;
}

/* Role badges */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.role-employee {
    background-color: rgba(147, 51, 234, 0.1);
    color: rgb(147, 51, 234);
}

.dark .role-employee {
    background-color: rgba(147, 51, 234, 0.2);
    color: rgb(216, 180, 254);
}

/* Email editor customizations */
#email-editor {
    min-height: 200px;
    transition: min-height 0.2s ease;
}

#email-editor:focus {
    min-height: 250px;
}

#email-editor[placeholder]:empty:before {
    content: attr(placeholder);
    color: #9CA3AF;
}

#email-editor[placeholder]:empty:focus:before {
    content: "";
}

/* Status indicators */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-online {
    background-color: #10B981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.status-offline {
    background-color: #EF4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

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

.notification-count {
    animation: pulse 2s infinite;
}