/* ═══════════════════════════════════════════════════════════════
   AI LAB - ENHANCED UI/UX SYSTEM
   ═══════════════════════════════════════════════════════════════ */

/* ─── Loading States ─── */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

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

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ─── Toast Notifications ─── */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px 20px;
    min-width: 320px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: all;
    animation: toast-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.toast-out {
    animation: toast-out 0.2s ease forwards;
}

@keyframes toast-in {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
    to { transform: translateX(400px); opacity: 0; }
}

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

.toast.success .toast-icon { background: rgba(0, 255, 136, 0.2); color: var(--accent-green); }
.toast.error .toast-icon { background: rgba(255, 77, 109, 0.2); color: var(--accent-red); }
.toast.info .toast-icon { background: rgba(77, 150, 255, 0.2); color: var(--accent-blue); }

.toast-content {
    flex: 1;
}

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

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ─── Progress Bar ─── */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--bg-secondary);
    z-index: 10000;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
    width: 0%;
    transition: width 0.3s ease;
}

.progress-bar-indeterminate {
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--accent-green), transparent);
    animation: progress-indeterminate 1.5s ease infinite;
}

@keyframes progress-indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ─── Modal System ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fade-in 0.2s ease;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modal-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modal-in {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 20px;
    font-weight: 800;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px 32px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

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

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
}

.tooltip:hover::before {
    opacity: 1;
}

/* ─── Enhanced Cards ─── */
.card-hover-lift {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-hover-lift:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.card-glow {
    position: relative;
    overflow: hidden;
}

.card-glow::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.card-glow:hover::after {
    opacity: 1;
}

/* ─── Smooth Scroll ─── */
.smooth-scroll {
    scroll-behavior: smooth;
}

/* ─── Fade In Animations ─── */
.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

.fade-in-up-delay-1 { animation-delay: 0.1s; opacity: 0; }
.fade-in-up-delay-2 { animation-delay: 0.2s; opacity: 0; }
.fade-in-up-delay-3 { animation-delay: 0.3s; opacity: 0; }

/* ─── Interactive Elements ─── */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

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

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

/* ─── Focus States ─── */
*:focus-visible {
    outline: 2px solid var(--accent-green);
    outline-offset: 2px;
}

/* ─── Selection ─── */
::selection {
    background: var(--accent-green);
    color: #000;
}

/* ─── Scrollbar Enhanced ─── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-glow);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-green);
}

/* ─── Empty States ─── */
.empty-state {
    text-align: center;
    padding: 80px 40px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 24px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.empty-state-desc {
    font-size: 16px;
    margin-bottom: 32px;
}

/* ─── Badge Enhancements ─── */
.badge-pulse {
    animation: badge-pulse 2s ease infinite;
}

@keyframes badge-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(0, 255, 136, 0); }
}

/* ─── Gradient Text ─── */
.gradient-text {
    background: linear-gradient(135deg, var(--accent-green), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ─── Glass Morphism ─── */
.glass {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ─── Responsive Utilities ─── */
@media (max-width: 768px) {
    .toast-container {
        left: 12px;
        right: 12px;
        top: 12px;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
    }
    
    .modal {
        margin: 0;
        border-radius: 16px;
    }
}

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