 /* Enhanced Chat Section Styles - Advanced Version */

/* Modern Mood Selection Section */
.mood-section {
    padding: 25px 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid rgba(79, 172, 254, 0.1);
    position: relative;
    overflow: hidden;
}

.mood-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(79, 172, 254, 0.05), 
        transparent);
    animation: moodSectionShimmer 4s infinite;
}

@keyframes moodSectionShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.mood-section h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.3em;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

/* Enhanced Mood Buttons */
.mood-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.mood-btn {
    padding: 12px 20px;
    border: 2px solid transparent;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.mood-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.8), 
        transparent);
    transition: left 0.5s ease;
}

.mood-btn:hover {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border-color: rgba(79, 172, 254, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.3);
}

.mood-btn:hover::before {
    left: 100%;
}

.mood-btn.active {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-color: rgba(40, 167, 69, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.mood-btn.active::before {
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent);
}

/* Enhanced Chat Container */
.chat-container {
    height: 420px;
    overflow-y: auto;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    position: relative;
    scroll-behavior: smooth;
}

.chat-container::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="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="20" cy="20" r="1" fill="%23000" opacity="0.02"/><circle cx="80" cy="40" r="1" fill="%23000" opacity="0.02"/><circle cx="40" cy="80" r="1" fill="%23000" opacity="0.02"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

/* Enhanced Chat Container Scrollbar */
.chat-container::-webkit-scrollbar {
    width: 12px;.ai-message
}

.chat-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    margin: 5px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-radius: 10px;
    border: 2px solid rgba(248, 249, 250, 0.5);
    transition: all 0.3s ease;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #3a9bfd 0%, #00d9fd 100%);
    transform: scale(1.1);
}

/* 🔧 IMPROVED: Enhanced Message Styles - Matching History Page Style */
.message {
    margin-bottom: 20px;
    max-width: 85%;
    position: relative;
    animation: messageSlideIn 0.4s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 12px 18px;
    border-radius: 18px 18px 5px 18px;
    margin-bottom: 10px;
    display: inline-block;
    max-width: 85%;
    margin-left: auto;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
    word-wrap: break-word;
    font-size: 16px;
    position: relative;
    overflow: hidden;
}

.user-message::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        transparent, 
        rgba(255, 255, 255, 0.1), 
        transparent);
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.user-message:hover::before {
    opacity: 1;
    animation: messageShine 0.8s ease-in-out;
}

@keyframes messageShine {
    0% { transform: rotate(45deg) translateX(-100%); }
    100% { transform: rotate(45deg) translateX(100%); }
}

 .ai-message {
    background: white;
    border: 1px solid #e0e6ed;
    padding: 12px 18px;
    border-radius: 18px 18px 18px 5px;
    display: block;
    margin-bottom: 15px;
    max-width: 85%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    word-wrap: break-word;
    line-height: 1.6;
    font-size: 16px;
    color: #2c3e50;
    margin-right: auto;
    position: relative;
    overflow: hidden;
}

/* Ensure proper spacing for paragraphs within AI messages */
.ai-message p {
    margin: 0 0 8px 0;
    line-height: 1.6;
}

.ai-message p:last-child {
    margin-bottom: 0;
}

/* Enhanced formatting for bold text in CBT responses */
.ai-message strong {
    font-weight: 700;
    color: #2980b9;
    display: inline;
}

/* Better spacing for CBT technique sections */
.ai-message br + strong {
    margin-top: 8px;
    display: inline-block;
}

.ai-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(79, 172, 254, 0.05), 
        transparent);
    transition: left 0.6s ease;
}

.ai-message:hover::before {
    left: 100%;
}

.message p {
    margin: 0;
    line-height: 1.6;
    font-size: 16px;
    position: relative;
    z-index: 1;
}

/* Enhanced Loading Animation */
.loading {
    display: none;
    text-align: center;
    color: #4facfe;
    padding: 30px;
    font-size: 16px;
    font-weight: 600;
    position: relative;
}

.loading::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(79, 172, 254, 0.2);
    border-top-color: #4facfe;
    border-radius: 50%;
    animation: loadingSpin 1s linear infinite;
    margin-right: 12px;
    vertical-align: middle;
}

@keyframes loadingSpin {
    to { transform: rotate(360deg); }
}

.loading p {
    margin: 10px 0 0 0;
    font-style: italic;
    opacity: 0.8;
}

/* Enhanced Input Section */
.input-section {
    padding: 25px 30px;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border-top: 1px solid rgba(79, 172, 254, 0.1);
    position: relative;
}

.input-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(79, 172, 254, 0.3), 
        transparent);
}

/* Enhanced Voice Controls */
.voice-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.voice-btn {
    padding: 16px 24px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.voice-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent);
    transition: left 0.5s ease;
}

.voice-btn:hover::before {
    left: 100%;
}

.record-btn {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: 2px solid rgba(220, 53, 69, 0.3);
}

.record-btn:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.4);
}

.record-btn.recording {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    animation: recordingPulse 1.5s infinite;
    box-shadow: 0 0 30px rgba(220, 53, 69, 0.6);
}

@keyframes recordingPulse {
    0% { 
        transform: scale(1); 
        box-shadow: 0 0 30px rgba(220, 53, 69, 0.6); 
    }
    50% { 
        transform: scale(1.05); 
        box-shadow: 0 0 40px rgba(220, 53, 69, 0.8); 
    }
    100% { 
        transform: scale(1); 
        box-shadow: 0 0 30px rgba(220, 53, 69, 0.6); 
    }
}

