/* Floating Demo Button Component */

/* Main demo button container */
.floating-demo-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    font-family: 'Poppins', sans-serif;
}

/* Main demo button */
.floating-demo-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--error), var(--highlight));
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(11, 57, 84, 0.3);
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    /* Add a subtle border for better definition */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.floating-demo-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.6s;
}

.floating-demo-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(11, 57, 84, 0.4);
    text-decoration: none;
    color: white;
}

.floating-demo-button:hover::before {
    left: 100%;
}

.floating-demo-button.dismissed {
    transform: translateX(100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Demo button icon */
.demo-button-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color:white;
    /* Add a subtle drop shadow to make icon more prominent */
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* Demo button text */
.demo-button-text {
    flex: 1;
    white-space: nowrap;
    /* Improve text rendering */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* Close button for demo button */
.demo-button-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.demo-button-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.demo-button-close i {
    width: 12px;
    height: 12px;
    color: white;
}

/* Reveal button (appears after dismissal) */
.demo-reveal-button {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 48px;
    height: 48px;
    background: var(--error);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(11, 57, 84, 0.3);
    transition: all 0.3s ease;
    transform: scale(0);
    opacity: 0;
    visibility: hidden;
}

.demo-reveal-button.visible {
    transform: scale(1);
    opacity: 1;
    visibility: visible;
}

.demo-reveal-button:hover {
    background: var(--highlight);
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(11, 57, 84, 0.4);
}

.demo-reveal-button i {
    width: 20px;
    height: 20px;
    color: white;
}

/* Animations */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

@keyframes mobilePulse {
    0%, 90%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(11, 57, 84, 0.3);
    }
    95% {
        transform: scale(1.02);
        box-shadow: 0 6px 25px rgba(11, 57, 84, 0.4);
    }
}

/* Show animation */
.floating-demo-button.showing {
    animation: slideInFromRight 0.4s ease-out forwards;
}

/* Pulse animation for initial attention */
.floating-demo-button.pulse {
    animation: pulse 2s ease-in-out 3;
}

/* Responsive Design */
@media (max-width: 768px) {
    .floating-demo-container {
        bottom: 1.5rem;
        right: 1.5rem;
    }
    
    /* Keep the button expanded by default on mobile for better UX */
    .floating-demo-button {
        padding: 0.875rem 1.25rem;
        font-size: 0.85rem;
        gap: 0.5rem;
        border-radius: 25px;
        min-width: auto;
        max-width: calc(100vw - 3rem); /* Ensure it doesn't overflow */
    }
    
    /* Show text by default on mobile for better clarity */
    .demo-button-text {
        display: block;
        font-size: 0.85rem;
    }
    
    /* Close button is visible by default */
    .demo-button-close {
        display: flex;
        width: 20px;
        height: 20px;
        margin-left: 0.25rem;
    }
    
    .demo-button-close i {
        width: 10px;
        height: 10px;
    }
    
    /* Add a subtle animation to draw attention on mobile */
    .floating-demo-button {
        animation: mobilePulse 4s ease-in-out infinite;
        /* Delay the animation start to avoid immediate distraction */
        animation-delay: 2s;
    }
    
    .demo-reveal-button {
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 480px) {
    .floating-demo-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem; /* Allow button to use more space on very small screens */
    }
    
    .floating-demo-button {
        width: auto;
        min-width: 120px; /* Ensure minimum readable width */
        max-width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
        gap: 0.4rem;
        justify-content: center;
        text-align: center;
        /* Remove the mobile pulse on very small screens to reduce distraction */
        animation: none;
    }
    
    .demo-button-text {
        font-size: 0.8rem;
        font-weight: 700; /* Make text more prominent on small screens */
    }
    
    .demo-button-close {
        width: 18px;
        height: 18px;
        margin-left: 0.2rem;
    }
    
    .demo-button-close i {
        width: 8px;
        height: 8px;
    }
    
    .demo-reveal-button {
        width: 40px;
        height: 40px;
    }
    
    .demo-reveal-button i {
        width: 18px;
        height: 18px;
    }
}

/* High contrast and accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .floating-demo-button,
    .demo-reveal-button,
    .demo-button-close {
        transition: none;
    }
    
    .floating-demo-button.pulse {
        animation: none;
    }
    
    .floating-demo-button.showing {
        animation: none;
    }
}

/* Focus states for accessibility */
.floating-demo-button:focus,
.demo-reveal-button:focus,
.demo-button-close:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Print styles - hide the button when printing */
@media print {
    .floating-demo-container {
        display: none !important;
    }
}
