/**
 * Button Fixes CSS for Vrindopnishad Website
 * This file enhances button functionality and fixes styling issues
 */

/* Fix tool-link to cover entire tool-item for better clickability */
.tool-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    cursor: pointer;
}

/* Make tool items look clickable */
.tool-item {
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.tool-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.tool-item:active {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}

/* Enhance language buttons */
.language-btn-tools {
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.language-btn-tools:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(255, 255, 255, 0.1);
}

.language-btn-tools:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(255, 255, 255, 0.1);
}

.language-btn-tools::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: -1;
    pointer-events: none;
}

.language-btn-tools:hover::before {
    transform: translateX(0);
}

/* Fix magnetic buttons *
.magnetic {
    position: relative;
    display: inline-block;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    user-select: none;
    overflow: hidden;
}*/

.magnetic::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 2;
}

.magnetic:hover::after {
    opacity: 1;
}

.magnetic.active::after {
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 40%);
    opacity: 1;
}

/* Fix form buttons */
.contact-form button,
#newsletter-form button {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.contact-form button::before,
#newsletter-form button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    /* transform: translateX(-100%); */
    transition: transform 0.3s ease;
    z-index: -1;
}

.contact-form button:hover::before,
#newsletter-form button:hover::before {
    transform: translateX(0);
}

/* Submitting form state */
.contact-form.submitting,
#newsletter-form.submitting {
    opacity: 0.7;
    pointer-events: none;
}

.contact-form.submitting button,
#newsletter-form.submitting button {
    position: relative;
}

.contact-form.submitting button::after,
#newsletter-form.submitting button::after {
    /* content: ''; */
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-top-color: transparent;
    border-radius: 50%;
    animation: button-loading-spinner 0.8s linear infinite;
}

@keyframes button-loading-spinner {
    from {
        transform: rotate(0turn);
    }
    to {
        transform: rotate(1turn);
    }
}

/* Fix mobile menu button */
.mobile-menu-btn {
    position: relative;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: visible !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.mobile-menu-btn:hover {
    transform: scale(1.1) rotate(15deg);
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

.mobile-menu-btn.active {
    transform: rotate(90deg);
}

.mobile-menu-btn svg {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-width: 24px !important;
    min-height: 24px !important;
}

/* Safari specific fixes for mobile-menu-btn */
@media not all and (min-resolution:.001dpcm) { 
    @supports (-webkit-appearance:none) {
        .mobile-menu-btn {
            visibility: visible !important;
            opacity: 1 !important;
            display: flex !important;
        }
        
        .mobile-menu-btn svg {
            visibility: visible !important;
            opacity: 1 !important;
            display: block !important;
        }
    }
}

/* Fix focus states for accessibility */
button:focus,
a:focus,
.tool-link:focus,
.tool-item:focus-within,
.magnetic:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Hide outline on mouse interaction, only show for keyboard navigation */
button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
.tool-link:focus:not(:focus-visible),
.tool-item:focus-within:not(:focus-visible),
.magnetic:focus:not(:focus-visible) {
    outline: none;
}

/* Enhanced press effect for all buttons */
button:active,
.btn:active,
.magnetic:active {
    transform: scale(0.95);
}

/* Fix z-index for proper layering */
.tools-menu {
    z-index: 10000;
}

.menu-overlay {
    z-index: 9999;
}

.mobile-menu-btn {
    z-index: 10001;
}

/* Enhancements for touch devices */
@media (hover: none) {
    .tool-item {
        transition: transform 0.3s ease, background-color 0.3s ease;
    }
    
    .tool-item:active {
        transform: translateY(-3px);
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    .language-btn-tools:active {
        background-color: rgba(255, 255, 255, 0.2);
    }
    
    .magnetic:active {
        transform: scale(0.95);
    }
}

/* Ensure tool-link covers the entire tool-item */
.tool-item {
    position: relative;
}

.tool-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

/* Fix any existing problems with navigation buttons */
nav a {
    position: relative;
    cursor: pointer;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: currentColor;
    transition: width 0.3s ease;
}

nav a:hover::after,
nav a.active::after {
    width: 100%;
}

/* Settings button pulse effect */
.tool-item[data-bg-color="#4A4A4A"]:last-child {
    position: relative;
    overflow: visible;
}

.tool-item[data-bg-color="#4A4A4A"]:last-child::after {
    content: '';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 10px;
    height: 10px;
    background-color: #D4AF37;
    border-radius: 50%;
    animation: settings-pulse 2s infinite;
}

@keyframes settings-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.7);
    }
    
    70% {
        transform: scale(1.3);
        box-shadow: 0 0 0 6px rgba(212, 175, 55, 0);
    }
    
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0);
    }
}

/* Settings NEW badge */
.settings-new-badge {
    display: inline-block;
    background-color: #D4AF37;
    color: #000;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
    animation: badge-blink 1.5s ease-in-out infinite alternate;
}

@keyframes badge-blink {
    0% {
        opacity: 0.7;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* Tooltip styling for settings button */
.has-tooltip {
    position: relative;
}

.has-tooltip::before {
    content: attr(title);
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 100;
    pointer-events: none;
}

.has-tooltip:hover::before {
    opacity: 1;
    visibility: visible;
} 