/**
 * Styles for Discko Button
 */

/* CSS Variables */
:root {
    --discko-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --discko-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --discko-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Main container */
#discko-button-container {
    position: fixed;
    z-index: 9999;
    user-select: none;
}

/* Floating button */
.discko-floating-button {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--discko-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--discko-transition);
    overflow: hidden;
    will-change: transform, box-shadow;
}

.discko-floating-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    pointer-events: none;
    user-select: none;
    box-sizing: border-box;
}

.discko-floating-button:hover {
    box-shadow: var(--discko-shadow-hover);
}

/* Subtle glow effect on hover */
.discko-floating-button::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    background: linear-gradient(45deg, rgba(255, 107, 53, 0.2), rgba(255, 107, 53, 0.4));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.discko-floating-button:hover::before {
    opacity: 1;
}

/* Hover animations */
.discko-floating-button[data-animation="pulse"] {
    animation: discko-pulse 2s infinite;
}

.discko-floating-button[data-animation="scale"]:hover {
    transform: scale(1.1) rotate(5deg);
}

.discko-floating-button[data-animation="bounce"]:hover {
    animation: discko-bounce 0.6s;
}

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

@keyframes discko-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Text bubble */
.discko-bubble {
    position: absolute;
    right: calc(100% + 15px);
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background-color: #6C5CE7;
    color: #fff;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    white-space: normal;
    width: max-content;
    max-width: 280px;
    box-shadow: var(--discko-shadow);
    opacity: 0;
    visibility: hidden;
    transition: var(--discko-transition);
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    text-align: left;
}

/* Bubble arrow - uses CSS variable defined by JS */
.discko-bubble::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid var(--bubble-color, #6C5CE7);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

/* Visible bubble */
.discko-bubble.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

/* Bubble positioning based on button corner */
/* When button is on LEFT corners → bubble on RIGHT side */
.discko-button-left .discko-bubble {
    right: auto;
    left: calc(100% + 15px);
    transform: translateY(-50%) translateX(-10px);
}

.discko-button-left .discko-bubble.visible {
    transform: translateY(-50%) translateX(0);
}

.discko-button-left .discko-bubble::after {
    right: auto;
    left: -8px;
    border-left: none;
    border-right: 8px solid var(--bubble-color, #6C5CE7);
}

/* Modal */
.discko-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--discko-transition);
}

.discko-modal.active {
    opacity: 1;
    visibility: visible;
}

/* Modal overlay */
.discko-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

/* Modal content */
.discko-modal-content {
    position: relative;
    width: var(--modal-desktop-width, 50%);
    max-width: 95vw;
    height: var(--modal-desktop-height, 60%);
    max-height: 95vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: visible;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

.discko-modal.active .discko-modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Close button - positioned on top right corner of modal */
.discko-modal-close {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(50%, -50%);
    width: 32px;
    height: 32px;
    border: 2px solid #fff;
    background: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    color: #fff;
    font-family: Arial, sans-serif;
    font-size: 18px;
    font-weight: 400;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
    transition: var(--discko-transition);
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.discko-modal-close::before {
    content: '×';
    display: block;
    line-height: 1;
    position: relative;
    top: -1px;
}

.discko-modal-close:hover {
    background: var(--modal-primary-color, #6C5CE7);
    border-color: var(--modal-primary-color, #6C5CE7);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.4);
    transform: translate(50%, -50%) rotate(90deg) scale(1.1);
}

.discko-modal-close:active {
    transform: translate(50%, -50%) rotate(90deg) scale(0.95);
}

/* Loader */
.discko-modal-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    z-index: 5;
}

.discko-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #6C5CE7;
    border-radius: 50%;
    animation: discko-spin 1s linear infinite;
}

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

/* Iframe */
.discko-modal-iframe {
    width: 100%;
    height: 100%;
    flex: 1;
    border: none;
    border-radius: 16px;
    overflow: hidden;
}

/* Responsive - Mobile */
@media screen and (max-width: 768px) {
    /* Smaller button on mobile */
    .discko-floating-button {
        width: 50px;
        height: 50px;
    }

    /* Bubble above button on mobile */
    .discko-bubble {
        right: auto;
        left: 50%;
        top: auto;
        bottom: calc(100% + 15px);
        transform: translateX(-50%) translateY(-10px);
        white-space: normal;
        min-width: 200px;
        max-width: 280px;
        text-align: center;
    }

    .discko-bubble::after {
        right: auto;
        left: 50%;
        top: auto;
        bottom: -8px;
        transform: translateX(-50%);
        border-left: 8px solid transparent;
        border-right: 8px solid transparent;
        border-top: 8px solid var(--bubble-color, #6C5CE7);
        border-bottom: none;
    }

    .discko-bubble.visible {
        transform: translateX(-50%) translateY(0);
    }

    /* Full screen modal on mobile */
    .discko-modal-content {
        width: var(--modal-mobile-width, 85vw);
        height: var(--modal-mobile-height, 50vh);
        max-height: none;
        border-radius: 12px;
    }

    .discko-modal-close {
        width: 36px;
        height: 36px;
        font-size: 24px;
    }
}

/* Responsive - Small screens */
@media screen and (max-width: 480px) {
    .discko-floating-button {
        width: 45px;
        height: 45px;
    }

    .discko-bubble {
        font-size: 13px;
        padding: 10px 14px;
        max-width: 180px;
    }
}

/* Accessibility - Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .discko-floating-button,
    .discko-bubble,
    .discko-modal,
    .discko-modal-content,
    .discko-modal-close,
    .discko-spinner {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }

    .discko-floating-button[data-animation] {
        animation: none !important;
        transform: none !important;
    }
}

/* Dark mode (if site uses it) */
@media (prefers-color-scheme: dark) {
    .discko-modal-content {
        background: #1e1e1e;
    }

    .discko-modal-close {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
    }

    .discko-modal-close:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    .discko-modal-loader {
        background: #1e1e1e;
    }
}
