/* Steppy AI Chatbot Widget - Modern UI Design */

:root {
    --steppy-primary: #667eea;
    --steppy-secondary: #764ba2;
    --steppy-shadow: 0 10px 40px rgba(102, 126, 234, 0.15);
    --steppy-shadow-hover: 0 15px 50px rgba(102, 126, 234, 0.25);
    --steppy-radius: 16px;
    --steppy-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Widget Container */
#steppy-chat-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

#steppy-chat-widget.bottom-right {
    bottom: 24px;
    right: 24px;
}

#steppy-chat-widget.bottom-left {
    bottom: 24px;
    left: 24px;
}

#steppy-chat-widget.top-right {
    top: 24px;
    right: 24px;
}

#steppy-chat-widget.top-left {
    top: 24px;
    left: 24px;
}

/* Chat Toggle Button */
.steppy-chat-button {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--steppy-primary) 0%, var(--steppy-secondary) 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    transition: var(--steppy-transition);
    position: relative;
    overflow: hidden;
}

.steppy-chat-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.steppy-chat-button:hover::before {
    opacity: 1;
}

.steppy-chat-button:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

.steppy-chat-button:active {
    transform: scale(1.02);
}

.steppy-chat-button .chat-icon {
    font-size: 32px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-4px); }
}

/* Notification Badge */
.steppy-chat-button::after {
    content: attr(data-unread);
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff4757;
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    display: none;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
}

.steppy-chat-button[data-unread]:not([data-unread=""])::after {
    display: block;
}

/* Chat Window */
.steppy-chat-window {
    display: none;
    position: fixed;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: slideUpFade 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(10px);
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#steppy-chat-widget.bottom-right .steppy-chat-window,
#steppy-chat-widget.bottom-left .steppy-chat-window {
    bottom: 100px;
    width: 400px;
    height: 650px;
    max-height: calc(100vh - 140px);
}

#steppy-chat-widget.bottom-right .steppy-chat-window {
    right: 0;
}

#steppy-chat-widget.bottom-left .steppy-chat-window {
    left: 0;
}

#steppy-chat-widget.top-right .steppy-chat-window,
#steppy-chat-widget.top-left .steppy-chat-window {
    top: 100px;
    width: 400px;
    height: 650px;
    max-height: calc(100vh - 140px);
}

#steppy-chat-widget.top-right .steppy-chat-window {
    right: 0;
}

#steppy-chat-widget.top-left .steppy-chat-window {
    left: 0;
}

.steppy-chat-window.active {
    display: flex;
    flex-direction: column;
}

/* Header */
.steppy-chat-header {
    background: linear-gradient(135deg, var(--steppy-primary) 0%, var(--steppy-secondary) 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.steppy-chat-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: headerGlow 10s linear infinite;
}

@keyframes headerGlow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.steppy-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.steppy-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.steppy-header-text h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.steppy-header-text p {
    margin: 4px 0 0 0;
    font-size: 13px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.steppy-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #44ff44;
    display: inline-block;
    box-shadow: 0 0 8px #44ff44;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.6;
        transform: scale(1.1);
    }
}

.steppy-close-btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--steppy-transition);
    position: relative;
    z-index: 1;
}

.steppy-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Messages Area */
.steppy-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
    scroll-behavior: smooth;
}

.steppy-message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    animation: messageSlide 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes messageSlide {
    from { 
        opacity: 0; 
        transform: translateY(20px) scale(0.95);
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1);
    }
}

.steppy-message.user {
    flex-direction: row-reverse;
}

.steppy-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.steppy-message.user .steppy-message-avatar {
    background: linear-gradient(135deg, var(--steppy-primary) 0%, var(--steppy-secondary) 100%);
    margin-left: 12px;
}

.steppy-message.bot .steppy-message-avatar {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    margin-right: 12px;
}

.steppy-message-content {
    max-width: 75%;
    padding: 14px 18px;
    border-radius: 18px;
    line-height: 1.6;
    word-wrap: break-word;
    font-size: 14px;
    position: relative;
}

.steppy-message.user .steppy-message-content {
    background: linear-gradient(135deg, var(--steppy-primary) 0%, var(--steppy-secondary) 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.steppy-message.bot .steppy-message-content {
    background: white;
    color: #2d3748;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.steppy-message-content strong {
    font-weight: 700;
}

.steppy-message-content ul {
    margin: 12px 0;
    padding-left: 20px;
}

.steppy-message-content li {
    margin: 8px 0;
}

/* Loading Animation */
.steppy-loading {
    display: flex;
    gap: 6px;
    padding: 12px;
    justify-content: center;
}

.steppy-loading span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--steppy-primary);
    animation: bounce 1.4s infinite ease-in-out both;
}

