/**
 * Frontend styles for DBH Social Contact Widget
 */

/* ============================
   Widget Container
   ============================ */
.dbh-social-widget,
.dbh-social-single {
    position: fixed;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Position variants */
.dbh-social-widget--bottom-right {
    bottom: var(--dbh-offset-y, 20px);
    right: var(--dbh-offset-x, 20px);
}
.dbh-social-widget--bottom-left {
    bottom: var(--dbh-offset-y, 20px);
    left: var(--dbh-offset-x, 20px);
}
.dbh-social-widget--top-right {
    top: var(--dbh-offset-y, 20px);
    right: var(--dbh-offset-x, 20px);
}
.dbh-social-widget--top-left {
    top: var(--dbh-offset-y, 20px);
    left: var(--dbh-offset-x, 20px);
}

/* ============================
   Single-channel mode
   ============================ */
.dbh-social-single {
    width: var(--dbh-size, 56px);
    height: var(--dbh-size, 56px);
    border-radius: 50%;
    background-color: var(--dbh-ch-bg, #25D366);
    color: var(--dbh-ch-color, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.dbh-social-single:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}
.dbh-social-single:focus-visible {
    outline: 3px solid #005bb5;
    outline-offset: 3px;
}

/* ============================
   Toggle button
   ============================ */
.dbh-social-toggle {
    position: relative;
    width: var(--dbh-size, 56px);
    height: var(--dbh-size, 56px);
    border-radius: 50%;
    border: none;
    background-color: var(--dbh-toggle-bg, #7c3aed);
    color: var(--dbh-toggle-color, #fff);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}
.dbh-social-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}
.dbh-social-toggle:focus-visible {
    outline: 3px solid #005bb5;
    outline-offset: 3px;
}

/* Border styles */
.dbh-social-toggle--ring {
    box-shadow: 0 0 0 3px var(--dbh-toggle-border, #7c3aed), 0 4px 12px rgba(0, 0, 0, 0.15);
}
.dbh-social-toggle--solid {
    border: 3px solid var(--dbh-toggle-border, #7c3aed);
}

/* Icon swap */
.dbh-social-toggle__icon--open,
.dbh-social-toggle__icon--close {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease, transform 0.3s ease;
}
.dbh-social-toggle__icon--close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg);
}
.dbh-social-widget--open .dbh-social-toggle__icon--open {
    opacity: 0;
    transform: rotate(90deg);
}
.dbh-social-widget--open .dbh-social-toggle__icon--close {
    opacity: 1;
    transform: rotate(0deg);
}

/* Badge */
.dbh-social-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.dbh-social-widget--open .dbh-social-badge {
    display: none;
}

/* ============================
   Channel panel
   ============================ */
.dbh-social-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.dbh-social-widget--open .dbh-social-panel {
    pointer-events: auto;
    opacity: 1;
}

/* Channel link */
.dbh-social-channel {
    width: var(--dbh-size, 56px);
    height: var(--dbh-size, 56px);
    border-radius: 50%;
    background-color: var(--dbh-ch-bg);
    color: var(--dbh-ch-color);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.25s ease;
    opacity: 0;
    transform: scale(0.5);
}
.dbh-social-widget--open .dbh-social-channel {
    opacity: 1;
    transform: scale(1);
    transition-delay: var(--dbh-ch-delay, 0ms);
}
.dbh-social-channel:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.dbh-social-channel:focus-visible {
    outline: 3px solid #005bb5;
    outline-offset: 3px;
}

/* ============================
   Backdrop
   ============================ */
.dbh-social-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.15);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.dbh-social-backdrop--visible {
    opacity: 1;
    pointer-events: auto;
}

/* ============================
   Animations
   ============================ */
.dbh-social-animate-pulse {
    animation: dbh-social-pulse 2s ease-in-out infinite;
}
.dbh-social-animate-bounce {
    animation: dbh-social-bounce 1s ease infinite;
}
/* Stop animation when panel is open */
.dbh-social-widget--open.dbh-social-animate-pulse,
.dbh-social-widget--open.dbh-social-animate-bounce {
    animation: none;
}

@keyframes dbh-social-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
@keyframes dbh-social-bounce {
    0%, 20%, 53%, 80%, 100% { transform: translateY(0); }
    40%, 43% { transform: translateY(-6px); }
    70% { transform: translateY(-3px); }
}

/* ============================
   Reduced motion
   ============================ */
@media (prefers-reduced-motion: reduce) {
    .dbh-social-single,
    .dbh-social-toggle,
    .dbh-social-channel,
    .dbh-social-panel,
    .dbh-social-backdrop,
    .dbh-social-toggle__icon--open,
    .dbh-social-toggle__icon--close {
        transition: none !important;
        animation: none !important;
    }
}

/* ============================
   Print
   ============================ */
@media print {
    .dbh-social-widget,
    .dbh-social-single,
    .dbh-social-backdrop {
        display: none !important;
    }
}

/* ============================
   Mobile
   ============================ */
@media (max-width: 480px) {
    .dbh-social-widget,
    .dbh-social-single {
        --dbh-offset-x: 12px;
        --dbh-offset-y: 12px;
    }
}
