/* Caura Real Chat Styles */

/* Make chat window and memory panel same height */
#chat-container.chat-demo {
    display: flex;
    gap: 2rem;
    align-items: stretch;
}

#chat-container .chat-window {
    flex: 2;
    height: 650px !important;
    display: flex;
    flex-direction: column;
}

#chat-container .chat-messages {
    flex: 1;
    overflow-y: auto;
}

#chat-container .memory-panel {
    flex: 0 0 360px;
    height: 650px !important;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 1.25rem;
    background: linear-gradient(145deg, 
                rgba(15, 23, 42, 0.97) 0%, 
                rgba(30, 41, 59, 0.94) 50%,
                rgba(15, 23, 42, 0.97) 100%);
    backdrop-filter: blur(20px) saturate(1.2);
    transition: all 0.3s ease;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

#chat-container .memory-panel h3 {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding-left: 0.25rem;
    opacity: 0.8;
}

#chat-container .memory-list {
    flex: 1;
    max-height: none !important;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom scrollbar for memory list */
#chat-container .memory-list::-webkit-scrollbar {
    width: 4px;
}

#chat-container .memory-list::-webkit-scrollbar-track {
    background: transparent;
}

#chat-container .memory-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
}

#chat-container .memory-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Remove spacing between consecutive demo subtitles */
.demo-container .section-subtitle {
    margin: 0 auto !important;
    padding: 0 !important;
    line-height: 1.3;
    max-width: 600px;
}

.demo-container .section-subtitle:first-of-type {
    margin-bottom: 2px !important;
}

.demo-container .section-subtitle + .section-subtitle {
    margin-top: 0 !important;
}

/* Auth Section */
.auth-section {
    max-width: 400px;
    margin: 2rem auto;
}

.auth-box {
    background: rgba(26, 31, 58, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 2px solid rgba(255, 230, 109, 0.2);
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.auth-box h3 {
    color: #FFD700;
    margin-bottom: 2rem;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
}

.auth-form-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-input {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #FFE66D;
    border-radius: 8px;
    padding: 0.75rem;
    color: #0a0e27;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: #FF6B6B;
    background: #ffffff;
    box-shadow: 0 0 10px rgba(255, 230, 109, 0.3);
}

.chat-input::placeholder {
    color: #64748B;
}

.auth-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

/* Button styles handled by base.css unified button system */
/* Custom overrides for chat buttons */
.btn-primary, .btn-secondary {
    flex: 1;
    font-size: 1.1rem;
}

/* Chat-specific secondary button style */
.auth-section .btn-secondary {
    background: transparent;
    color: #FFD700;
    border: 2px solid #FFD700;
}

.auth-section .btn-secondary:hover {
    background: rgba(255, 215, 0, 0.15);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.2);
}

.auth-message {
    margin-top: 1rem;
    padding: 0.5rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.auth-message.success {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.auth-message.error {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

/* Chat Interface Updates */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, 
                rgba(30, 35, 55, 0.98) 0%, 
                rgba(20, 25, 45, 0.95) 100%);
    backdrop-filter: blur(20px) saturate(1.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

/* Chat Status Styles */
.chat-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: 0.3px;
}

.chat-status .status-dot {
    width: 10px;
    height: 10px;
    background: #10B981;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
    }
    50% {
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.8);
    }
    100% {
        box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
    }
}

.chat-status #user-name {
    color: #FFE66D;
    font-weight: 800;
}

/* LLM Selector Styles */
.llm-selector-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
    max-width: 300px;
}

.llm-label {
    color: #FFE66D;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.llm-dropdown {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.08));
    border: 2px solid rgba(255, 230, 109, 0.3);
    border-radius: 8px;
    color: #FFFFFF;
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23FFE66D' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    background-size: 14px;
    min-width: 180px;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.llm-dropdown:hover {
    background: linear-gradient(135deg, rgba(255, 230, 109, 0.2), rgba(255, 230, 109, 0.1));
    border-color: #FFE66D;
    box-shadow: 0 4px 15px rgba(255, 230, 109, 0.2);
    transform: translateY(-1px);
}

.llm-dropdown:focus {
    outline: none;
    border-color: #FFE66D;
    box-shadow: 0 0 10px rgba(255, 230, 109, 0.2);
}

.llm-dropdown option {
    background: #1a1f3a;
    color: #FFE66D;
    padding: 0.5rem;
}

.chat-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(255, 107, 107, 0.05));
    border: 2px solid rgba(255, 107, 107, 0.3);
    border-radius: 8px;
    color: #FF6B6B;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.btn-small:hover {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.2), rgba(255, 107, 107, 0.1));
    color: #FFFFFF;
    border-color: #FF6B6B;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.chat-input-container {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#message-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #FFE66D;
    border-radius: 8px;
    padding: 0.75rem;
    color: #0a0e27;
    font-size: 1rem;
}

