/* SmartReplyr Widget Styles */

:root {
    --sr-primary: #6C5CE7;
    --sr-bg: #ffffff;
    --sr-text: #1e293b;
    --sr-border: #e2e8f0;
    --sr-muted: #94a3b8;
    --sr-user-msg: rgba(108, 92, 231, 0.1);
}

#smartreplyr-widget-root {
    position: fixed;
    z-index: 999999;
    bottom: 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#smartreplyr-widget-root.bottom-right { right: 20px; }
#smartreplyr-widget-root.bottom-left { left: 20px; }

.sr-hidden { display: none !important; }

/* Updated Circular HD Launcher */
.sr-widget-trigger {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    border: none;
    outline: none;
    position: relative;
    z-index: 2; 
    color: white;
}

.sr-widget-trigger::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: rgba(99,102,241,0.2);
    animation: sr-launcher-glow 2s infinite;
    z-index: -1;
}

@keyframes sr-launcher-glow {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 0.4; }
    100% { transform: scale(1); opacity: 0.8; }
}

.sr-widget-trigger:active {
    transform: scale(0.92);
}

.sr-widget-trigger svg { width: 32px; height: 32px; fill: #ffffff !important; }
.sr-widget-trigger .close-icon { display: none; }
.is-open .sr-widget-trigger .chat-icon { display: none; }
.is-open .sr-widget-trigger .close-icon { display: block; }
.is-open .sr-widget-trigger { transform: rotate(90deg) scale(0.9) !important; box-shadow: none; }

.sr-icon {
    pointer-events: none;
    transition: all 0.3s ease;
}

/* Chat Window */
.sr-widget-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 360px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background: var(--sr-bg);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.bottom-left .sr-widget-window { left: 0; right: auto; }

.is-open .sr-widget-window {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Header */
.sr-widget-header {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.sr-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border: 2px solid rgba(255,255,255,0.2);
}

.sr-online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #22c55e;
    border: 2px solid white;
    border-radius: 50%;
}

.sr-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sr-header-info h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; color: white; }
.sr-header-info p { margin: 0; font-size: 12px; opacity: 0.9; }

/* Body Area */
.sr-widget-body {
    flex: 1;
    overflow-y: auto;
    position: relative;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
}

/* Form View */
.sr-form-view {
    padding: 24px;
    background: white;
    height: 100%;
}

.sr-intro-text {
    font-size: 14px;
    color: var(--sr-muted);
    line-height: 1.5;
    margin-bottom: 20px;
    text-align: center;
}

.sr-form-group {
    margin-bottom: 16px;
}

.sr-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.sr-form-group input, .sr-form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    color: #1e293b !important;
    background: #fff !important;
}

.sr-form-group input:focus {
    border-color: var(--sr-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.sr-gdpr-check {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: flex-start;
}
.sr-gdpr-check input { margin-top: 3px; cursor: pointer; }
.sr-gdpr-check label { font-size: 11px; color: var(--sr-muted); line-height: 1.4; cursor: pointer; }

.sr-submit-lead {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sr-submit-lead:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(99,102,241,0.3);
}
.sr-submit-lead:disabled { opacity: 0.7; cursor: not-allowed; }

.sr-loader {
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: sr-spin 0.8s linear infinite;
}
@keyframes sr-spin { to { transform: rotate(360deg); } }

/* Security Badge */
.sr-security-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed #e2e8f0;
    color: #94a3b8;
    font-size: 11px;
}
.sr-security-badge svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Success State */
.sr-success-view {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sr-success-state {
    text-align: center;
    padding: 30px;
    animation: sr-fadeUp 0.5s ease;
}

.sr-success-icon {
    width: 64px; height: 64px;
    background: #22c55e;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin: 0 auto 20px;
    box-shadow: 0 10px 20px rgba(34,197,94,0.2);
}

/* Chat interface */
.sr-chat-interface {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sr-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sr-message {
    max-width: 85%;
    font-size: 14px;
    line-height: 1.5;
    padding: 12px 16px;
    border-radius: 16px;
    animation: sr-fadeUp 0.3s ease forwards;
}

.sr-msg-bot {
    align-self: flex-start;
    background: white;
    color: var(--sr-text);
    border-radius: 16px 16px 16px 4px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid var(--sr-border);
}

.sr-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 4px 15px rgba(99,102,241,0.2);
}

@keyframes sr-fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.sr-typing { display: flex; gap: 4px; padding: 4px 0; }
.sr-typing span {
    width: 6px; height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: sr-bounce 1.4s infinite ease-in-out;
}
.sr-typing span:nth-child(1) { animation-delay: -0.32s; }
.sr-typing span:nth-child(2) { animation-delay: -0.16s; }
@keyframes sr-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.sr-chat-input-wrapper {
    background: white;
    border-top: 1px solid var(--sr-border);
    padding: 12px 16px;
}

.sr-chat-input {
    display: flex;
    gap: 10px;
    align-items: center;
}

.sr-chat-input input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--sr-border);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.sr-chat-input input:focus { border-color: var(--sr-primary); }

.sr-btn-send {
    background: transparent;
    border: none;
    color: var(--sr-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: transform 0.2s;
}
.sr-btn-send:hover { transform: scale(1.1); }
.sr-btn-send svg { width: 24px; height: 24px; fill: currentColor; transform: rotate(-10deg); }

.sr-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.sr-chip {
    background: white;
    border: 1px solid var(--sr-border);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    color: var(--sr-text);
    cursor: pointer;
    transition: all 0.2s;
}
.sr-chip:hover {
    border-color: var(--sr-primary);
    background: rgba(99,102,241,0.05);
    color: var(--sr-primary);
}

/* Mobile Perfection */
@media (max-width: 480px) {
    .sr-widget-window {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        width: 100% !important;
        height: 100% !important;
        max-height: none;
        border-radius: 0;
        transform: translateY(100%);
    }
    .is-open .sr-widget-window { transform: translateY(0); }
    .sr-widget-trigger { bottom: 20px; right: 20px; }
    .is-open .sr-widget-trigger { display: none; }
}
