/**
 * TAMER AI Chatbots CSS
 * Professional styling for all three chatbot interfaces
 */

/* ==========================================================================
   CHATBOT CONTAINER
   ========================================================================== */

.tamer-chatbot-container {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
}

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

.chatbot-header h3 {
    margin: 0;
    font-size: 1.2em;
    font-weight: 600;
}

.chatbot-status {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   MESSAGES AREA
   ========================================================================== */

.chatbot-messages {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f5f5f5;
}

.chatbot-messages::-webkit-scrollbar {
    width: 8px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* ==========================================================================
   CHAT MESSAGES
   ========================================================================== */

.chat-message {
    display: flex;
    margin-bottom: 20px;
    animation: messageSlideIn 0.3s ease-out;
}

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

.user-message {
    justify-content: flex-end;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: 60px;
}

.bot-message .message-content {
    background: white;
    border: 1px solid #e0e0e0;
    margin-right: 60px;
    color: #333;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    flex-shrink: 0;
    margin: 0 10px;
}

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

.bot-message .message-avatar {
    background: #f0f0f0;
    color: #666;
    order: 1;
}

.message-content {
    padding: 15px;
    border-radius: 18px;
    max-width: 70%;
    word-wrap: break-word;
    position: relative;
}

.message-text {
    line-height: 1.5;
    margin-bottom: 5px;
}

.message-text h4, .message-text h5 {
    margin: 10px 0 5px 0;
    color: inherit;
}

.message-text ul, .message-text ol {
    margin: 10px 0;
    padding-left: 20px;
}

.message-text li {
    margin-bottom: 5px;
}

.message-time {
    font-size: 0.8em;
    opacity: 0.7;
    text-align: right;
}

/* ==========================================================================
   INPUT SECTION
   ========================================================================== */

.chatbot-input-section {
    display: flex;
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    background: white;
    border-radius: 0 0 12px 12px;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

.chatbot-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.chatbot-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.chatbot-send:active {
    transform: scale(0.95);
}

.chatbot-send::before {
    content: '▶';
}

/* ==========================================================================
   SUGGESTIONS & QUICK ACTIONS
   ========================================================================== */

.chatbot-suggestions {
    padding: 0 20px 20px 20px;
    background: white;
}

.quick-actions {
    margin-bottom: 15px;
}

.quick-actions h4 {
    margin: 0 0 10px 0;
    font-size: 0.9em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.suggestion-chip {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 8px 16px;
    margin: 5px 5px 5px 0;
    font-size: 0.9em;
    color: #495057;
    cursor: pointer;
    display: inline-block;
    transition: all 0.2s ease;
    border: none;
}

.suggestion-chip:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   TYPING INDICATOR
   ========================================================================== */

.typing-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 18px;
    border: 1px solid #e0e0e0;
    max-width: 70%;
    margin-right: 60px;
}

.typing-dots {
    display: flex;
    margin-right: 10px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    display: inline-block;
    margin: 0 2px;
    animation: typingDots 1.4s infinite ease-in-out;
}

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

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

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

.typing-indicator p {
    margin: 0;
    color: #666;
    font-size: 0.9em;
}

/* ==========================================================================
   ADMIN-SPECIFIC FEATURES
   ========================================================================== */

.caaap-upload-section {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
}

#upload-caaap-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#upload-caaap-btn:hover {
    background: #218838;
}

.caaap-data-display {
    background: #e8f4fd;
    border: 1px solid #bee5eb;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.caaap-data-display h4 {
    margin: 0 0 15px 0;
    color: #0c5460;
}

.caaap-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.caaap-item {
    background: white;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #d1ecf1;
}

.caaap-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.caaap-quick-analyze {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

.caaap-quick-analyze:hover {
    background: #0056b3;
}

.admin-tools {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.export-treatment-plan, .export-session-materials {
    background: #6f42c1;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 10px;
    margin-bottom: 10px;
    transition: background-color 0.3s ease;
}

.export-treatment-plan:hover, .export-session-materials:hover {
    background: #5a32a3;
}

.upload-progress {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #f1f3f4;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* ==========================================================================
   STUDENT-SPECIFIC FEATURES
   ========================================================================== */

.technique-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.technique-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.technique-card h4 {
    margin: 0 0 10px 0;
    color: #495057;
}

.technique-card p {
    margin: 0 0 15px 0;
    color: #6c757d;
    font-size: 0.9em;
}

.quick-action {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

.quick-action:hover {
    background: #138496;
}

.breathing-exercise {
    text-align: center;
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border-radius: 12px;
}

.breath-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    margin: 0 auto 15px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #333;
    transition: transform 4s ease-in-out;
}

.breath-circle.inhale {
    transform: scale(1.3);
    background: rgba(102, 126, 234, 0.3);
}

.breath-circle.hold {
    transform: scale(1.3);
    background: rgba(255, 193, 7, 0.3);
}

.breath-circle.exhale {
    transform: scale(1);
    background: rgba(40, 167, 69, 0.3);
}

.timeout-guide {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.timeout-guide h4 {
    margin: 0 0 15px 0;
    color: #856404;
}

.timeout-guide ol {
    margin: 0;
    padding-left: 20px;
}

.timeout-guide li {
    margin-bottom: 8px;
    color: #856404;
}

/* ==========================================================================
   VISITOR-SPECIFIC FEATURES
   ========================================================================== */

.resource-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 15px 0;
}

.resource-link {
    background: #e9ecef;
    color: #495057;
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    border-left: 4px solid #667eea;
}

.resource-link:hover {
    background: #dee2e6;
    transform: translateX(5px);
    text-decoration: none;
    color: #495057;
}

/* ==========================================================================
   PROFESSIONAL STYLING
   ========================================================================== */

.clinical-term {
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9em;
}

.risk-HIGH, .risk-CRITICAL {
    background: #ffebee;
    color: #c62828;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
}

.risk-MODERATE {
    background: #fff3e0;
    color: #f57c00;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
}

.risk-LOW {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
}

/* ==========================================================================
   DASHBOARD INTEGRATION
   ========================================================================== */

.tamer-ai-dashboard {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin: 20px 0;
}

.bot-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bot-card h2 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.3em;
}

.bot-stats {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
}

.bot-stats h3 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 1.1em;
}

.bot-stats ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bot-stats li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.bot-stats li:last-child {
    border-bottom: none;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    .tamer-chatbot-container {
        margin: 10px;
        border-radius: 8px;
    }
    
    .chatbot-header {
        padding: 15px;
        border-radius: 8px 8px 0 0;
    }
    
    .chatbot-messages {
        height: 300px;
        padding: 15px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .user-message .message-content {
        margin-left: 40px;
    }
    
    .bot-message .message-content {
        margin-right: 40px;
    }
    
    .chatbot-input-section {
        padding: 15px;
    }
    
    .suggestion-chip {
        display: block;
        margin-bottom: 10px;
        text-align: center;
    }
    
    .technique-cards {
        grid-template-columns: 1fr;
    }
    
    .caaap-summary {
        grid-template-columns: 1fr;
    }
    
    .caaap-quick-actions {
        flex-direction: column;
    }
    
    .tamer-ai-dashboard {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .chatbot-header h3 {
        font-size: 1em;
    }
    
    .chatbot-messages {
        height: 250px;
        padding: 10px;
    }
    
    .message-content {
        padding: 12px;
        max-width: 90%;
    }
    
    .chatbot-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .breath-circle {
        width: 80px;
        height: 80px;
    }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

.chatbot-input:focus,
.chatbot-send:focus,
.suggestion-chip:focus,
.quick-action:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.chat-message[aria-live] {
    /* Screen reader announcements */
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .tamer-chatbot-container {
        border: 2px solid #000;
    }
    
    .chatbot-header {
        background: #000;
        color: #fff;
    }
    
    .suggestion-chip {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .chat-message,
    .suggestion-chip,
    .chatbot-send,
    .breath-circle {
        animation: none;
        transition: none;
    }
    
    .typing-dots span {
        animation: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .tamer-chatbot-container {
        background: #1a1a1a;
        border-color: #333;
    }
    
    .chatbot-messages {
        background: #2a2a2a;
    }
    
    .bot-message .message-content {
        background: #333;
        border-color: #555;
        color: #fff;
    }
    
    .chatbot-input {
        background: #333;
        border-color: #555;
        color: #fff;
    }
    
    .chatbot-input::placeholder {
        color: #aaa;
    }
}