/**
 * Social Contact Buttons — Frontend Styles
 *
 * Styles for all three display modes: Floating, Fixed Bar, and Expandable FAB.
 * Uses CSS custom properties for easy customization.
 */

/* ============================================
   CSS Custom Properties (Defaults)
   ============================================ */

.scb-wrapper {
    --scb-btn-size: 48px;
    --scb-icon-size: 22px;
    --scb-btn-radius: 50%;
    --scb-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --scb-gap: 12px;
    --scb-z: 9990;
    --scb-offset: 24px;

    position: fixed;
    z-index: var(--scb-z);
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1;
    box-sizing: border-box;
}

.scb-wrapper *,
.scb-wrapper *::before,
.scb-wrapper *::after {
    box-sizing: border-box;
}

/* ============================================
   Position Variants
   ============================================ */

.scb-pos-bottom-right {
    bottom: var(--scb-offset);
    right: var(--scb-offset);
}

.scb-pos-bottom-left {
    bottom: var(--scb-offset);
    left: var(--scb-offset);
}

.scb-pos-right-center {
    right: var(--scb-offset);
    top: 50%;
    transform: translateY(-50%);
}

.scb-pos-left-center {
    left: var(--scb-offset);
    top: 50%;
    transform: translateY(-50%);
}

/* Fixed bar overrides position */
.scb-mode-fixed-bar.scb-pos-bottom-right,
.scb-mode-fixed-bar.scb-pos-bottom-left {
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
}

.scb-mode-fixed-bar.scb-pos-right-center {
    top: 0;
    bottom: 0;
    right: 0;
    left: auto;
    transform: none;
}

.scb-mode-fixed-bar.scb-pos-left-center {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    transform: none;
}

/* ============================================
   Button Base
   ============================================ */

.scb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--scb-btn-size);
    height: var(--scb-btn-size);
    border-radius: var(--scb-btn-radius);
    background: var(--scb-btn-bg, #333);
    color: var(--scb-btn-color, #fff);
    text-decoration: none;
    cursor: pointer;
    pointer-events: auto;
    transition: var(--scb-transition);
    box-shadow: 0 4px 14px var(--scb-btn-shadow, rgba(0, 0, 0, 0.2));
    position: relative;
    overflow: hidden;
    border: none;
    outline: none;
    flex-shrink: 0;
}

.scb-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0);
    transition: background 0.3s ease;
}

.scb-btn:hover::before {
    background: rgba(255, 255, 255, 0.15);
}

.scb-btn:active {
    transform: scale(0.92);
}

.scb-btn:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 3px;
}

/* Light mode shadow */
.scb-color-light .scb-btn {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.scb-color-light .scb-btn:hover::before {
    background: rgba(0, 0, 0, 0.05);
}

/* Button Icon */
.scb-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--scb-icon-size);
    height: var(--scb-icon-size);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.scb-btn-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.scb-custom-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Button Label */
.scb-btn-label {
    position: relative;
    z-index: 1;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    margin-left: 10px;
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   MODE 1: Floating Buttons
   ============================================ */

.scb-mode-floating .scb-floating-container {
    display: flex;
    flex-direction: column;
    gap: var(--scb-gap);
    align-items: flex-end;
}

.scb-pos-bottom-left .scb-floating-container,
.scb-pos-left-center .scb-floating-container {
    align-items: flex-start;
}

/* Entrance animation */
.scb-mode-floating .scb-btn {
    animation: scbFloatIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    animation-delay: var(--scb-delay, 0s);
}

@keyframes scbFloatIn {
    from {
        opacity: 0;
        transform: scale(0.3) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Hover: expand to show label */
.scb-mode-floating .scb-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px var(--scb-btn-shadow, rgba(0, 0, 0, 0.3));
}

.scb-mode-floating.scb-has-labels .scb-btn:hover {
    width: auto;
    padding: 0 18px 0 14px;
    border-radius: calc(var(--scb-btn-size) / 2);
}

.scb-mode-floating.scb-has-labels .scb-btn:hover .scb-btn-label {
    opacity: 1;
    max-width: 180px;
}

/* Pulse animation for first button */
.scb-mode-floating .scb-btn:first-child {
    animation: scbFloatIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both,
               scbPulse 2.5s ease-in-out 1.5s infinite;
}

@keyframes scbPulse {
    0%, 100% { box-shadow: 0 4px 14px var(--scb-btn-shadow, rgba(0, 0, 0, 0.2)); }
    50% { box-shadow: 0 4px 24px var(--scb-btn-shadow, rgba(0, 0, 0, 0.35)), 0 0 0 8px var(--scb-btn-shadow, rgba(0, 0, 0, 0.05)); }
}

/* ============================================
   MODE 2: Fixed Bar
   ============================================ */

.scb-mode-fixed-bar .scb-bar-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 8px 12px;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.08);
}

