/* ==========================================================================
   Concept Solutions LLC - Toll-Free Web Call Widget Styles
   ========================================================================== */

/* Floating Launcher Button */
.webrtc-launcher-btn {
    position: fixed;
    bottom: 25px;
    right: 20px;
    z-index: 99990;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #032c7b 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    border-radius: 50px;
    padding: 12px 22px 12px 16px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(3, 44, 123, 0.45);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    user-select: none;
}

.webrtc-launcher-btn:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 12px 30px rgba(3, 44, 123, 0.6);
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
}

.webrtc-launcher-btn:active {
    transform: translateY(-1px) scale(0.98);
}

.webrtc-launcher-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.webrtc-launcher-icon svg {
    width: 20px;
    height: 20px;
    fill: #ffffff;
    animation: phoneWiggle 3s infinite ease-in-out;
}

@keyframes phoneWiggle {
    0%, 80%, 100% { transform: rotate(0deg); }
    85% { transform: rotate(-15deg); }
    90% { transform: rotate(15deg); }
    95% { transform: rotate(-10deg); }
}

.webrtc-pulse-ring {
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid #38bdf8;
    border-radius: 50%;
    animation: ringExpand 2s infinite cubic-bezier(0, 0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
}

@keyframes ringExpand {
    0% { transform: scale(0.9); opacity: 0.8; }
    100% { transform: scale(1.6); opacity: 0; }
}

.webrtc-launcher-text {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.2;
}

.webrtc-launcher-title {
    font-size: 14px;
    letter-spacing: 0.3px;
}

.webrtc-launcher-sub {
    font-size: 11px;
    font-weight: 500;
    color: #93c5fd;
}

/* Widget Popup Container */
.webrtc-widget-container {
    position: fixed;
    bottom: 85px;
    right: 25px;
    width: 360px;
    max-width: calc(100vw - 40px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 9999999;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.webrtc-widget-container.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.webrtc-widget-header {
    background: linear-gradient(135deg, #032c7b 0%, #1e40af 100%);
    color: #ffffff;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.webrtc-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.webrtc-header-logo {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.webrtc-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.webrtc-header-text p {
    margin: 3px 0 0;
    font-size: 12px;
    color: #93c5fd;
    display: flex;
    align-items: center;
    gap: 5px;
}

.webrtc-status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #10b981;
}

.webrtc-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.webrtc-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Body */
.webrtc-widget-body {
    padding: 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8fafc;
    min-height: 240px;
    justify-content: center;
}

.webrtc-intro-box {
    text-align: center;
}

.webrtc-intro-box h4 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}

.webrtc-intro-box p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
}

/* Mode Toggle */
.webrtc-mode-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.webrtc-mode-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin: 0;
}

.webrtc-toggle {
    appearance: none;
    width: 38px;
    height: 20px;
    background: #cbd5e1;
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
    outline: none;
}

.webrtc-toggle::before {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    background: #ffffff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
}

.webrtc-toggle:checked {
    background: #10b981;
}

.webrtc-toggle:checked::before {
    transform: translateX(18px);
}

/* Primary Action Buttons */
.webrtc-action-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.webrtc-btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

.webrtc-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.5);
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.webrtc-btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.35);
}

.webrtc-btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.5);
}

.webrtc-btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.webrtc-btn-secondary:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.webrtc-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Active Call State */
.webrtc-call-state {
    text-align: center;
    padding: 10px 0;
}

.webrtc-call-avatar {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 50%;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.15);
    animation: avatarPulse 1.5s infinite alternate;
}

@keyframes avatarPulse {
    0% { box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15); }
    100% { box-shadow: 0 0 0 12px rgba(59, 130, 246, 0.3); }
}

.webrtc-call-status-text {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px;
}

.webrtc-call-timer {
    font-family: 'Courier New', monospace;
    font-size: 20px;
    font-weight: 700;
    color: #032c7b;
    display: block;
    margin: 8px 0;
}

/* Audio Waveform Equalizer */
.webrtc-equalizer {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 5px;
    height: 24px;
    margin: 14px 0;
}

.webrtc-equalizer span {
    width: 4px;
    background: #10b981;
    border-radius: 2px;
    animation: eqBounce 0.6s infinite ease-in-out alternate;
}

.webrtc-equalizer span:nth-child(1) { height: 40%; animation-delay: 0.1s; }
.webrtc-equalizer span:nth-child(2) { height: 100%; animation-delay: 0.4s; }
.webrtc-equalizer span:nth-child(3) { height: 60%; animation-delay: 0.2s; }
.webrtc-equalizer span:nth-child(4) { height: 80%; animation-delay: 0.5s; }
.webrtc-equalizer span:nth-child(5) { height: 50%; animation-delay: 0.3s; }

@keyframes eqBounce {
    0% { height: 15%; }
    100% { height: 100%; }
}

/* In-call Action Buttons Row */
.webrtc-incall-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.webrtc-ctrl-btn {
    flex: 1;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.webrtc-ctrl-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.webrtc-ctrl-btn.active {
    background: #fee2e2;
    border-color: #ef4444;
    color: #dc2626;
}

/* DTMF Keypad (Inline in popup) */
.webrtc-dtmf-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 12px;
    background: #ffffff;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.webrtc-dtmf-key {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    cursor: pointer;
    transition: background 0.15s;
}

.webrtc-dtmf-key:hover {
    background: #e2e8f0;
}

.webrtc-dtmf-key:active {
    background: #032c7b;
    color: white;
}

/* Error / Troubleshooting State */
.webrtc-error-box {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}

.webrtc-error-box h5 {
    color: #dc2626;
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 700;
}

.webrtc-error-box p {
    color: #7f1d1d;
    font-size: 12px;
    margin: 0 0 12px;
    line-height: 1.4;
}

/* Footer note */
.webrtc-widget-footer {
    padding: 12px 20px;
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    font-size: 11px;
    color: #64748b;
}

.webrtc-widget-footer a {
    color: #032c7b;
    text-decoration: none;
    font-weight: 600;
}

/* Utility */
.webrtc-hidden {
    display: none !important;
}

/* Responsive for mobile */
@media (max-width: 480px) {
    .webrtc-widget-container {
        left: 15px;
        right: 15px;
        width: calc(100vw - 30px);
        bottom: 80px;
    }
    .webrtc-launcher-btn {
        right: 15px;
        bottom: 20px;
    }
}

/* Force external chatbot sparkle widget above the Call button */
#chatWrapper, #chatBox, #chatbot-widget-container, .chatbot-container, #chatbotContainer, [class*="chatbot"], [id*="chatWrapper"] {
    bottom: 114px !important;
    right: 25px !important;
}

@media (max-width: 480px) {
    #chatWrapper, #chatBox, #chatbot-widget-container, .chatbot-container, #chatbotContainer, [class*="chatbot"], [id*="chatWrapper"] {
        bottom: 111px !important;
        right: 20px !important;
    }
}
