/* Mobile header improvements */

/* Tablet menu spacing optimization (1025px - 1200px) */
@media (min-width: 1025px) and (max-width: 1200px) {
    /* Reduce spacing between menu items */
    header #mainmenu > li {
        margin-left: 15px !important;
        margin-right: 0 !important;
    }

    header #mainmenu > li:first-child {
        margin-left: 0 !important;
    }

    /* Reduce menu item font size slightly */
    header #mainmenu a.menu-item {
        font-size: 14px !important;
        padding: 5px 8px !important;
    }
}

/* Tablet optimization (1025px - 1500px) */
@media (min-width: 1025px) and (max-width: 1500px) {
    /* Reduce logo image size on tablets */
    header .logo img {
        max-height: 45px !important;
    }

    /* Reduce logo text size on tablets */
    header .logo-text {
        font-size: 20px !important;
    }

    /* Reduce phone number size on tablets */
    header .de-flex-col.header-col-mid a.tel {
        font-size: 18px !important;
    }
}

/* Hide floating phone button on tablets and desktop */
@media (min-width: 1025px) {
    .floating-phone-btn {
        display: none !important;
    }

    /* Add proper padding to header on desktop */
    header {
        padding: 15px 0 !important;
    }

    header .container,
    header .container-fluid {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
}

/* Make header elements smaller on mobile */
@media (max-width: 1024px) {
    /* Use padding instead of margin for content spacing */
    #content {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    /* Fix header position on mobile - always fixed to prevent jumping */
    header,
    header.smaller,
    header.header-mobile,
    header.scroll-down,
    header.scroll-up {
        position: fixed !important;
        top: 0 !important;
        width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        padding: 8px 0 !important;
        height: auto !important;
        margin-top: 0 !important;
        border: none !important;
    }

    /* Transparent by default */
    header:not(.smaller) {
        background: transparent !important;
    }

    /* Dark background when scrolling - more specific selector */
    header.smaller {
        background: #1a1a1a !important;
    }

    /* Prevent container width changes that cause jumping */
    header .container,
    header .container-fluid {
        max-width: 100% !important;
        width: 100% !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
        margin: 0 !important;
    }

    /* Fix flex layout to prevent jumping */
    header .de-flex {
        min-height: 44px !important;
    }

    /* Disable all transitions that cause jumping */
    header,
    header *,
    header .de-flex,
    header .de-flex-col {
        transition: none !important;
    }

    /* Smaller logo on mobile */
    header .logo-mobile img {
        max-width: 35px !important;
        height: auto;
    }

    header .logo-text {
        font-size: 18px !important;
    }

    /* Hide phone number in header on mobile */
    header .de-flex-col.header-col-mid a.tel {
        display: none !important;
    }

    /* Make burger menu button larger and easier to tap - fixed position */
    #menu-btn {
        width: 30px !important;
        height: 30px !important;
        cursor: pointer;
        position: absolute !important;
        right: 15px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        z-index: 1000;
    }

    /* Adjust header padding on mobile */
    header .de-flex.sm-pt10 {
        padding-top: 5px !important;
        padding-bottom: 5px !important;
    }

    /* Ensure header row doesn't change */
    header .header-row {
        position: relative !important;
    }
}

/* Floating phone button - always visible */
.floating-phone-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #C6E76C;
    box-shadow: 0 4px 15px rgba(198, 231, 108, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #222;
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: pulse 2s infinite;
}

.floating-phone-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(198, 231, 108, 0.6);
    color: #222;
}

.floating-phone-btn i {
    font-size: 28px;
    animation: iconPulse 1.5s ease-in-out infinite;
}

/* Pulse animation for button shadow */
@keyframes pulse {
    0% {
        box-shadow: 0 4px 15px rgba(198, 231, 108, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(198, 231, 108, 0.7);
    }
    100% {
        box-shadow: 0 4px 15px rgba(198, 231, 108, 0.4);
    }
}

/* Pulse animation for phone icon */
@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Tooltip for desktop */
.floating-phone-btn::before {
    content: 'Call Us';
    position: absolute;
    right: 70px;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.floating-phone-btn:hover::before {
    opacity: 1;
}

/* Hide tooltip on mobile */
@media (max-width: 768px) {
    .floating-phone-btn::before {
        display: none;
    }

    .floating-phone-btn {
        bottom: 15px;
        right: 15px;
        width: 56px;
        height: 56px;
    }

    .floating-phone-btn i {
        font-size: 24px;
        animation: iconPulse 1.5s ease-in-out infinite;
    }
}
