/**
 * Tara Quick Contact - Frontend Styles
 * Author: Hossam Ahmed
 * Website: https://tara.com.sa
 */

/* Container */
#tqc-floating-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    direction: ltr;
}

/* Default positioning for Arabic sites - Always on the right */
#tqc-floating-widget.tqc-position-bottom-right,
#tqc-floating-widget.tqc-position-bottom-left {
    bottom: 30px;
}

#tqc-floating-widget.tqc-position-top-right,
#tqc-floating-widget.tqc-position-top-left {
    top: 30px;
}

/* Right side positioning (default for Arabic) */
#tqc-floating-widget.tqc-position-bottom-right,
#tqc-floating-widget.tqc-position-top-right {
    right: 30px;
}

/* Left side positioning */
#tqc-floating-widget.tqc-position-bottom-left,
#tqc-floating-widget.tqc-position-top-left {
    left: 30px;
}

/* Overlay */
.tqc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999998; /* Lower than buttons so they remain clickable */
}

.tqc-overlay.tqc-active {
    opacity: 1;
    visibility: visible;
}

/* Buttons Base */
.tqc-button {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    border: none;
    outline: none;
    user-select: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    color: white;
}

.tqc-button:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

/* SVG Icons */
.tqc-button svg {
    width: 20px;
    height: 20px;
    z-index: 1;
    position: relative;
    transition: transform 0.3s ease;
    fill: currentColor;
}

/* Legacy Font Awesome support (fallback) */
.tqc-button i {
    font-size: 20px;
    z-index: 1;
    position: relative;
    transition: transform 0.3s ease;
}

/* Main Button */
.tqc-main-button {
    width: 60px;
    height: 60px;
    position: relative;
    transform-origin: center;
    z-index: 1000001; /* Higher than overlay to be clickable */
}

.tqc-main-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
}

.tqc-main-button:hover {
    transform: translateY(-3px) scale(1.05);
}

.tqc-main-button:active {
    transform: translateY(-1px) scale(0.98);
}

.tqc-main-button svg {
    width: 24px;
    height: 24px;
}

.tqc-main-button i {
    font-size: 24px;
}

.tqc-main-button.tqc-active svg,
.tqc-main-button.tqc-active i {
    transform: rotate(45deg);
}

/* Contact Options Container */
.tqc-contact-options {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 15px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000000; /* Higher than overlay to be clickable */
}

.tqc-contact-options.tqc-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Position variations */
.tqc-position-bottom-right .tqc-contact-options,
.tqc-position-bottom-left .tqc-contact-options {
    bottom: 75px;
}

.tqc-position-top-right .tqc-contact-options,
.tqc-position-top-left .tqc-contact-options {
    top: 75px;
}

.tqc-position-bottom-right .tqc-contact-options,
.tqc-position-top-right .tqc-contact-options {
    right: 0;
}

.tqc-position-bottom-left .tqc-contact-options,
.tqc-position-top-left .tqc-contact-options {
    left: 0;
}

