/* ========================================
   RESPUESTAS - ESTILOS WHATSAPP Y EMAIL
   ======================================== */

/* Tabs de respuestas */
.respuestas-tabs {
    display: flex;
    gap: 0.5rem;
    background: var(--light-bg);
    padding: 0.5rem;
    border-radius: var(--border-radius);
}

.respuestas-tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.respuestas-tab-btn:hover {
    background: var(--primary-color);
    color: white;
}

.respuestas-tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.respuestas-content {
    display: none;
    height: calc(100vh - 250px);
}

.respuestas-content.active {
    display: block;
}

/* ========================================
   WHATSAPP CHAT LAYOUT
   ======================================== */

.chat-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    height: 100%;
    background: white;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

/* Sidebar de conversaciones */
.chat-sidebar {
    background: #f8f9fa;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.chat-sidebar-header {
    padding: 1rem;
    background: white;
    border-bottom: 1px solid #e0e0e0;
}

.chat-sidebar-header h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-sidebar-header h3 i {
    color: var(--primary-color);
}

.chat-search {
    position: relative;
}

.chat-search i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.chat-search input {
    width: 100%;
    padding: 0.6rem 0.75rem 0.6rem 2.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

/* Item de conversación */
.chat-item {
    padding: 1rem;
    cursor: pointer;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s;
    display: flex;
    gap: 0.75rem;
}

.chat-item:hover {
    background: #fff;
}

.chat-item.active {
    background: #E7F3FF;
}

.chat-item-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
}

.chat-item-content {
    flex: 1;
    min-width: 0;
}

.chat-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.chat-item-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.chat-item-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chat-item-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-unread {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Área principal del chat */
.chat-main {
    display: flex;
    flex-direction: column;
    background: white;
    position: relative;
}

/* Placeholder cuando no hay chat seleccionado */
.chat-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-muted);
}

.chat-placeholder i {
    font-size: 5rem;
    color: var(--primary-color);
}

/* Ventana de chat */
.chat-window {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    background: var(--light-bg);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-contact-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.contact-details h4 {
    margin: 0;
    font-size: 1rem;
}

.contact-status {
    font-size: 0.8rem;
    color: var(--text-muted);
}

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

.icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Mensajes */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
}

.message {
    display: flex;
    margin-bottom: 0.75rem;
    animation: messageSlideIn 0.3s ease;
}

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

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

.message.received {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 65%;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    position: relative;
}

.message.sent .message-bubble {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-bottom-right-radius: 2px;
}

.message.received .message-bubble {
    background: white;
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 2px;
}

.message-text {
    margin-bottom: 0.25rem;
    word-wrap: break-word;
}

.message-time {
    font-size: 0.7rem;
    text-align: right;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    justify-content: flex-end;
    opacity: 0.8;
}

.message.sent .message-time {
    color: rgba(255, 255, 255, 0.9);
}

.message.received .message-time {
    color: var(--text-muted);
}

.message-time i {
    font-size: 0.85rem;
}

/* Input de mensaje */
.chat-input {
    background: var(--light-bg);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.input-wrapper {
    flex: 1;
    background: white;
    border-radius: 24px;
    padding: 0.5rem 1rem;
}

.input-wrapper textarea {
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 0.95rem;
    max-height: 120px;
}

.btn-send {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-send:hover {
    background: var(--secondary-color);
    transform: scale(1.05);
}

/* ========================================
   EMAIL LAYOUT
   ======================================== */

.email-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    height: 100%;
    background: white;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

/* Sidebar de emails */
.email-sidebar {
    background: #f8f9fa;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.email-sidebar-header {
    padding: 1rem;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.email-sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.email-list {
    flex: 1;
    overflow-y: auto;
}

/* Item de email */
.email-item {
    padding: 1rem;
    cursor: pointer;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s;
}

.email-item:hover {
    background: #fff;
}

.email-item.active {
    background: #E7F3FF;
    border-left: 3px solid var(--primary-color);
}

.email-item.unread {
    background: #f0f7ff;
    font-weight: 600;
}

.email-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.email-item-from {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.email-item-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.email-item-subject {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-item-preview {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Visor de email */
.email-main {
    display: flex;
    flex-direction: column;
    background: white;
}

.email-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-muted);
}

.email-placeholder i {
    font-size: 5rem;
    color: var(--primary-color);
}

.email-viewer {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.email-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.email-subject h3 {
    margin: 0;
    font-size: 1.3rem;
}

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

.email-from {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 1rem;
}

.sender-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.sender-info {
    flex: 1;
}

.sender-name-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.sender-email {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.email-to {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.email-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.email-body {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    line-height: 1.6;
}

/* Editor de respuesta */
.email-reply-editor {
    border-top: 2px solid var(--primary-color);
    padding: 1.5rem;
    background: #f8f9fa;
}

.reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.reply-header h4 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
}

.reply-to {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.reply-input textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

.reply-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

/* Empty state */
.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state i {
    margin-bottom: 1rem;
}

.empty-state p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
}

.empty-state small {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

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

@media (max-width: 1024px) {
    .chat-layout,
    .email-layout {
        grid-template-columns: 280px 1fr;
    }
}

@media (max-width: 768px) {
    .chat-layout,
    .email-layout {
        grid-template-columns: 1fr;
    }

    .chat-sidebar,
    .email-sidebar {
        display: none;
    }

    .chat-sidebar.show,
    .email-sidebar.show {
        display: flex;
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 80%;
        z-index: 100;
        box-shadow: var(--shadow-xl);
    }
}

