/* ======================================
   Universal VibraxTech - Enhanced UI/UX
   ====================================== */

/* Loading States & Skeleton Screens */
.skeleton {
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

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

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-card {
    height: 200px;
}

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

/* Enhanced Loading Spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-container {
    background: var(--b1, #fff);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    background: var(--b1, #fff);
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid;
    min-width: 300px;
}

.toast.success { border-color: #22c55e; }
.toast.error { border-color: #ef4444; }
.toast.warning { border-color: #f59e0b; }
.toast.info { border-color: #3b82f6; }

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon { color: #22c55e; }
.toast.error .toast-icon { color: #ef4444; }
.toast.warning .toast-icon { color: #f59e0b; }
.toast.info .toast-icon { color: #3b82f6; }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 14px;
    opacity: 0.8;
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    padding: 4px;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.removing {
    animation: slideOutRight 0.3s ease-in forwards;
}

/* Mobile-First Touch Targets */
@media (max-width: 768px) {
    .btn, button, a.btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .input, .select, .textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .badge {
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* Enhanced Card Hover Effects */
.card-interactive {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.card-interactive:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.card-interactive:active {
    transform: translateY(-2px) scale(1.01);
}

/* Micro-interactions */
.btn-scale {
    transition: transform 0.2s ease;
}

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

.ripple {
    position: relative;
    overflow: hidden;
}

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

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

/* Progress Indicators */
.progress-bar {
    height: 4px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    transition: width 0.3s ease;
}

/* Smooth Page Transitions */
.page-enter {
    animation: fadeInUp 0.4s ease-out;
}

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

/* Empty States */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 64px;
    opacity: 0.3;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.empty-state-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    opacity: 0.7;
}

.empty-state-message {
    font-size: 16px;
    opacity: 0.5;
    margin-bottom: 20px;
}

/* Focus Visible (Accessibility) */
*:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Keyboard Navigation Indicators */
.keyboard-user *:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Skip to Content Link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #6366f1;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    z-index: 10000;
    transition: top 0.3s;
}

.skip-to-content:focus {
    top: 0;
}

/* Enhanced Tooltips */
.tooltip-custom {
    position: relative;
}

.tooltip-custom::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
}

.tooltip-custom::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.tooltip-custom:hover::before,
.tooltip-custom:hover::after {
    opacity: 1;
}

.tooltip-custom:hover::before {
    transform: translateX(-50%) translateY(-4px);
}

/* Smooth Scroll Padding */
html {
    scroll-padding-top: 80px;
}

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

/* Enhanced Search Input */
.search-input-wrapper {
    position: relative;
}

.search-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.search-input-clear {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(0, 0, 0, 0.4);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s;
}

.search-input-clear:hover {
    background: rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.6);
}

.search-input {
    padding-left: 44px !important;
    padding-right: 44px !important;
}

/* Badge Animations */
.badge-pulse {
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

/* Image Lazy Load Fade */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Table Enhancements */
.table-hover tbody tr {
    transition: background-color 0.2s;
}

.table-hover tbody tr:hover {
    background-color: rgba(99, 102, 241, 0.05);
}

/* Copy Button Feedback */
.copy-feedback {
    position: relative;
}

.copy-feedback::after {
    content: 'Copied!';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #22c55e;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.copy-feedback.copied::after {
    opacity: 1;
}

/* Dark Mode Optimizations */
[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
    background-size: 200% 100%;
}

[data-theme="dark"] .toast {
    background: #1f2937;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .empty-state-icon {
    opacity: 0.2;
}

/* Print Styles */
@media print {
    .no-print,
    nav,
    footer,
    .btn,
    button {
        display: none !important;
    }
    
    .card {
        break-inside: avoid;
    }
}

/* Sticky Elements */
.sticky-top {
    position: sticky;
    top: 70px;
    z-index: 10;
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

[data-theme="dark"] .glass-effect {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Bounce Animation for CTAs */
@keyframes bounce-subtle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.bounce-cta {
    animation: bounce-subtle 2s ease-in-out infinite;
}

/* Responsive Container Queries */
@container (max-width: 500px) {
    .card-body {
        padding: 1rem;
    }
}

/* Custom Checkbox/Radio Styles */
.custom-checkbox,
.custom-radio {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #6366f1;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}

.custom-radio {
    border-radius: 50%;
}

.custom-checkbox:checked,
.custom-radio:checked {
    background: #6366f1;
}

.custom-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
}

.custom-radio:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}
