/* ProSchool360 Chatbot Widget Styles */
.ps-chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Chat Toggle Button */
.ps-chat-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.ps-chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.ps-chat-toggle:active {
    transform: translateY(0);
}

.ps-chat-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.3s ease;
}

.ps-chat-toggle:hover::before {
    transform: scale(1);
}

.ps-chat-icon,
.ps-chat-close {
    color: white;
    transition: all 0.3s ease;
    position: absolute;
}

.ps-chat-close {
    opacity: 0;
    transform: rotate(90deg);
}

.ps-chatbot-widget.open .ps-chat-icon {
    opacity: 0;
    transform: rotate(-90deg);
}

.ps-chatbot-widget.open .ps-chat-close {
    opacity: 1;
    transform: rotate(0deg);
}

/* Chat Window */
.ps-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ps-chatbot-widget.open .ps-chat-window {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.ps-chatbot-widget.minimized .ps-chat-window {
    height: 60px;
    overflow: hidden;
}

/* Chat Header */
.ps-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
}

.ps-chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ps-chat-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.ps-chat-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.ps-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ps-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
}

.ps-chat-actions {
    display: flex;
    gap: 8px;
}

.ps-action-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.ps-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Messages Container */
.ps-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ps-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.ps-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ps-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

/* Messages */
.ps-message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: messageSlideIn 0.3s ease-out;
}

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

.ps-user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ps-message-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.ps-message-content {
    flex: 1;
}

.ps-message-text {
    background: white;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    color: #374151;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
}

.ps-user-message .ps-message-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ps-message-text ul {
    margin: 8px 0;
    padding-left: 20px;
}

.ps-message-text li {
    margin: 4px 0;
}

.ps-message-text strong {
    font-weight: 600;
}

.ps-message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    text-align: right;
}

.ps-user-message .ps-message-time {
    text-align: left;
}

/* Typing Indicator */
.ps-typing-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ps-typing-dots {
    display: flex;
    gap: 4px;
}

.ps-typing-dots span {
    width: 6px;
    height: 6px;
    background: #667eea;
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}

.ps-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.ps-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingDot {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.ps-typing-text {
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
}

/* Input Container */
.ps-chat-input-container {
    background: white;
    border-top: 1px solid #e5e7eb;
}

.ps-chat-input {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 12px;
}

#ps-chat-input-field {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    background: #f9fafb;
}

#ps-chat-input-field:focus {
    border-color: #667eea;
    background: white;
}

#ps-chat-input-field::placeholder {
    color: #9ca3af;
}

.ps-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ps-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.ps-send-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Responsive Design */
@media (max-width: 480px) {
    .ps-chatbot-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    .ps-chat-window {
        width: 100%;
        height: 70vh;
        max-height: 500px;
        bottom: 80px;
        right: 0;
        left: 0;
    }
    
    .ps-chat-toggle {
        position: absolute;
        right: 0;
        bottom: 0;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ps-chat-window {
        background: #1f2937;
    }
    
    .ps-chat-messages {
        background: #111827;
    }
    
    .ps-message-text {
        background: #374151;
        color: #f9fafb;
    }
    
    .ps-user-message .ps-message-text {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
    }
    
    .ps-typing-indicator,
    .ps-chat-input-container {
        background: #1f2937;
        border-color: #374151;
    }
    
    #ps-chat-input-field {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    #ps-chat-input-field:focus {
        background: #4b5563;
        border-color: #667eea;
    }
    
    #ps-chat-input-field::placeholder {
        color: #9ca3af;
    }
}

/* Animation for widget entrance */
.ps-chatbot-widget {
    animation: widgetEntrance 0.5s ease-out;
}

@keyframes widgetEntrance {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}