#message-input:focus {
    outline: none;
    border-color: #FF6B6B;
    background: #ffffff;
    box-shadow: 0 0 10px rgba(255, 230, 109, 0.3);
}

.btn-send {
    padding: 0.75rem 1.5rem;
    background: var(--gradient-primary);
    border: none;
    border-radius: 8px;
    color: #0a0e27;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
}

/* Memory Panel Updates */
.memory-info {
    padding: 0.75rem 1rem;
    background: rgba(255, 107, 107, 0.04);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    font-size: 0.875rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.memory-info #memory-count {
    color: #FFE66D;
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0 0.35rem;
}

/* Memory count pulse animation */
#memory-count.memory-count-pulse {
    animation: countPulse 1s ease-out;
    display: inline-block;
}

@keyframes countPulse {
    0% {
        transform: scale(1);
        text-shadow: 0 0 0 rgba(255, 230, 109, 0);
        color: #FFE66D;
    }
    25% {
        transform: scale(1.5);
        text-shadow: 0 0 30px rgba(255, 230, 109, 1);
        color: #FFF;
    }
    50% {
        transform: scale(1.3);
        text-shadow: 0 0 20px rgba(255, 230, 109, 0.8);
        color: #FFF;
    }
    100% {
        transform: scale(1);
        text-shadow: 0 0 0 rgba(255, 230, 109, 0);
        color: #FFE66D;
    }
}

.memory-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 0.875rem;
    padding-right: 2.75rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    position: relative;
    cursor: default;
}

.memory-item:hover {
    background: rgba(255, 255, 255, 0.035);
    border-color: rgba(255, 107, 107, 0.15);
    transform: translateX(2px);
}

/* Delete button for memory items */
.memory-delete-btn {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: rgba(248, 113, 113, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
}

.memory-delete-btn svg {
    width: 14px;
    height: 14px;
}

.memory-item:hover .memory-delete-btn {
    opacity: 1;
}

.memory-delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #F87171;
    transform: translateY(-50%) scale(1.05);
}

.memory-delete-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* Delete Confirmation Modal */
.delete-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.delete-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.delete-modal {
    background: var(--gradient-dark-panel-solid);
    border: 1px solid rgba(147, 51, 234, 0.3);
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
}

.delete-modal-overlay.active .delete-modal {
    transform: scale(1) translateY(0);
}

.delete-modal-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid rgba(239, 68, 68, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #EF4444;
}

.delete-modal h3 {
    color: #FFFFFF;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.75rem;
}

.delete-modal p {
    color: #94A3B8;
    text-align: center;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.delete-modal-buttons {
    display: flex;
    gap: 1rem;
}

.delete-modal-btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.delete-modal-btn.cancel {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #CBD5E1;
}

.delete-modal-btn.cancel:hover {
    background: rgba(148, 163, 184, 0.2);
    transform: translateY(-2px);
}

.delete-modal-btn.confirm {
    background: var(--gradient-danger);
    color: #FFFFFF;
}

.delete-modal-btn.confirm:hover {
    background: var(--gradient-danger-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

.memory-item:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-color: rgba(147, 51, 234, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(147, 51, 234, 0.15);
}

/* New memory animation */
.memory-item-new {
    animation: slideInGlow 0.8s ease-out forwards;
    opacity: 0;
    transform-origin: left center;
}

@keyframes slideInGlow {
    0% {
        opacity: 0;
        transform: translateX(-30px) scale(0.95);
        box-shadow: 0 0 0 rgba(255, 230, 109, 0);
        border-color: rgba(255, 230, 109, 0);
    }
    50% {
        opacity: 1;
        transform: translateX(-10px) scale(1.02);
        box-shadow: 0 0 40px rgba(255, 230, 109, 0.6);
        border-color: rgba(255, 230, 109, 0.8);
        background: rgba(255, 230, 109, 0.1);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
        box-shadow: 0 0 0 rgba(255, 230, 109, 0);
        border-color: rgba(255, 255, 255, 0.1);
        background: rgba(255, 255, 255, 0.05);
    }
}

/* Memory panel shimmer effect when updating */
.memory-panel.updating {
    animation: panelGlow 1.5s ease-out;
}

.memory-panel.updating::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 230, 109, 0.2),
        rgba(255, 230, 109, 0.3),
        rgba(255, 230, 109, 0.2),
        transparent
    );
    animation: shimmer 1.5s ease-out;
    z-index: 1;
    pointer-events: none;
}

