/* Public Stylesheet for AI Voice Agent - WooCommerce Widget */

/* Floating Launcher Button */
.aiva-launcher-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: #fff;
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.aiva-launcher-btn:hover {
    transform: scale(1.08) rotate(5deg);
    box-shadow: 0 12px 35px rgba(99, 102, 241, 0.6);
}

.aiva-launcher-icon .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
}

/* Pulsing effect around launcher */
.aiva-launcher-pulse {
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 50%;
    border: 2px solid rgba(168, 85, 247, 0.3);
    animation: aiva-pulsing 2s infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes aiva-pulsing {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

/* Main Widget Window Container */
.aiva-widget-container {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    height: 580px;
    z-index: 99998;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    animation: aiva-slideUp 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes aiva-slideUp {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.aiva-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Header UI */
.aiva-widget-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #311042 100%);
    color: #fff;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.aiva-bot-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aiva-avatar {
    font-size: 24px;
    background: rgba(255,255,255,0.15);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.aiva-title-box h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.aiva-status-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
}

.aiva-status-dot.online {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.aiva-status-text {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
}

.aiva-header-actions {
    display: flex;
    gap: 8px;
}

.aiva-icon-btn {
    background: transparent;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.aiva-icon-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.aiva-icon-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Chat Scroll Area */
.aiva-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

.aiva-chat-body::-webkit-scrollbar {
    width: 6px;
}

.aiva-chat-body::-webkit-scrollbar-track {
    background: transparent;
}

.aiva-chat-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 10px;
}

/* Message Bubbles */
.aiva-msg {
    display: flex;
    max-width: 82%;
    animation: aiva-popIn 0.3s ease;
}

@keyframes aiva-popIn {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.aiva-msg.bot {
    align-self: flex-start;
}

.aiva-msg.user {
    align-self: flex-end;
}

.aiva-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.5;
}

.bot .aiva-bubble {
    background: #fff;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.user .aiva-bubble {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

/* Product Recommendation Card Design */
.aiva-products-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 5px;
    width: 100%;
}

.aiva-product-card {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    display: flex;
    align-items: center;
    padding: 10px;
    gap: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.aiva-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

.aiva-prod-thumb {
    width: 65px;
    height: 65px;
    object-fit: cover;
    border-radius: 8px;
    background: #f1f5f9;
}

.aiva-prod-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.aiva-prod-info h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aiva-prod-price {
    font-size: 13px;
    font-weight: 700;
    color: #4f46e5;
}

.aiva-prod-link {
    font-size: 11px;
    color: #8b5cf6;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    margin-top: 2px;
}

.aiva-prod-link:hover {
    text-decoration: underline;
}

/* Footer Section */
.aiva-widget-footer {
    padding: 15px 20px 20px 20px;
    background: #f8fafc;
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.aiva-status-indicator {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
    text-align: center;
    min-height: 18px;
}

/* Microphone Area */
.aiva-mic-outer-wrapper {
    position: relative;
    width: 70px;
    height: 70px;
}

.aiva-mic-box {
    position: relative;
    width: 70px;
    height: 70px;
    z-index: 2;
}

.aiva-mic-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #fff;
    border: none;
    color: #6366f1;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.aiva-mic-btn:hover {
    color: #8b5cf6;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.25);
    transform: scale(1.04);
}

.aiva-mic-btn .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
}

/* Microphone Pulsing Waves in Listening/Speaking states */
.aiva-mic-ring, .aiva-mic-ring2 {
    position: absolute;
    top: 0;
    left: 0;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.15);
    pointer-events: none;
    display: none;
    z-index: 1;
}

/* Widget state styling triggers */
.aiva-widget-container.listening .aiva-mic-btn {
    background: linear-gradient(135deg, #ef4444 0%, #f43f5e 100%);
    color: #fff;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.45);
}

.aiva-widget-container.listening .aiva-mic-ring {
    display: block;
    background: rgba(239, 68, 68, 0.2);
    animation: aiva-ripple 1.5s infinite linear;
}

.aiva-widget-container.listening .aiva-mic-ring2 {
    display: block;
    background: rgba(239, 68, 68, 0.15);
    animation: aiva-ripple 1.5s infinite linear 0.75s;
}

.aiva-widget-container.speaking .aiva-mic-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.aiva-widget-container.speaking .aiva-mic-ring {
    display: block;
    background: rgba(16, 185, 129, 0.2);
    animation: aiva-ripple 1.5s infinite linear;
}

.aiva-widget-container.speaking .aiva-mic-ring2 {
    display: block;
    background: rgba(16, 185, 129, 0.15);
    animation: aiva-ripple 1.5s infinite linear 0.75s;
}

.aiva-widget-container.thinking .aiva-mic-btn {
    background: #cbd5e1;
    color: #64748b;
    box-shadow: none;
    animation: aiva-bounce 1s infinite alternate;
}

@keyframes aiva-ripple {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

@keyframes aiva-bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-8px); }
}

/* Fallback Keyboard Input wrapper */
.aiva-input-box {
    display: flex;
    width: 100%;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px;
    padding: 4px 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.aiva-input-box input {
    flex: 1;
    border: none !important;
    background: transparent;
    padding: 8px 10px;
    font-size: 13px;
    outline: none !important;
    box-shadow: none !important;
    color: #334155;
}

.aiva-send-btn {
    background: #6366f1;
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.aiva-send-btn:hover {
    background: #4f46e5;
}

.aiva-send-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Stop Audio Button */
.aiva-speech-controls {
    margin-top: 5px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.aiva-btn-small {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #ef4444;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.aiva-btn-small:hover {
    background: #fecaca;
    color: #dc2626;
}

.aiva-btn-small .dashicons {
    font-size: 13px;
    width: 13px;
    height: 13px;
}
