/**
 * Sticky Bottom Bar - Frontend Styles
 */

.esbb-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background-color: #ffffff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    border-top: 1px solid #e0e0e0;
    padding: 0;
    margin: 0;
    display: flex;
}

.esbb-button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 5px;
    text-decoration: none;
    color: #333333;
    background-color: #ffffff;
    border: none;
    border-right: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    min-height: 60px;
    position: relative;
}

.esbb-button:last-child {
    border-right: none;
}

.esbb-button:hover {
    background-color: #f5f5f5;
    text-decoration: none;
    color: inherit;
}

.esbb-button:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px #007cba;
}

/* Buttons with no action */
.esbb-button[data-esbb-no-action="true"] {
    cursor: default;
}

.esbb-button[data-esbb-no-action="true"]:hover {
    background-color: inherit;
}

.esbb-button i,
.esbb-icon {
    font-size: var(--esbb-icon-size, 18px);
    margin-bottom: 4px;
    line-height: 1;
}

.esbb-custom-icon {
    width: var(--esbb-icon-size, 18px);
    height: var(--esbb-icon-size, 18px);
    margin-bottom: 4px;
    object-fit: contain;
}

.esbb-text {
    font-size: var(--esbb-text-size, 11px);
    line-height: 1.2;
    text-align: center;
    font-weight: 500;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Transparent background support */
.esbb-button.esbb-transparent {
    background-color: transparent !important;
    border-left: none !important;
    border-top: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
}

.esbb-button.esbb-transparent:last-child {
    border-right: none !important;
}

.esbb-button.esbb-transparent:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
}



/* Bold text support */
.esbb-text[style*="font-weight: bold"],
.esbb-button[style*="font-weight: bold"] .esbb-text {
    font-weight: bold !important;
}

/* Responsive adjustments - only adjust padding and min-height, preserve custom sizes */
@media (max-width: 480px) {
    .esbb-button {
        padding: 8px 3px;
        min-height: 55px;
    }
    
    /* Only apply fallback sizes if no custom properties are set */
    .esbb-button i:not([style*="font-size"]),
    .esbb-icon:not([style*="font-size"]) {
        font-size: var(--esbb-icon-size, 16px);
    }
    
    .esbb-custom-icon:not([style*="width"]) {
        width: var(--esbb-icon-size, 16px);
        height: var(--esbb-icon-size, 16px);
    }
    
    .esbb-text:not([style*="font-size"]) {
        font-size: var(--esbb-text-size, 10px);
    }
}

@media (max-width: 320px) {
    .esbb-button {
        padding: 6px 2px;
        min-height: 50px;
    }
    
    /* Only apply fallback sizes if no custom properties are set */
    .esbb-button i:not([style*="font-size"]),
    .esbb-icon:not([style*="font-size"]) {
        font-size: var(--esbb-icon-size, 14px);
    }
    
    .esbb-custom-icon:not([style*="width"]) {
        width: var(--esbb-icon-size, 14px);
        height: var(--esbb-icon-size, 14px);
    }
    
    .esbb-text:not([style*="font-size"]) {
        font-size: var(--esbb-text-size, 9px);
    }
}

/* Animation for bar appearance */
.esbb-bottom-bar {
    animation: esbb-slide-up 0.3s ease-out;
}

@keyframes esbb-slide-up {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Hide on scroll (optional - can be controlled via JavaScript) */
.esbb-hidden {
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}

/* Ensure content doesn't get hidden behind the bar */
body {
    padding-bottom: 60px;
}

@media (max-width: 480px) {
    body {
        padding-bottom: 55px;
    }
}

@media (max-width: 320px) {
    body {
        padding-bottom: 50px;
    }
}

/* RTL Support */
.rtl .esbb-bottom-bar {
    direction: rtl;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .esbb-bottom-bar {
        border-top: 2px solid #000000;
    }
    
    .esbb-button {
        border-right: 1px solid #000000;
    }
    
    .esbb-button:last-child {
        border-right: none;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .esbb-bottom-bar {
        animation: none;
    }
    
    .esbb-button {
        transition: none;
    }
    
    .esbb-hidden {
        transition: none;
    }
}

/* Device-specific display rules */
/* Default: Show on all devices, then hide based on media queries if device class is missing */

/* Desktop display (1024px and above) - hide if desktop class is missing */
@media (min-width: 1024px) {
    .esbb-bottom-bar:not(.esbb-show-on-desktop) {
        display: none !important;
    }
}

/* Tablet display (768px - 1023px) - hide if tablet class is missing */
@media (min-width: 768px) and (max-width: 1023px) {
    .esbb-bottom-bar:not(.esbb-show-on-tablet) {
        display: none !important;
    }
}

/* Mobile display (767px and below) - hide if mobile class is missing */
@media (max-width: 767px) {
    .esbb-bottom-bar:not(.esbb-show-on-mobile) {
        display: none !important;
    }
}

/* TRANSPARENCY RULES - Must be at the end to override other background rules */
/* Make the entire bar transparent when it contains transparent buttons */
#esbb-sticky-bottom-bar.esbb-bottom-bar:has(.esbb-button.esbb-transparent),
#esbb-sticky-bottom-bar.esbb-bottom-bar.esbb-has-transparent,
.esbb-bottom-bar:has(.esbb-button.esbb-transparent),
.esbb-bottom-bar.esbb-has-transparent {
    background-color: transparent !important;
    border-top: none !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
}

/* Extra specificity for stubborn cases */
div#esbb-sticky-bottom-bar.esbb-bottom-bar.esbb-has-transparent {
    background-color: transparent !important;
    background: transparent !important;
    border-top: none !important;
    box-shadow: none !important;
    border: none !important;
}