/* Option Buttons */
.tqc-option-button {
    width: 50px;
    height: 50px;
    transform: translateX(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tqc-position-bottom-left .tqc-option-button,
.tqc-position-top-left .tqc-option-button {
    transform: translateX(-20px);
}

.tqc-contact-options.tqc-active .tqc-option-button {
    transform: translateX(0);
    opacity: 1;
}

/* Stagger animation */
.tqc-contact-options.tqc-active .tqc-option-button:nth-child(1) {
    transition-delay: 0.1s;
}

.tqc-contact-options.tqc-active .tqc-option-button:nth-child(2) {
    transition-delay: 0.15s;
}

.tqc-contact-options.tqc-active .tqc-option-button:nth-child(3) {
    transition-delay: 0.2s;
}

.tqc-contact-options.tqc-active .tqc-option-button:nth-child(4) {
    transition-delay: 0.25s;
}

.tqc-contact-options.tqc-active .tqc-option-button:nth-child(5) {
    transition-delay: 0.3s;
}

.tqc-contact-options.tqc-active .tqc-option-button:nth-child(6) {
    transition-delay: 0.35s;
}

.tqc-contact-options.tqc-active .tqc-option-button:nth-child(7) {
    transition-delay: 0.4s;
}

.tqc-contact-options.tqc-active .tqc-option-button:nth-child(8) {
    transition-delay: 0.45s;
}

/* Button hover effects */
.tqc-option-button:hover {
    transform: translateY(-2px) scale(1.1);
}

.tqc-option-button:hover svg,
.tqc-option-button:hover i {
    transform: rotate(10deg) scale(1.1);
}

/* Ripple effect */
.tqc-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}

.tqc-button:active::after {
    width: 60px;
    height: 60px;
}

/* Animations */
@keyframes tqc-pulse {
    0% {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), 0 0 0 0 currentColor;
    }
    70% {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), 0 0 0 15px transparent;
    }
    100% {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), 0 0 0 0 transparent;
    }
}

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

@keyframes tqc-shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

.tqc-animation-pulse {
    animation: tqc-pulse 3s infinite;
}

.tqc-animation-bounce {
    animation: tqc-bounce 2s infinite;
}

.tqc-animation-shake {
    animation: tqc-shake 3s infinite;
}

/* Tooltip */
.tqc-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
    top: 50%;
    transform: translateY(-50%);
}

/* Tooltip appears on the left for right-positioned widgets (Arabic default) */
.tqc-position-bottom-right .tqc-tooltip,
.tqc-position-top-right .tqc-tooltip {
    right: calc(100% + 12px);
}

/* Tooltip appears on the right for left-positioned widgets */
.tqc-position-bottom-left .tqc-tooltip,
.tqc-position-top-left .tqc-tooltip {
    left: calc(100% + 12px);
}

/* Add arrow for better UX */
.tqc-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
}

.tqc-position-bottom-right .tqc-tooltip::after,
.tqc-position-top-right .tqc-tooltip::after {
    left: 100%;
    border-width: 5px 0 5px 6px;
    border-color: transparent transparent transparent rgba(0, 0, 0, 0.85);
}

.tqc-position-bottom-left .tqc-tooltip::after,
.tqc-position-top-left .tqc-tooltip::after {
    right: 100%;
    border-width: 5px 6px 5px 0;
    border-color: transparent rgba(0, 0, 0, 0.85) transparent transparent;
}

.tqc-option-button:hover .tqc-tooltip {
    opacity: 1;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #tqc-floating-widget {
        bottom: 20px !important;
        right: 20px !important;
        left: auto !important;
        top: auto !important;
    }

    .tqc-main-button {
        width: 55px;
        height: 55px;
    }

    .tqc-main-button svg {
        width: 22px;
        height: 22px;
    }

    .tqc-main-button i {
        font-size: 22px;
    }

    .tqc-option-button {
        width: 45px;
        height: 45px;
    }

    .tqc-option-button svg {
        width: 18px;
        height: 18px;
    }

    .tqc-option-button i {
        font-size: 18px;
    }

    .tqc-contact-options {
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .tqc-main-button {
        width: 50px;
        height: 50px;
    }

    .tqc-main-button svg {
        width: 20px;
        height: 20px;
    }

    .tqc-main-button i {
        font-size: 20px;
    }

    .tqc-option-button {
        width: 42px;
        height: 42px;
    }

    .tqc-option-button svg {
        width: 16px;
        height: 16px;
    }

    .tqc-option-button i {
        font-size: 16px;
    }
}

/* Print */
@media print {
    #tqc-floating-widget {
        display: none !important;
    }
}

/* Accessibility */
.tqc-button:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 3px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .tqc-tooltip {
        background: rgba(255, 255, 255, 0.9);
        color: #000;
    }
}
