/* 
 * Usman Saif Portfolio Chat Widget Styles
 * Using unique us-widget- prefix to avoid conflicts.
 */

:root {
    --us-widget-primary: #0F172A; /* Slate (Secondary in Portfolio) */
    --us-widget-secondary: #1E293B; /* Light Slate */
    --us-widget-success: #2ecc71;
    --us-widget-accent: #00D2FF; /* Neon Blue Accent */
    --us-widget-text-dark: #1E293B;
    --us-widget-text-muted: #64748B;
    --us-widget-bg-light: #F1F5F9;
    --us-widget-white: #ffffff;
    --us-widget-radius: 12px;
    --us-widget-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    --us-widget-glass: rgba(255, 255, 255, 0.95);
}

/* Floating Button */
#us-widget-trigger {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background: var(--us-widget-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--us-widget-shadow);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9999;
    border: none;
    color: white;
    font-size: 24px;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
}

#us-widget-trigger:hover {
    transform: scale(1.1);
}

#us-widget-trigger:active {
    transform: scale(0.95);
}

/* Pulsing Online Dot */
.us-widget-status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: var(--us-widget-success);
    border: 2px solid white;
    border-radius: 50%;
}

.us-widget-status-dot::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    border: 2px solid var(--us-widget-success);
    opacity: 0;
    animation: us-widget-pulse 2s infinite;
}

@keyframes us-widget-pulse {
    0% { transform: scale(0.8); opacity: 0.8; }
    100% { transform: scale(2.4); opacity: 0; }
}

/* Chat Panel */
#us-widget-panel {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 130px);
    background: var(--us-widget-white);
    border-radius: var(--us-widget-radius);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    font-family: 'Inter', sans-serif;
}

#us-widget-panel.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Header */
.us-widget-header {
    background: linear-gradient(135deg, var(--us-widget-primary) 0%, #020617 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    position: relative;
}

.us-widget-avatar-container {
    position: relative;
    margin-right: 15px;
}

.us-widget-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.us-widget-header-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.us-widget-header-status {
    display: flex;
    align-items: center;
    font-size: 12px;
    opacity: 0.9;
}

.us-widget-mini-dot {
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    margin-right: 6px;
}

/* Close Button */
.us-widget-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    color: white;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: all 0.2s;
    z-index: 10001;
}

.us-widget-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.2);
}

/* Messages Area */
.us-widget-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fbff;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

/* Scrollbar */
.us-widget-messages::-webkit-scrollbar {
    width: 6px;
}

.us-widget-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.us-widget-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: us-widget-fade-in 0.3s ease;
}

@keyframes us-widget-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.us-widget-message-bot {
    align-self: flex-start;
    background: var(--us-widget-white);
    color: var(--us-widget-text-dark);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.us-widget-message-user {
    align-self: flex-end;
    background: var(--us-widget-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.us-widget-typing {
    padding: 10px 16px;
    background: var(--us-widget-white);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.us-widget-dot {
    width: 6px;
    height: 6px;
    background: #cbd5e0;
    border-radius: 50%;
    animation: us-widget-bounce 1.4s infinite ease-in-out both;
}

.us-widget-dot:nth-child(1) { animation-delay: -0.32s; }
.us-widget-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes us-widget-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Suggestion Chips */
.us-widget-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.us-widget-chip {
    background: rgba(13, 110, 253, 0.08);
    color: var(--us-widget-primary);
    border: 1px solid rgba(13, 110, 253, 0.2);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.us-widget-chip:hover {
    background: var(--us-widget-primary);
    color: white;
}

/* Footer & Input */
.us-widget-footer {
    padding: 0 20px 15px;
    background: #f8fbff;
}

.us-widget-input-container {
    background: var(--us-widget-white);
    border-radius: 30px;
    padding: 5px 5px 5px 20px;
    display: flex;
    align-items: center;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s;
}

.us-widget-input-container:focus-within {
    border-color: var(--us-widget-primary);
}

#us-widget-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 0;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
}

.us-widget-send {
    background: var(--us-widget-primary);
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.us-widget-send:hover {
    transform: scale(1.1);
}

.us-widget-response-time {
    text-align: center;
    font-size: 11px;
    color: var(--us-widget-text-muted);
    margin-top: 12px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #us-widget-panel {
        width: 100%;
        height: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    #us-widget-trigger.panel-open {
        display: none;
    }
}

/* Intent Results Styling */
.us-widget-result-title {
    font-weight: 700;
    margin-bottom: 5px;
    display: block;
    color: var(--us-widget-primary);
}

.us-widget-result-stat {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.us-widget-cta-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--us-widget-success);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    margin-top: 10px;
    font-size: 13px;
    transition: transform 0.2s;
}

.us-widget-cta-button:hover {
    transform: translateY(-2px);
    color: white;
}

.us-widget-nudge {
    font-style: italic;
    opacity: 0.8;
    margin-top: 5px;
    display: block;
    font-size: 12px;
}

.us-widget-about-media {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.us-widget-profile-img {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}
