/**
 * WebGPU Detection Animations
 * Enhanced quantum-inspired styling with advanced visual effects
 */

.webgpu-detection-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background:
        radial-gradient(ellipse at center, rgba(0, 245, 255, 0.03) 0%, transparent 60%),
        linear-gradient(135deg,
            rgba(0, 0, 0, 0.92) 0%,
            rgba(10, 15, 25, 0.94) 25%,
            rgba(15, 10, 25, 0.94) 50%,
            rgba(10, 15, 25, 0.94) 75%,
            rgba(0, 0, 0, 0.92) 100%);
    backdrop-filter: blur(8px) saturate(120%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    transform: scale(0.9) rotateX(5deg);
    transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-family: 'Segoe UI', 'Arial', sans-serif;
    overflow: hidden;
    padding: 0;
    box-sizing: border-box;
}

/* Subtle animated background particles */
.webgpu-detection-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(1px 1px at 20px 30px, rgba(0, 245, 255, 0.02), transparent),
        radial-gradient(1px 1px at 40px 70px, rgba(0, 136, 255, 0.015), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(136, 0, 255, 0.01), transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255, 0, 136, 0.015), transparent),
        radial-gradient(1px 1px at 160px 30px, rgba(0, 255, 136, 0.012), transparent);
    background-repeat: repeat;
    background-size: 300px 300px;
    animation: particleFloat 30s linear infinite;
    pointer-events: none;
    opacity: 0.15;
}

@keyframes particleFloat {
    0% { transform: translate(0px, 0px) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
    100% { transform: translate(0px, 0px) rotate(360deg); }
}

.webgpu-detection-container.show {
    opacity: 1;
    transform: scale(1) rotateX(0deg);
}

.detection-content {
    background:
        linear-gradient(135deg,
            rgba(20, 25, 35, 0.95) 0%,
            rgba(18, 28, 45, 0.95) 25%,
            rgba(22, 18, 35, 0.95) 50%,
            rgba(18, 28, 45, 0.95) 75%,
            rgba(20, 25, 35, 0.95) 100%);
    border: 2px solid transparent;
    border-radius: 20px;
    padding: 1.5rem;
    max-width: 900px;
    width: 90%;
    max-height: 85vh;
    min-height: 70vh;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    backdrop-filter: blur(12px) saturate(130%);
    box-shadow:
        0 8px 20px rgba(0, 245, 255, 0.08),
        0 2px 10px rgba(0, 136, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        inset 0 -1px 0 rgba(0, 245, 255, 0.025);
}

/* Subtle animated border gradient */
.detection-content::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg,
        rgba(0, 245, 255, 0.1), rgba(0, 128, 255, 0.08), rgba(128, 0, 255, 0.06),
        rgba(255, 0, 128, 0.08), rgba(0, 245, 255, 0.1));
    background-size: 300% 300%;
    border-radius: 20px;
    animation: borderGlow 6s ease-in-out infinite;
    z-index: -1;
    opacity: 0.25;
}

@keyframes borderGlow {
    0%, 100% { background-position: 0% 50%; opacity: 0.15; }
    50% { background-position: 100% 50%; opacity: 0.2; }
}

/* Subtle holographic overlay effect */
.detection-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.03),
        rgba(0, 245, 255, 0.02),
        rgba(255, 255, 255, 0.03),
        transparent);
    animation: holographicSweep 8s ease-in-out infinite;
    pointer-events: none;
    opacity: 0.2;
}

@keyframes holographicSweep {
    0% { left: -100%; opacity: 0; }
    20% { opacity: 0.2; }
    80% { opacity: 0.2; }
    100% { left: 100%; opacity: 0; }
}

/* Subtle close button */
.detection-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ccc;
    font-size: 1.2rem;
    font-weight: normal;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
    z-index: 1000;
    opacity: 0.7;
}

.detection-close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 245, 255, 0.6);
    color: #00f5ff;
    transform: scale(1.05);
    opacity: 1;
    box-shadow: 0 0 8px rgba(0, 245, 255, 0.2);
}

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

/* Additional scanning effect */
.detection-content .scanline {
    position: absolute;
    top: 50%;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00f5ff, transparent);
    animation: scanline 2s linear infinite;
    z-index: 10;
}

@keyframes scanline {
    0% { left: -100%; }
    100% { left: 100%; }
}

.detection-header {
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
    z-index: 10;
}

.status-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    display: inline-block;
    animation: subtlePulse 3s ease-in-out infinite;
    filter: drop-shadow(0 0 4px rgba(0, 245, 255, 0.15));
    text-shadow:
        0 0 4px rgba(0, 245, 255, 0.2),
        0 0 6px rgba(0, 245, 255, 0.1);
}

@keyframes subtlePulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 4px rgba(0, 245, 255, 0.15));
    }
    50% {
        transform: scale(1.02);
        filter: drop-shadow(0 0 5px rgba(0, 245, 255, 0.2));
    }
}