/* Horizontal bar (bottom positions) */
.scb-mode-fixed-bar.scb-pos-bottom-right .scb-bar-container,
.scb-mode-fixed-bar.scb-pos-bottom-left .scb-bar-container {
    flex-direction: row;
    width: 100%;
}

/* Vertical bar (side positions) */
.scb-mode-fixed-bar.scb-pos-right-center .scb-bar-container,
.scb-mode-fixed-bar.scb-pos-left-center .scb-bar-container {
    flex-direction: column;
    width: auto;
    height: auto;
    padding: 12px 8px;
    border-radius: 0;
}

.scb-mode-fixed-bar.scb-pos-right-center .scb-bar-container {
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.08);
}

.scb-mode-fixed-bar.scb-pos-left-center .scb-bar-container {
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.08);
}

/* Fixed bar buttons */
.scb-mode-fixed-bar .scb-btn {
    margin: 4px;
    box-shadow: 0 2px 8px var(--scb-btn-shadow, rgba(0, 0, 0, 0.12));
    animation: scbBarIn 0.4s ease both;
    animation-delay: var(--scb-delay, 0s);
}

@keyframes scbBarIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scb-mode-fixed-bar .scb-btn:hover {
    transform: scale(1.15) translateY(-3px);
    box-shadow: 0 6px 18px var(--scb-btn-shadow, rgba(0, 0, 0, 0.25));
}

/* Fixed bar labels */
.scb-mode-fixed-bar.scb-has-labels .scb-btn .scb-btn-label {
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #1d2327;
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    pointer-events: none;
    max-width: 150px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.scb-mode-fixed-bar.scb-has-labels .scb-btn .scb-btn-label::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1d2327;
}

.scb-mode-fixed-bar.scb-has-labels .scb-btn:hover .scb-btn-label {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Side bar labels positioning */
.scb-mode-fixed-bar.scb-pos-right-center.scb-has-labels .scb-btn .scb-btn-label {
    bottom: auto;
    left: auto;
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%) translateX(4px);
}

.scb-mode-fixed-bar.scb-pos-right-center.scb-has-labels .scb-btn .scb-btn-label::after {
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-left-color: #1d2327;
}

.scb-mode-fixed-bar.scb-pos-right-center.scb-has-labels .scb-btn:hover .scb-btn-label {
    transform: translateY(-50%) translateX(0);
}

.scb-mode-fixed-bar.scb-pos-left-center.scb-has-labels .scb-btn .scb-btn-label {
    bottom: auto;
    right: auto;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
}

.scb-mode-fixed-bar.scb-pos-left-center.scb-has-labels .scb-btn .scb-btn-label::after {
    top: 50%;
    right: 100%;
    left: auto;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #1d2327;
}

.scb-mode-fixed-bar.scb-pos-left-center.scb-has-labels .scb-btn:hover .scb-btn-label {
    transform: translateY(-50%) translateX(0);
}

/* ============================================
   MODE 3: Expandable FAB
   ============================================ */

.scb-mode-fab .scb-fab-container {
    pointer-events: auto;
    position: relative;
}