#playBtn {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    border: 2px solid rgba(108, 117, 125, 0.3);
}

#playBtn:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.4);
}

/* Enhanced Text Input */
.text-input {
    width: 100%;
    padding: 18px 24px;
    border: 2px solid #e0e6ed;
    border-radius: 15px;
    font-size: 16px;
    margin-bottom: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.text-input:focus {
    outline: none;
    border-color: #4facfe;
    background: #fff;
    box-shadow: 
        inset 0 2px 8px rgba(0, 0, 0, 0.05),
        0 0 0 4px rgba(79, 172, 254, 0.1),
        0 4px 20px rgba(79, 172, 254, 0.2);
    transform: translateY(-2px);
}

.text-input::placeholder {
    color: #adb5bd;
    font-style: italic;
    transition: opacity 0.3s ease;
}

.text-input:focus::placeholder {
    opacity: 0.7;
}

/* Enhanced Send Button */
.send-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 18px 35px;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.send-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent);
    transition: left 0.5s ease;
}

.send-btn:hover {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
}

.send-btn:hover::before {
    left: 100%;
}

.send-btn:active {
    transform: translateY(-1px);
}

.send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Enhanced Mobile Responsive Design */
@media (max-width: 768px) {
    .mood-section {
        padding: 20px 15px;
    }
    
    .mood-buttons {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .mood-btn {
        width: 85%;
        justify-content: center;
        padding: 14px 20px;
        font-size: 15px;
    }
    
    .chat-container {
        height: 350px;
        padding: 20px 15px;
    }
    
    .message {
        max-width: 92%;
        padding: 15px 18px;
    }
    
    .voice-controls {
        flex-direction: column;
        gap: 12px;
    }
    
    .voice-btn {
        width: 100%;
        justify-content: center;
        padding: 16px 20px;
    }
    
    .input-section {
        padding: 20px 15px;
    }
    
    .text-input {
        padding: 16px 20px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .send-btn {
        padding: 16px 30px;
    }
}

@media (max-width: 480px) {
    .mood-section {
        padding: 15px 10px;
    }
    
    .chat-container {
        height: 300px;
        padding: 15px 10px;
    }
    
    .message {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .voice-btn {
        padding: 14px 18px;
        font-size: 14px;
    }
    
    .input-section {
        padding: 15px 10px;
    }
}

/* Enhanced Accessibility */
.mood-btn:focus,
.voice-btn:focus,
.text-input:focus,
.send-btn:focus {
    outline: 3px solid rgba(79, 172, 254, 0.6);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mood-btn,
    .voice-btn,
    .send-btn {
        border: 3px solid #000;
    }
    
    .text-input {
        border: 3px solid #000;
        background: #fff;
    }
    
    .chat-container {
        background: #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .mood-btn,
    .voice-btn,
    .send-btn,
    .text-input,
    .message {
        transition: none;
        animation: none;
    }
    
    .record-btn.recording {
        animation: none;
    }
}
/* CBT Enhancement CSS - Add this to your existing chat.css file */

/* Enhanced CBT technique formatting */
.ai-message {
    line-height: 1.6;
    word-spacing: 0.1em;
}

/* Better spacing for CBT formatted responses */
.ai-message h3,
.ai-message h4 {
    margin: 15px 0 8px 0;
    font-weight: 600;
    color: #2c3e50;
}

/* Enhanced emoji and icon spacing */
.ai-message p {
    margin-bottom: 12px;
}

.ai-message p:last-child {
    margin-bottom: 0;
}

/* Better formatting for CBT technique steps */
.ai-message ol,
.ai-message ul {
    margin: 12px 0;
    padding-left: 20px;
}

.ai-message li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Enhanced bold text for CBT techniques */
.ai-message strong {
    font-weight: 600;
    color: #2980b9;
}

/* Better spacing around emojis in CBT responses */
.ai-message p:contains("📋"),
.ai-message p:contains("📝"), 
.ai-message p:contains("💡") {
    margin-top: 16px;
    margin-bottom: 12px;
}

/* Enhanced visual hierarchy for CBT sections */
.ai-message p:first-child {
    margin-bottom: 16px;
}

/* Better code block styling if used in CBT techniques */
.ai-message code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #e83e8c;
}

/* Enhanced blockquote styling for CBT examples */
.ai-message blockquote {
    border-left: 4px solid #4facfe;
    margin: 12px 0;
    padding: 8px 16px;
    background: rgba(79, 172, 254, 0.05);
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

/* Better number formatting in CBT steps */
.ai-message p:contains("1."),
.ai-message p:contains("2."),
.ai-message p:contains("3.") {
    margin-left: 8px;
    margin-bottom: 12px;
}

/* Enhanced visual breaks between CBT sections */
.ai-message hr {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, #ddd, transparent);
    margin: 20px 0;
}

/* Mobile responsive enhancements for CBT content */
@media (max-width: 768px) {
    .ai-message {
        padding: 16px 20px;
        line-height: 1.7;
    }
    
    .ai-message strong {
        display: inline-block;
        margin-bottom: 4px;
    }
    
    .ai-message ol,
    .ai-message ul {
        padding-left: 16px;
    }
    
    .ai-message li {
        margin-bottom: 10px;
    }
}

/* High contrast mode support for CBT content */
@media (prefers-contrast: high) {
    .ai-message strong {
        color: #000;
        font-weight: 700;
    }
    
    .ai-message blockquote {
        border-left-color: #000;
        background: #f0f0f0;
    }
}