/**
 * Contact Button Bar - Frontend Styles
 */

/* Mobile: Add padding to body to prevent content blocking */
/* JavaScript will dynamically set this with exact height, but we provide a fallback */
@media (max-width: 768px) {
    body {
        /* Fallback padding - JavaScript will override with exact height */
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }
    
    /* Ensure footer and other bottom elements are visible */
    footer,
    .site-footer,
    .footer {
        margin-bottom: 0;
    }
}

/* Mobile: Bottom Bar (≤ 768px) */
.cbb-button-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    /* background-color: #ffffff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1); */
    z-index: 9999;
    /* padding: 12px 8px; */
    padding-bottom: max(12px, calc(12px + env(safe-area-inset-bottom)));
    gap: 4px;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

.cbb-button-bar.cbb-hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.cbb-button {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 6px 8px;
    min-height: 44px;
    text-decoration: none;
    color: #ffffff;
    border-radius: 60px 0 0 60px;
    transition: all 0.2s ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
}

.cbb-button:active {
    transform: scale(0.95);
}

.cbb-button-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.cbb-button-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
    stroke: currentColor;
}

/* Make email and form icons more visible */
.cbb-button-email .cbb-button-icon svg,
.cbb-button-form .cbb-button-icon svg {
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.95)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
    opacity: 0.95;
}

/* Custom icon base styles */
.cbb-button-icon .cbb-custom-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* SVG custom icons - color applied per-button via inline styles from PHP */
/* PNG custom icons - filter applied per-button via inline styles from PHP */

.cbb-button-label {
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-transform: uppercase;
}

.cbb-button:only-child .cbb-button-label {
    font-size: 12px;
}

/* Icon-only buttons */
.cbb-button-icon-only .cbb-button-icon {
    margin-bottom: 0;
}

/* Desktop: Vertical Sidebar (> 768px) */
@media (min-width: 769px) {
    .cbb-button-bar {
        position: fixed;
        left: auto;
        /* right: 20px; */
        top: 50%;
        transform: translateY(-50%);
        width: auto;
        flex-direction: column;
        background-color: transparent;
        /* box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        padding: 12px 8px; */
        border-radius: 12px;
        /* background-color: #ffffff; */
        gap: 8px;
        min-width: 60px;
    }

    .cbb-button-bar.cbb-hidden {
        transform: translateY(-50%) translateX(150%);
    }

    .cbb-button {
        flex: 0 0 auto;
        width: auto;
        min-width: 125px;
        padding: 6px 12px;
        min-height: 40px;
        /* border-radius: 10px; */
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .cbb-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .cbb-button:active {
        transform: translateY(0);
    }

    .cbb-button-icon {
        width: 20px;
        height: 20px;
        margin-bottom: 6px;
    }

    .cbb-button-label {
        font-size: 10px;
    }

    /* Show label on hover for desktop */
    .cbb-button:hover .cbb-button-label {
        display: block;
    }
}

/* Left side positioning */
@media (min-width: 769px) {
    .cbb-button-bar.cbb-side-left {
        left: 20px;
        right: auto;
    }
}

/* Tooltip Styles */
.cbb-button.cbb-has-tooltip {
    position: relative;
}

.cbb-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    padding: 6px 12px;
    background-color: #333;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cbb-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

/* Show tooltip on hover (desktop) */
@media (min-width: 769px) {
    .cbb-button.cbb-has-tooltip .cbb-tooltip {
        bottom: auto;
        top: 100%;
        margin-bottom: 0;
        margin-top: 8px;
    }
    
    .cbb-button.cbb-has-tooltip .cbb-tooltip::after {
        top: auto;
        bottom: 100%;
        border-top-color: transparent;
        border-bottom-color: #333;
    }
    
    .cbb-button.cbb-has-tooltip:hover .cbb-tooltip,
    .cbb-button.cbb-has-tooltip:focus .cbb-tooltip {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateX(-50%) translateY(4px);
        pointer-events: auto;
    }
}

/* Show tooltip on touch (mobile) - tap once to show, tap again to follow link */
@media (max-width: 768px) {
    .cbb-button.cbb-has-tooltip:active .cbb-tooltip,
    .cbb-button.cbb-has-tooltip:focus .cbb-tooltip {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(-4px);
    }
}

/* Accessibility */
.cbb-button:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.cbb-button:focus:not(:focus-visible) {
    outline: none;
}

/* Print styles */
@media print {
    .cbb-button-bar {
        display: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .cbb-button {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .cbb-button-bar,
    .cbb-button {
        transition: none;
    }
}

