/* =================================
   GLOBAL FLOATING BUTTON STYLES
   File: assets/css/floating-button.css
   ================================= */

/* Floating Apply Button - Global Visibility */
.floating-apply {
    position: fixed !important;
    bottom: 30px;
    right: 30px;
    width: 70px;
    height: 70px;
    background: var(--gradient-2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff !important;
    font-size: 28px;
    text-decoration: none !important;
    box-shadow: 0 10px 30px rgba(175, 77, 88, 0.4), 0 5px 15px rgba(175, 77, 88, 0.2);
    z-index: 99999 !important; /* Maximum z-index for global visibility */
    transition: all 0.3s ease;
    animation: floatButton 3s ease-in-out infinite;
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    cursor: pointer;
}

/* Floating Animation */
@keyframes floatButton {
    0%, 100% { 
        transform: translateY(0) scale(1); 
        box-shadow: 0 10px 30px rgba(175, 77, 88, 0.4), 0 5px 15px rgba(175, 77, 88, 0.2);
    }
    50% { 
        transform: translateY(-10px) scale(1.02); 
        box-shadow: 0 15px 35px rgba(175, 77, 88, 0.5), 0 8px 20px rgba(175, 77, 88, 0.3);
    }
}

/* Hover Effects */
.floating-apply:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 15px 40px rgba(175, 77, 88, 0.6), 0 8px 25px rgba(175, 77, 88, 0.4) !important;
    animation-play-state: paused;
    color: #ffffff !important;
    background: var(--gradient-2);
}

.floating-apply:active {
    transform: scale(1.05) !important;
    transition-duration: 0.1s;
}

/* Tooltip Styling - Fixed positioning and width */
.floating-apply-tooltip {
    position: absolute;
    right: 85px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #AF4D58 0%, #D68F41 100%);
    color: #ffffff;
    padding: 12px 18px;
    border-radius: 8px;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 100000;
    /* Fixed: Ensure minimum width and proper text rendering */
    min-width: max-content;
    width: auto;
    text-align: center;
    letter-spacing: 0.5px;
    /* Ensure it doesn't get cut off by viewport */
    max-width: calc(100vw - 120px);
}

/* Tooltip Arrow */
.floating-apply-tooltip::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid #D68F41;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

/* Show tooltip on hover */
.floating-apply:hover .floating-apply-tooltip {
    opacity: 1;
    visibility: visible;
    /* Ensure smooth transition */
    transform: translateY(-50%) translateX(0);
}

/* Responsive Design */
@media (max-width: 768px) {
    .floating-apply {
        width: 60px;
        height: 60px;
        font-size: 24px;
        bottom: 25px;
        right: 25px;
    }
    
    .floating-apply-tooltip {
        right: 75px;
        font-size: 13px;
        padding: 10px 15px;
        /* Adjust for smaller screens */
        max-width: calc(100vw - 100px);
    }
    
    .floating-apply-tooltip::after {
        border-left-width: 6px;
        border-top-width: 6px;
        border-bottom-width: 6px;
    }
}

@media (max-width: 480px) {
    .floating-apply {
        width: 55px;
        height: 55px;
        font-size: 22px;
        bottom: 20px;
        right: 20px;
    }
    
    /* Show tooltip on mobile but with adjusted sizing */
    .floating-apply-tooltip {
        right: 70px;
        font-size: 12px;
        padding: 8px 12px;
        max-width: calc(100vw - 90px);
        /* Ensure it doesn't overflow on very small screens */
        word-wrap: break-word;
        white-space: normal;
        text-align: center;
        line-height: 1.2;
    }
}

/* For very small screens, use a shorter text */
@media (max-width: 360px) {
    .floating-apply-tooltip {
        /* You can also change the text content via JavaScript for very small screens */
        font-size: 11px;
        padding: 6px 10px;
        max-width: calc(100vw - 80px);
    }
}

/* Ensure button stays above all content */
.floating-apply {
    pointer-events: all !important;
}

/* Override any potential conflicts */
body .floating-apply {
    position: fixed !important;
    z-index: 99999 !important;
}

/* Focus accessibility */
.floating-apply:focus {
    outline: 3px solid rgba(255, 255, 255, 0.6);
    outline-offset: 3px;
}

.floating-apply:focus:not(:focus-visible) {
    outline: none;
}

/* Print styles - hide when printing */
@media print {
    .floating-apply {
        display: none !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .floating-apply {
        border-color: rgba(255, 255, 255, 0.3);
        box-shadow: 0 10px 30px rgba(175, 77, 88, 0.5), 0 5px 15px rgba(0, 0, 0, 0.3);
    }
    
    .floating-apply:hover {
        box-shadow: 0 15px 40px rgba(175, 77, 88, 0.7), 0 8px 25px rgba(0, 0, 0, 0.4) !important;
    }
}

/* Ensure visibility over modal overlays and other high z-index elements */
.floating-apply {
    z-index: 2147483647 !important; /* Maximum possible z-index */
}

/* Additional fix for tooltip positioning issues */
.floating-apply:hover .floating-apply-tooltip {
    /* Force hardware acceleration for smoother rendering */
    transform: translateY(-50%) translateZ(0);
    will-change: opacity, visibility;
}