/* FAB Trigger Button */
.scb-fab-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(var(--scb-btn-size) + 12px);
    height: calc(var(--scb-btn-size) + 12px);
    border-radius: var(--scb-btn-radius);
    background: var(--scb-fab-bg, #0073aa);
    color: var(--scb-fab-color, #fff);
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    transition: var(--scb-transition);
    position: relative;
    z-index: 2;
    outline: none;
    animation: scbFabBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes scbFabBounce {
    from {
        opacity: 0;
        transform: scale(0);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scb-fab-trigger:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}

.scb-fab-trigger:active {
    transform: scale(0.95);
}

/* FAB icons */
.scb-fab-icon-open,
.scb-fab-icon-close {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.scb-fab-icon-open svg,
.scb-fab-icon-close svg {
    fill: currentColor;
}

.scb-fab-icon-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

/* Open state */
.scb-fab-container.is-open .scb-fab-trigger {
    transform: scale(1);
}

.scb-fab-container.is-open .scb-fab-icon-open {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.scb-fab-container.is-open .scb-fab-icon-close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* FAB Expandable Buttons Container */
.scb-fab-buttons {
    display: flex;
    flex-direction: column-reverse;
    gap: var(--scb-gap);
    position: absolute;
    bottom: calc(var(--scb-btn-size) + 24px);
    right: 6px;
    pointer-events: none;
    align-items: flex-end;
}

.scb-pos-bottom-left .scb-fab-buttons,
.scb-pos-left-center .scb-fab-buttons {
    right: auto;
    left: 6px;
    align-items: flex-start;
}

/* FAB child buttons — hidden by default */
.scb-fab-buttons .scb-btn {
    opacity: 0;
    transform: scale(0.3) translateY(20px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Open state: show buttons */
.scb-fab-container.is-open .scb-fab-buttons {
    pointer-events: auto;
}

.scb-fab-container.is-open .scb-fab-buttons .scb-btn {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Staggered animation delays for child buttons */
.scb-fab-container.is-open .scb-fab-buttons .scb-btn:nth-child(1) { transition-delay: 0.03s; }
.scb-fab-container.is-open .scb-fab-buttons .scb-btn:nth-child(2) { transition-delay: 0.06s; }
.scb-fab-container.is-open .scb-fab-buttons .scb-btn:nth-child(3) { transition-delay: 0.09s; }
.scb-fab-container.is-open .scb-fab-buttons .scb-btn:nth-child(4) { transition-delay: 0.12s; }
.scb-fab-container.is-open .scb-fab-buttons .scb-btn:nth-child(5) { transition-delay: 0.15s; }
.scb-fab-container.is-open .scb-fab-buttons .scb-btn:nth-child(6) { transition-delay: 0.18s; }
.scb-fab-container.is-open .scb-fab-buttons .scb-btn:nth-child(7) { transition-delay: 0.21s; }
.scb-fab-container.is-open .scb-fab-buttons .scb-btn:nth-child(8) { transition-delay: 0.24s; }
.scb-fab-container.is-open .scb-fab-buttons .scb-btn:nth-child(9) { transition-delay: 0.27s; }
.scb-fab-container.is-open .scb-fab-buttons .scb-btn:nth-child(10) { transition-delay: 0.30s; }
.scb-fab-container.is-open .scb-fab-buttons .scb-btn:nth-child(11) { transition-delay: 0.33s; }
.scb-fab-container.is-open .scb-fab-buttons .scb-btn:nth-child(12) { transition-delay: 0.36s; }

/* Close animation — immediate, no stagger */
.scb-fab-container:not(.is-open) .scb-fab-buttons .scb-btn {
    transition-delay: 0s;
}

/* FAB labels */
.scb-mode-fab.scb-has-labels .scb-fab-buttons .scb-btn {
    width: auto;
    padding: 0 16px 0 12px;
    border-radius: calc(var(--scb-btn-size) / 2);
}

.scb-mode-fab.scb-has-labels .scb-fab-buttons .scb-btn .scb-btn-label {
    opacity: 1;
    max-width: 180px;
}

/* Pulse animation for FAB trigger */
.scb-fab-trigger {
    animation: scbFabBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both,
               scbFabPulse 3s ease-in-out 2s infinite;
}

.scb-fab-container.is-open .scb-fab-trigger {
    animation: none;
}

@keyframes scbFabPulse {
    0%, 100% { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); }
    50% { box-shadow: 0 6px 30px rgba(0, 0, 0, 0.3), 0 0 0 10px rgba(0, 115, 170, 0.08); }
}

/* ============================================
   Rounded Square Shape Override
   ============================================ */

.scb-shape-rounded .scb-btn {
    border-radius: 12px;
}

.scb-shape-rounded .scb-fab-trigger {
    border-radius: 14px;
}

.scb-shape-rounded.scb-has-labels .scb-btn:hover,
.scb-shape-rounded.scb-has-labels .scb-fab-buttons .scb-btn {
    border-radius: 12px;
}

/* ============================================
   Mobile Responsive
   ============================================ */

.scb-hide-mobile {
    display: block;
}

@media (max-width: 768px) {
    .scb-hide-mobile {
        display: none !important;
    }

    .scb-wrapper {
        --scb-offset: 16px;
        --scb-gap: 10px;
    }

    /* Slightly smaller on mobile */
    .scb-wrapper {
        --scb-btn-size: 42px;
        --scb-icon-size: 20px;
    }

    .scb-fab-trigger {
        width: 52px !important;
        height: 52px !important;
    }

    /* Fixed bar takes full width on mobile */
    .scb-mode-fixed-bar.scb-pos-right-center .scb-bar-container,
    .scb-mode-fixed-bar.scb-pos-left-center .scb-bar-container {
        flex-direction: row;
        width: 100%;
        height: auto;
        padding: 8px 12px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
    }

    /* No hover expand on mobile for labels */
    .scb-mode-floating.scb-has-labels .scb-btn:hover {
        width: var(--scb-btn-size);
        padding: 0;
    }

    .scb-mode-floating.scb-has-labels .scb-btn:hover .scb-btn-label {
        opacity: 0;
        max-width: 0;
    }
}

/* ============================================
   Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .scb-btn,
    .scb-fab-trigger,
    .scb-fab-icon-open,
    .scb-fab-icon-close,
    .scb-fab-buttons .scb-btn,
    .scb-btn-label {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   WP Admin Bar Offset
   ============================================ */

body.admin-bar .scb-pos-right-center,
body.admin-bar .scb-pos-left-center {
    top: calc(50% + 16px);
}

/* ============================================
   Print: Hide Buttons
   ============================================ */

@media print {
    .scb-wrapper {
        display: none !important;
    }
}