/* Subtle timer display */
.detection-timer {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 245, 255, 0.3);
    border-radius: 15px;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    color: rgba(0, 245, 255, 0.8);
    font-weight: normal;
    backdrop-filter: blur(5px);
    z-index: 1000;
    opacity: 0.8;
    animation: timerGlow 2s ease-in-out infinite;
}

@keyframes timerGlow {
    0%, 100% {
        opacity: 0.6;
        box-shadow: 0 0 2px rgba(0, 245, 255, 0.05);
    }
    50% {
        opacity: 0.8;
        box-shadow: 0 0 4px rgba(0, 245, 255, 0.1);
    }
}

.status-title {
    font-size: 2rem;
    font-weight: 600;
    margin: 0;
    text-align: center;
    background: linear-gradient(45deg, #00f5ff, #0080ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.status-title.success {
    background: linear-gradient(45deg, #00ff88, #00f5ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.status-title.warning {
    background: linear-gradient(45deg, #ff8800, #ffaa00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.detection-details {
    color: #e0e0e0;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.browser-info {
    background: rgba(0, 245, 255, 0.1);
    border-left: 4px solid #00f5ff;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 0 10px 10px 0;
}

.capability-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.capability-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.capability-label {
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 0.5rem;
}

.capability-value {
    font-weight: bold;
    font-size: 1.1rem;
    color: #00f5ff;
}

/* Performance Score Styling */
.performance-score {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(0, 245, 255, 0.1);
    border-radius: 15px;
    border: 2px solid rgba(0, 245, 255, 0.3);
}

.score-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.score-label {
    font-weight: bold;
    color: #00f5ff;
}

.score-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.score-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff8800, #ffaa00, #88ff00, #00ff88, #00f5ff);
    border-radius: 5px;
    transition: width 1s ease-out;
    animation: scorePulse 2s ease-in-out infinite;
}

@keyframes scorePulse {
    0%, 100% { box-shadow: 0 0 2px rgba(0, 245, 255, 0.2); }
    50% { box-shadow: 0 0 5px rgba(0, 245, 255, 0.3); }
}

.compatibility-badge {
    text-align: center;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
}

.compatibility-badge.high {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
    border: 2px solid #00ff88;
}

.compatibility-badge.medium {
    background: rgba(0, 136, 255, 0.2);
    color: #0088ff;
    border: 2px solid #0088ff;
}

.compatibility-badge.basic {
    background: rgba(255, 170, 0, 0.2);
    color: #ffaa00;
    border: 2px solid #ffaa00;
}

.compatibility-badge.limited {
    background: rgba(255, 136, 0, 0.2);
    color: #ff8800;
    border: 2px solid #ff8800;
}

/* Advanced Capabilities */
.advanced-capabilities {
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(136, 0, 255, 0.1);
    border-radius: 10px;
    border-left: 4px solid #8800ff;
}

.advanced-capabilities h4 {
    margin: 0 0 1rem 0;
    color: #8800ff;
    font-size: 1.1rem;
}

.capability-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.capability-tag {
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.capability-tag.enabled {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
    border: 1px solid #00ff88;
}

.capability-tag.disabled {
    background: rgba(255, 136, 0, 0.2);
    color: #ff8800;
    border: 1px solid #ff8800;
}

/* Texture Support */
.texture-support {
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(255, 0, 136, 0.1);
    border-radius: 10px;
    border-left: 4px solid #ff0088;
}

.texture-support h4 {
    margin: 0 0 1rem 0;
    color: #ff0088;
    font-size: 1.1rem;
}

.texture-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.texture-format {
    padding: 0.2rem 0.6rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 0.8rem;
    color: #ccc;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.texture-more {
    padding: 0.2rem 0.6rem;
    background: rgba(0, 245, 255, 0.2);
    border-radius: 10px;
    font-size: 0.8rem;
    color: #00f5ff;
    border: 1px solid #00f5ff;
    font-style: italic;
}

/* WebGPU Benefits */
.webgpu-benefits {
    margin: 2rem 0;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    border: 2px solid rgba(0, 245, 255, 0.4);
}

.webgpu-benefits h4 {
    margin: 0 0 1.5rem 0;
    color: #00f5ff;
    font-size: 1.3rem;
    text-align: center;
    text-shadow: 0 0 10px rgba(0, 245, 255, 0.5);
}

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

.benefit-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.benefit-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 245, 255, 0.2);
}

.benefit-icon {
    font-size: 2rem;
    min-width: 50px;
    text-align: center;
    filter: drop-shadow(0 0 5px rgba(0, 245, 255, 0.3));
}

.benefit-content strong {
    display: block;
    color: #00f5ff;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.benefit-content p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #ccc;
}

/* Standard message styling */
.adapter-info, .error-message, .browser-suggestion, .fallback-message {
    margin: 1rem 0;
    padding: 1rem;
    border-radius: 10px;
}

.adapter-info {
    background: rgba(0, 255, 136, 0.1);
    border-left: 4px solid #00ff88;
}

.error-message {
    background: rgba(255, 136, 0, 0.1);
    border-left: 4px solid #ff8800;
}

.browser-suggestion {
    background: rgba(0, 136, 255, 0.1);
    border-left: 4px solid #0088ff;
}

.browser-suggestion ul {
    margin: 0.5rem 0 0 1rem;
    padding: 0;
}

.browser-suggestion li {
    margin: 0.3rem 0;
    list-style-position: inside;
}

.fallback-message {
    background: rgba(136, 255, 0, 0.1);
    border-left: 4px solid #88ff00;
}

.fallback-message ul {
    margin: 0.5rem 0 0 1rem;
    padding: 0;
}

.fallback-message li {
    margin: 0.3rem 0;
    list-style-position: inside;
}

.detection-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.performance-note {
    font-size: 1.1rem;
    font-weight: 500;
    color: #c0c0c0;
    animation: glow 3s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 20px rgba(0, 245, 255, 0.5); }
    to { text-shadow: 0 0 30px rgba(0, 245, 255, 0.8); }
}

