/* Afagh AI Chat Widget Styles */
* {
    box-sizing: border-box;
}

/* Floating Chat Button */
.afagh-chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
    max-width: 60px;
    max-height: 60px;
    border-radius: 50% !important;
    background: var(--afagh-primary-color, #4CAF50);
    color: white;
    border: none;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    z-index: 999998;
    transition: all 0.3s ease;
    line-height: 1;
    overflow: hidden;
}
}

.afagh-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.afagh-chat-button.active {
    transform: scale(0.9);
}

/* Position variants */
.afagh-chat-button.bottom-left {
    right: auto;
    left: 20px;
}

.afagh-chat-button.top-right {
    bottom: auto;
    top: 20px;
}

.afagh-chat-button.top-left {
    bottom: auto;
    top: 20px;
    right: auto;
    left: 20px;
}

/* Chat Container */
.afagh-chat-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 999999;
    animation: slideUp 0.3s ease-out;
    direction: rtl;
}

.afagh-chat-container.active {
    display: flex;
}

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

/* Position variants for container */
.afagh-chat-container.bottom-left {
    right: auto;
    left: 20px;
}

.afagh-chat-container.top-right {
    bottom: auto;
    top: 90px;
}

.afagh-chat-container.top-left {
    bottom: auto;
    top: 90px;
    right: auto;
    left: 20px;
}

/* Chat Header */
.afagh-chat-header {
    background: linear-gradient(135deg, var(--afagh-primary-color, #4CAF50) 0%, var(--afagh-secondary-color, #45a049) 100%);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
}

.afagh-chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="teeth" patternUnits="userSpaceOnUse" width="20" height="20"><circle cx="10" cy="10" r="2" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23teeth)"/></svg>') repeat;
    opacity: 0.3;
}

.afagh-chat-header h3 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 5px 0;
    position: relative;
    z-index: 1;
}

.afagh-chat-header p {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
    position: relative;
    z-index: 1;
}

.afagh-chat-close {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background 0.2s;
}

.afagh-chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Messages Area */
.afagh-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.afagh-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.afagh-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.afagh-chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--afagh-primary-color, #4CAF50) 0%, var(--afagh-secondary-color, #45a049) 100%);
    border-radius: 10px;
}

.afagh-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--afagh-secondary-color, #45a049);
}

/* Welcome Message */
.afagh-welcome-message {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 2px solid #2196F3;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    margin-bottom: 10px;
}

.afagh-welcome-message h4 {
    color: #1976d2;
    margin: 0 0 10px 0;
    font-size: 16px;
}

.afagh-welcome-message p {
    color: #333;
    line-height: 1.6;
    margin: 0;
    font-size: 14px;
}

/* Messages */
.afagh-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease-in;
    font-size: 14px;
}

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

.afagh-user-message {
    background: linear-gradient(135deg, #2196F3 0%, #1976d2 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.afagh-bot-message {
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    border: 1px solid #ddd;
}

.afagh-message-info {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.afagh-source-badge {
    background: var(--afagh-primary-color, #4CAF50);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 9px;
}

/* Typing Indicator */
.afagh-typing-indicator {
    display: none;
    background: #f0f0f0;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 70px;
    align-self: flex-start;
}

.afagh-typing-indicator.active {
    display: block;
}

.afagh-typing-dots {
    display: flex;
    gap: 3px;
}

.afagh-typing-dots span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.afagh-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.afagh-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Error Message */
.afagh-error-message {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border: 1px solid #f44336;
    color: #c62828;
    padding: 12px;
    border-radius: 10px;
    text-align: center;
    font-size: 13px;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* Chat Input Area */
.afagh-chat-input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.afagh-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.afagh-message-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    background: #f8f9fa;
    font-family: inherit;
}

.afagh-message-input:focus {
    border-color: var(--afagh-primary-color, #4CAF50);
    background: white;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.afagh-send-button {
    background: linear-gradient(135deg, var(--afagh-primary-color, #4CAF50) 0%, var(--afagh-secondary-color, #45a049) 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.afagh-send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

.afagh-send-button:active {
    transform: translateY(0);
}

.afagh-send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Feedback Buttons */
.afagh-feedback-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.afagh-feedback-btn {
    background: white;
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.afagh-feedback-btn:hover {
    background: #f5f5f5;
    border-color: var(--afagh-primary-color, #4CAF50);
}

.afagh-feedback-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.afagh-feedback-btn.feedback-sent {
    background: var(--afagh-primary-color, #4CAF50);
    color: white;
    border-color: var(--afagh-primary-color, #4CAF50);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .afagh-chat-container {
        width: calc(100% - 20px);
        height: calc(100% - 100px);
        bottom: 10px;
        right: 10px;
        border-radius: 15px;
    }
    
    .afagh-chat-container.bottom-left {
        left: 10px;
        right: 10px;
    }
    
    .afagh-chat-button {
        bottom: 15px;
        right: 15px;
        width: 55px;
        height: 55px;
        font-size: 24px;
    }
    
    .afagh-chat-button.bottom-left {
        left: 15px;
    }
}

@media (max-width: 480px) {
    .afagh-chat-container {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        border-radius: 0;
    }
    
    .afagh-message {
        max-width: 85%;
    }
}
