/* Chatbot Styles for Website Integration */
:root {
    --chatbot-primary: #314e52;
    --chatbot-secondary: #314e52;
    --chatbot-accent: #314e52;
    --chatbot-light: #ecf0f1;
    --chatbot-dark: #2c3e50;
    --chatbot-success: #27ae60;
    --chatbot-warning: #f39c12;
    --chatbot-width: 350px;
    --chatbot-height: 500px;
}

/* Chatbot Icon */
.chatbot-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: transform 0.3s ease;
}

.chatbot-icon:hover {
    transform: scale(1.05);
}

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: var(--chatbot-width);
    height: var(--chatbot-height);
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.chatbot-container.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    color: white;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header .logo {
    display: flex;
    align-items: center;
}

.chat-header .logo i {
    font-size: 20px;
    margin-left: 10px;
}

.close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    margin-bottom: 10px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.bot-message {
    background: #f0f2f5;
    color: #333;
    border-top-left-radius: 5px;
    align-self: flex-start;
}

.user-message {
    background: var(--chatbot-secondary);
    color: white;
    border-top-right-radius: 5px;
    align-self: flex-end;
}

/* Chat Input */
.chat-input {
    display: flex;
    padding: 10px;
    border-top: 1px solid #eee;
    background: #f9f9f9;
}

.chat-input input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    margin-left: 10px;
}

.chat-input button {
    background: var(--chatbot-secondary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Options Container */
.options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.option-btn {
    background: var(--chatbot-light);
    color: var(--chatbot-dark);
    border: none;
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.option-btn:hover {
    background: #dde4e6;
}

/* Case Item */
.case-item {
    background: #f8f9fa;
    border-right: 4px solid var(--chatbot-secondary);
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
}

.case-info h3 {
    color: var(--chatbot-primary);
    font-size: 16px;
    margin-bottom: 5px;
}

.case-status {
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.status-open {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-pending {
    background: #ffecb3;
    color: #f57c00;
}

.status-judgment {
    background: #e3f2fd;
    color: #1976d2;
}

.status-closed {
    background: #ffcdd2;
    color: #c62828;
}

/* Appointment Form */
.appointment-form {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-top: 10px;
}

.appointment-form input,
.appointment-form select,
.appointment-form textarea {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.appointment-form button {
    background: var(--chatbot-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--chatbot-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Hidden Class */
.hidden {
    display: none;
}

/* Responsive Design */
@media (max-width: 480px) {
    :root {
        --chatbot-width: 90vw;
        --chatbot-height: 70vh;
    }
    
    .chatbot-container {
        right: 5vw;
    }
    
    .chatbot-icon {
        right: 5vw;
    }
}

/* RTL Support */
[dir="rtl"] .chatbot-icon {
    right: auto;
    left: 20px;
}

[dir="rtl"] .chatbot-container {
    right: auto;
    left: 20px;
}

[dir="rtl"] .chat-header .logo i {
    margin-left: 0;
    margin-right: 10px;
}

[dir="rtl"] .chat-input input {
    margin-left: 0;
    margin-right: 10px;
}

[dir="rtl"] .case-item {
    border-right: none;
    border-left: 4px solid var(--chatbot-secondary);
}

/* Enhanced case item styling */
.case-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 15px;
    margin: 10px 0;
    border-left: 4px solid var(--chatbot-primary);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.case-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border-left-color: var(--chatbot-secondary);
}

.case-item h3 {
    color: var(--chatbot-primary);
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
}

.case-item p {
    margin: 5px 0;
    color: #555;
    line-height: 1.4;
}

/* Success message styling */
.success-message {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #c3e6cb;
    color: #155724;
    border-radius: 12px;
    padding: 15px;
    margin: 10px 0;
    text-align: center;
    font-weight: 500;
}

/* Loading animation */
.loading-dots {
    display: inline-block;
    position: relative;
    margin-left: 5px;
    width: 20px;
    height: 1em;
}

.loading-dots::after {
    content: '...';
    animation: dots 1.5s infinite;
    display: inline-block;
    font-weight: bold;
    color: var(--chatbot-primary);
}

@keyframes dots {
    0%, 20% { opacity: 0; }
    40% { opacity: 1; }
    60% { opacity: 1; }
    80%, 100% { opacity: 1; }
}

@media (max-width: 480px) {
    [dir="rtl"] .chatbot-container {
        right: auto;
        left: 5vw;
    }
    
    [dir="rtl"] .chatbot-icon {
        right: auto;
        left: 5vw;
    }
}