/* Random Exit Animations */
.webgpu-detection-container.animate-out {
    animation-duration: 1s;
    animation-fill-mode: forwards;
    animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Fade Animations */
.webgpu-detection-container.fadeOutUp {
    animation-name: fadeOutUp;
}

@keyframes fadeOutUp {
    to {
        opacity: 0;
        transform: translateY(-100vh) scale(0.8);
    }
}

.webgpu-detection-container.fadeOutDown {
    animation-name: fadeOutDown;
}

@keyframes fadeOutDown {
    to {
        opacity: 0;
        transform: translateY(100vh) scale(0.8);
    }
}

.webgpu-detection-container.fadeOutLeft {
    animation-name: fadeOutLeft;
}

@keyframes fadeOutLeft {
    to {
        opacity: 0;
        transform: translateX(-100vw) scale(0.8);
    }
}

.webgpu-detection-container.fadeOutRight {
    animation-name: fadeOutRight;
}

@keyframes fadeOutRight {
    to {
        opacity: 0;
        transform: translateX(100vw) scale(0.8);
    }
}

/* Scale Animations */
.webgpu-detection-container.zoomOut {
    animation-name: zoomOut;
}

@keyframes zoomOut {
    to {
        opacity: 0;
        transform: scale(0) rotate(180deg);
    }
}

/* Rotation Animations */
.webgpu-detection-container.rotateOut {
    animation-name: rotateOut;
}

@keyframes rotateOut {
    to {
        opacity: 0;
        transform: rotate(360deg) scale(0);
    }
}

/* Flip Animations */
.webgpu-detection-container.flipOutX {
    animation-name: flipOutX;
}

@keyframes flipOutX {
    to {
        opacity: 0;
        transform: perspective(400px) rotateX(90deg) scale(0.8);
    }
}

.webgpu-detection-container.flipOutY {
    animation-name: flipOutY;
}

@keyframes flipOutY {
    to {
        opacity: 0;
        transform: perspective(400px) rotateY(90deg) scale(0.8);
    }
}

/* Bounce Animation */
.webgpu-detection-container.bounceOut {
    animation-name: bounceOut;
}

@keyframes bounceOut {
    0% { transform: scale(1); }
    25% { transform: scale(0.95); }
    50% { transform: scale(1.1); }
    75% { transform: scale(0.9); }
    100% {
        opacity: 0;
        transform: scale(0);
    }
}

/* Special Space Animation */
.webgpu-detection-container.slideOutToSpace {
    animation-name: slideOutToSpace;
}

@keyframes slideOutToSpace {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 0.7;
    }
    100% {
        opacity: 0;
        transform: scale(0.1) rotate(720deg) translateY(-200vh);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .webgpu-detection-container {
        padding: 0.5rem;
    }

    .detection-content {
        padding: 1.5rem;
        width: 95%;
        max-height: 90vh;
        min-height: 60vh;
    }

    .status-icon {
        font-size: 2.8rem;
    }

    .status-title {
        font-size: 1.4rem;
    }

    .capability-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .benefits-grid {
        grid-template-columns: 1fr;
    }

    .webgpu-benefits {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .webgpu-detection-container {
        padding: 0.25rem;
    }

    .detection-content {
        padding: 1rem;
        width: 98%;
        max-height: 95vh;
        min-height: 50vh;
    }

    .status-icon {
        font-size: 2.2rem;
    }

    .status-title {
        font-size: 1.2rem;
    }

    .detection-header {
        margin-bottom: 1.5rem;
    }

    .webgpu-benefits {
        padding: 1rem;
        margin: 1rem 0;
    }

    .capability-item {
        padding: 0.8rem;
    }

    .benefit-item {
        padding: 0.8rem;
        gap: 0.8rem;
    }
}

@media (max-height: 600px) {
    .detection-content {
        max-height: 95vh;
        min-height: 80vh;
        padding: 1rem;
    }

    .detection-header {
        margin-bottom: 1rem;
    }

    .webgpu-benefits {
        margin: 1rem 0;
    }
}