/* Professional Chat Components - Refined Enterprise Design */
/* Global styles for XAF custom components */
/* Uses Rame Design System tokens - see /css/design-system/_tokens.css */

/* Chat Container */
.chat-container {
    display: flex;
    height: 600px;
    border: 1px solid var(--rame-border-light, #e4e6eb);
    border-radius: var(--rame-radius-2xl, 12px);
    overflow: hidden;
    background: var(--rame-bg-primary, #ffffff);
    box-shadow: var(--rame-shadow-md, 0 2px 12px rgba(0, 0, 0, 0.08));
}

/* Conversation Sidebar */
.chat-sidebar {
    width: var(--rame-sidebar-width, 360px);
    border-right: 1px solid var(--rame-border-light, #e4e6eb);
    display: flex;
    flex-direction: column;
    background: var(--rame-bg-primary, #ffffff);
}

.chat-sidebar .chat-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--rame-border-light, #e4e6eb);
    background: linear-gradient(135deg, var(--rame-bg-secondary, #f7f8fa) 0%, var(--rame-bg-primary, #ffffff) 100%);
    position: relative;
}

.chat-sidebar .chat-header::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--rame-border-light, #e4e6eb) 50%, transparent);
}

.chat-sidebar .chat-header h5 {
    margin: 0;
    font-size: var(--rame-text-2xl, 18px);
    font-weight: var(--rame-font-bold, 700);
    color: var(--rame-text-primary, #1c1e21);
    letter-spacing: -0.3px;
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--rame-bg-secondary, #f7f8fa);
}

.conversation-list::-webkit-scrollbar {
    width: 6px;
}

.conversation-list::-webkit-scrollbar-track {
    background: var(--rame-scrollbar-track, transparent);
}

.conversation-list::-webkit-scrollbar-thumb {
    background: var(--rame-scrollbar-thumb, #d0d3d9);
    border-radius: 3px;
    transition: var(--rame-transition-base, background 0.2s ease);
}

.conversation-list::-webkit-scrollbar-thumb:hover {
    background: var(--rame-scrollbar-thumb-hover, #b8bcc4);
}

/* Conversation Item */
.conversation-item {
    padding: 14px 18px;
    border-bottom: 1px solid var(--rame-border-light, #e4e6eb);
    cursor: pointer;
    transition: var(--rame-transition-spring, all 0.2s cubic-bezier(0.16, 1, 0.3, 1));
    position: relative;
    background: var(--rame-bg-primary, #ffffff);
}

.conversation-item::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(135deg, var(--rame-primary, #0084ff) 0%, var(--rame-primary-hover, #0073ea) 100%);
    transition: var(--rame-transition-spring, width 0.2s cubic-bezier(0.16, 1, 0.3, 1));
}

.conversation-item:hover {
    background: linear-gradient(135deg, var(--rame-bg-secondary, #f7f8fa) 0%, var(--rame-bg-primary, #ffffff) 100%);
    transform: translateX(2px);
}

.conversation-item:hover::after {
    width: 3px;
}

.conversation-item.selected {
    background: linear-gradient(135deg, var(--rame-primary-light, #e7f3ff) 0%, var(--rame-primary-lighter, #f0f8ff) 100%);
    box-shadow: inset 0 0 0 1px rgba(0, 132, 255, 0.1);
}

.conversation-item.selected::after {
    width: 4px;
    box-shadow: 0 0 8px rgba(0, 132, 255, 0.3);
}

.conversation-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    z-index: 1;
}

.conversation-title {
    font-weight: var(--rame-font-semibold, 600);
    font-size: 14.5px;
    color: var(--rame-text-primary, #1c1e21);
    letter-spacing: -0.1px;
    line-height: var(--rame-line-height-tight, 1.3);
    transition: var(--rame-transition-base, color 0.2s ease);
}

.conversation-item:hover .conversation-title {
    color: var(--rame-primary, #0084ff);
}

.conversation-item.selected .conversation-title {
    color: var(--rame-primary-hover, #0062d1);
    font-weight: var(--rame-font-bold, 700);
}

.conversation-subtitle {
    font-size: 12.5px;
    color: var(--rame-text-secondary, #65676b);
    font-weight: var(--rame-font-medium, 500);
    letter-spacing: 0.1px;
    display: flex;
    align-items: center;
    gap: var(--rame-space-2, 8px);
}

.conversation-subtitle::before {
    content: "";
    width: 6px;
    height: 6px;
    background: var(--rame-status-online, #42b72a);
    border-radius: var(--rame-radius-full, 50%);
    display: inline-block;
}

.conversation-date {
    font-size: var(--rame-text-sm, 11px);
    color: var(--rame-text-tertiary, #8a8d91);
    font-weight: var(--rame-font-medium, 500);
    letter-spacing: 0.2px;
}

@keyframes conversationSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.conversation-item:first-child {
    animation: conversationSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Chat Main Panel */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--rame-bg-primary, #ffffff);
    position: relative;
    overflow: hidden;
}

.no-conversation-selected {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: linear-gradient(180deg, var(--rame-bg-secondary, #f7f8fa) 0%, var(--rame-bg-primary, #ffffff) 100%);
    color: var(--rame-text-tertiary, #8a8d91);
    text-align: center;
    padding: var(--rame-space-10, 40px) var(--rame-space-5, 20px);
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.no-conversation-selected::before {
    content: "💬";
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.4;
    display: block;
    animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

.no-conversation-selected p {
    margin: 0;
    font-size: var(--rame-text-xl, 16px);
    font-weight: var(--rame-font-medium, 500);
    letter-spacing: 0.2px;
    color: var(--rame-text-secondary, #65676b);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.chat-main.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--rame-primary, #0084ff), transparent);
    animation: loadingSlide 1.5s ease-in-out infinite;
}

@keyframes loadingSlide {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Chat Header styles are in ChatHeader.razor.css (CSS isolation) */

/* Messages List */
.chat-messages {
    flex: 1;
    padding: var(--rame-space-6, 24px) var(--rame-space-5, 20px);
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(180deg, var(--rame-bg-secondary, #f7f8fa) 0%, var(--rame-bg-primary, #ffffff) 100%);
    display: flex;
    flex-direction: column;
    position: relative;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--rame-scrollbar-track, transparent);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--rame-scrollbar-thumb, #d0d3d9);
    border-radius: 3px;
    transition: var(--rame-transition-base, background 0.2s ease);
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--rame-scrollbar-thumb-hover, #b8bcc4);
}

.no-messages {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--rame-text-tertiary, #8a8d91);
    text-align: center;
    padding: var(--rame-space-10, 40px) var(--rame-space-5, 20px);
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.no-messages::before {
    content: "💬";
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
    display: block;
    animation: floatIcon 3s ease-in-out infinite;
}

.no-messages p {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.date-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: var(--rame-space-5, 20px) 0;
    position: relative;
}

.date-divider::before,
.date-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--rame-border-light, #e4e6eb) 50%, transparent);
}

.date-divider span {
    padding: 0 var(--rame-space-4, 16px);
    font-size: var(--rame-text-sm, 12px);
    font-weight: var(--rame-font-semibold, 600);
    color: var(--rame-text-secondary, #65676b);
    background: var(--rame-bg-secondary, #f7f8fa);
    border-radius: var(--rame-radius-2xl, 12px);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Message Item styles are in MensajeItem.razor.css (CSS isolation) */

/* Chat Input */
.chat-input {
    padding: var(--rame-space-4, 16px) var(--rame-space-5, 20px);
    border-top: 1px solid var(--rame-border-light, #e4e6eb);
    display: flex;
    flex-direction: column;
    gap: var(--rame-space-3, 12px);
    background: var(--rame-bg-primary, #ffffff);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.03);
}

.input-row {
    display: flex;
    gap: var(--rame-space-3, 12px);
    align-items: center;
}

.connection-error {
    display: flex;
    align-items: center;
    gap: var(--rame-space-2, 10px);
    padding: var(--rame-space-3, 12px) var(--rame-space-4, 16px);
    background: linear-gradient(135deg, var(--rame-error-light, #fff5f5) 0%, #ffe5e5 100%);
    border: 1px solid var(--rame-error-border, #ffc9c9);
    border-radius: var(--rame-radius-2xl, 12px);
    animation: errorSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.15);
}

@keyframes errorSlideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 100px;
        padding-top: 12px;
        padding-bottom: 12px;
    }
}

.error-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.error-message {
    flex: 1;
    color: var(--rame-error-text, #842029);
    font-size: var(--rame-text-base, 13px);
    font-weight: var(--rame-font-medium, 500);
    line-height: var(--rame-line-height-base, 1.4);
    letter-spacing: 0.1px;
}

.chat-input input {
    flex: 1;
    padding: var(--rame-space-3, 12px) var(--rame-space-4, 18px);
    border: 2px solid var(--rame-border-light, #e4e6eb);
    border-radius: var(--rame-radius-pill, 24px);
    font-size: var(--rame-text-md, 14.5px);
    line-height: var(--rame-line-height-relaxed, 1.5);
    background: var(--rame-bg-secondary, #f7f8fa);
    color: var(--rame-text-primary, #1c1e21);
    transition: var(--rame-transition-spring, all 0.2s cubic-bezier(0.16, 1, 0.3, 1));
    outline: none;
}

.chat-input input::placeholder {
    color: var(--rame-text-tertiary, #8a8d91);
}

.chat-input input:hover {
    border-color: var(--rame-border-dark, #c5c7cc);
    background: var(--rame-bg-primary, #ffffff);
}

.chat-input input:focus {
    border-color: var(--rame-primary, #0084ff);
    background: var(--rame-bg-primary, #ffffff);
    box-shadow: var(--rame-shadow-focus-primary, 0 0 0 3px rgba(0, 132, 255, 0.1));
}

.chat-input input:disabled {
    background: var(--rame-bg-tertiary, #f0f2f5);
    color: var(--rame-text-tertiary, #8a8d91);
    cursor: not-allowed;
    border-color: var(--rame-border-light, #e4e6eb);
}

/* Note: .btn-send, .btn-attach, .mic-button, .cancel-button, .stop-button
   have their own scoped styles in component CSS files */

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}