.steppy-loading span:nth-child(1) { animation-delay: -0.32s; }
.steppy-loading span:nth-child(2) { animation-delay: -0.16s; }
.steppy-loading span:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
    0%, 80%, 100% { 
        transform: scale(0);
        opacity: 0.5;
    }
    40% { 
        transform: scale(1);
        opacity: 1;
    }
}

/* Input Area */
.steppy-chat-input {
    padding: 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

/* Quick Actions */
.steppy-quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    overflow-x: auto;
    padding-bottom: 4px;
}

.steppy-quick-actions::-webkit-scrollbar {
    height: 4px;
}

.steppy-quick-actions::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 4px;
}

.steppy-quick-btn {
    background: white;
    border: 2px solid var(--steppy-primary);
    color: var(--steppy-primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--steppy-transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.steppy-quick-btn:hover {
    background: var(--steppy-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.steppy-quick-btn:active {
    transform: translateY(0);
}

/* Input Container */
.steppy-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.steppy-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: var(--steppy-transition);
    font-family: inherit;
    background: #f8f9fa;
}

.steppy-input:focus {
    border-color: var(--steppy-primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.steppy-input::placeholder {
    color: #a0aec0;
}

.steppy-send-btn {
    background: linear-gradient(135deg, var(--steppy-primary) 0%, var(--steppy-secondary) 100%);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--steppy-transition);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.steppy-send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.steppy-send-btn:active:not(:disabled) {
    transform: translateY(0);
}

.steppy-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Info Boxes */
.steppy-guest-info,
.steppy-user-info {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.steppy-guest-info {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border-left: 4px solid #ffc107;
}

.steppy-user-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0;
    border-left: 4px solid #2196f3;
}

.credits-info,
.subscription-info {
    margin: 0;
    font-weight: 600;
}

/* Admin Badge */
.steppy-admin-badge {
    margin-top: 14px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #000;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

/* System Warnings */
.steppy-system-warning {
    margin-top: 14px;
    padding: 12px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 8px;
    font-size: 13px;
    color: #856404;
}

.steppy-system-warning strong {
    display: block;
    margin-bottom: 6px;
}

.steppy-system-warning a {
    color: var(--steppy-primary);
    text-decoration: none;
    font-weight: 700;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s;
}

.steppy-system-warning a:hover {
    border-bottom-color: var(--steppy-primary);
}

/* Scrollbar Styling */
.steppy-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.steppy-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.steppy-chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--steppy-primary), var(--steppy-secondary));
    border-radius: 10px;
}

.steppy-chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--steppy-secondary), var(--steppy-primary));
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #steppy-chat-widget {
        bottom: 16px !important;
        right: 16px !important;
        left: 16px !important;
        top: auto !important;
    }
    
    .steppy-chat-button {
        width: 56px;
        height: 56px;
    }
    
    .steppy-chat-button .chat-icon {
        font-size: 28px;
    }
    
    .steppy-chat-window {
        width: 100% !important;
        height: calc(100vh - 100px) !important;
        max-height: calc(100vh - 100px) !important;
        bottom: 80px !important;
        left: 0 !important;
        right: 0 !important;
        border-radius: 20px 20px 0 0;
    }
    
    .steppy-message-content {
        max-width: 85%;
        font-size: 13px;
    }
    
    .steppy-chat-messages {
        padding: 16px;
    }
    
    .steppy-chat-input {
        padding: 16px;
    }
    
    .steppy-quick-actions {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Tablet */
@media (max-width: 768px) and (min-width: 481px) {
    .steppy-chat-window {
        width: 360px !important;
        height: 600px !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .steppy-chat-messages {
        background: linear-gradient(to bottom, #1a202c 0%, #2d3748 100%);
    }
    
    .steppy-message.bot .steppy-message-content {
        background: #2d3748;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .steppy-input {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .steppy-input:focus {
        background: #374151;
    }
    
    .steppy-chat-input {
        background: #1a202c;
        border-top-color: #4a5568;
    }
}

/* Accessibility */
.steppy-chat-button:focus,
.steppy-send-btn:focus,
.steppy-quick-btn:focus,
.steppy-input:focus {
    outline: 3px solid var(--steppy-primary);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    #steppy-chat-widget {
        display: none !important;
    }
}

/* Animation for new messages */
@keyframes newMessage {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.steppy-message.new {
    animation: newMessage 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Typing indicator enhancement */
.steppy-typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.steppy-typing-indicator span {
    font-size: 12px;
    color: #718096;
}