@keyframes shimmer {
    100% {
        left: 100%;
    }
}

@keyframes panelGlow {
    0%, 100% {
        border-color: rgba(255, 255, 255, 0.1);
    }
    50% {
        border-color: rgba(255, 230, 109, 0.5);
    }
}

.memory-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}

.memory-label {
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
    letter-spacing: 0.3px;
    opacity: 0.75;
}

.memory-label.memory-category {
    color: rgba(251, 191, 36, 0.95);
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.12);
}

.memory-label.memory-type {
    color: rgba(96, 165, 250, 0.95);
    background: rgba(96, 165, 250, 0.08);
    border: 1px solid rgba(96, 165, 250, 0.12);
}

.memory-label.memory-sentiment {
    color: rgba(244, 114, 182, 0.95);
    background: rgba(244, 114, 182, 0.08);
    border: 1px solid rgba(244, 114, 182, 0.12);
}

.memory-content {
    color: rgba(203, 213, 225, 0.8);
    font-size: 0.775rem;
    line-height: 1.4;
    margin-top: 0.4rem;
    font-weight: 400;
}

.memory-date {
    color: rgba(148, 163, 184, 0.45);
    font-size: 0.65rem;
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.02);
    font-weight: 400;
}

.memory-placeholder {
    color: rgba(148, 163, 184, 0.4);
    font-style: italic;
    text-align: center;
    padding: 2rem 1rem;
    font-size: 0.825rem;
    line-height: 1.5;
}

/* Markdown Formatting in Chat Messages */
.message-bubble p {
    margin: 0.5rem 0;
}

.message-bubble p:first-child {
    margin-top: 0;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble strong {
    color: #FFFFFF;
    font-weight: 600;
}

.message-bubble em {
    font-style: italic;
    color: #E2E8F0;
}

.message-bubble code {
    background: rgba(147, 51, 234, 0.2);
    color: #A78BFA;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

/* Markdown styles for marked.js output */
.message-bubble ol,
.message-bubble ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-bubble li {
    margin: 0.25rem 0;
    line-height: 1.6;
}

.message-bubble p {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.message-bubble p:first-child {
    margin-top: 0;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble code {
    background: rgba(139, 92, 246, 0.1);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message-bubble pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.75rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.message-bubble pre code {
    background: none;
    padding: 0;
}

.message-bubble strong {
    font-weight: 600;
    color: #2D3748;
}

.message-bubble em {
    font-style: italic;
    color: #4A5568;
}

/* Streaming Message Indicator */
.message-bubble.streaming {
    position: relative;
    min-height: 20px;
}

.message-bubble.streaming::after {
    content: '';
    position: absolute;
    right: -4px;
    bottom: 4px;
    width: 8px;
    height: 16px;
    background: #FFE66D;
    animation: blink 1s infinite;
    border-radius: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Typing Indicator */
.typing-dots {
    display: inline-flex;
    align-items: center;
}

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

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

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

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

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--gradient-dark-panel-solid);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    min-width: 300px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-message {
    color: #E2E8F0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.toast.toast-success {
    border: 1px solid rgba(34, 197, 94, 0.3);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
}

.toast.toast-success .toast-icon {
    color: #10B981;
}

.toast.toast-error {
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.1) 100%);
}

.toast.toast-error .toast-icon {
    color: #EF4444;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-demo {
        flex-direction: column;
    }
    
    .memory-panel {
        width: 100%;
        max-height: 200px;
    }
    
    .auth-section {
        padding: 1rem;
    }
}