/* Estilos para el sistema de notas tipo chat */
.chat-notes-container {
    display: flex;
    flex-direction: column;
    height: 500px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #f5f5f5;
    margin: 1rem 0;
}

.chat-tabs {
    display: flex;
    background: white;
    border-bottom: 2px solid var(--border-color);
    border-radius: 8px 8px 0 0;
}

.chat-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
    position: relative;
}

.chat-tab.active {
    color: var(--primary-color);
    background: rgba(74, 144, 226, 0.1);
}

.chat-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #e5ddd5;
    background-image: url('data:image/svg+xml,%3Csvg width="60" height="60" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="none" fill-rule="evenodd"%3E%3Cg fill="%23d4d4d4" fill-opacity="0.2"%3E%3Cpath d="M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z"/%3E%3C/g%3E%3C/g%3E%3C/svg%3E');
}

.chat-date-divider {
    text-align: center;
    margin: 15px 0;
    position: relative;
}

.chat-date-divider span {
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #666;
    display: inline-block;
}

.chat-message {
    max-width: 70%;
    margin-bottom: 10px;
    animation: slideIn 0.3s ease;
}

.chat-message.sent {
    margin-left: auto;
}

.chat-bubble {
    padding: 8px 12px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    position: relative;
}

.chat-message:hover .chat-delete-btn {
    opacity: 1;
}

.chat-delete-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 0, 0, 0.1);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s;
    font-size: 12px;
    color: #ff0000;
}

.chat-delete-btn:hover {
    background: rgba(255, 0, 0, 0.2);
    transform: scale(1.1);
}

/* En dispositivos móviles, mostrar siempre el botón de eliminar */
@media (max-width: 768px) {
    .chat-delete-btn {
        opacity: 0.6;
        width: 24px;
        height: 24px;
        font-size: 14px;
    }
    
    .chat-delete-btn:active {
        background: rgba(255, 0, 0, 0.3);
        transform: scale(0.95);
    }
}

/* Para dispositivos táctiles (más preciso) */
@media (hover: none) and (pointer: coarse) {
    .chat-delete-btn {
        opacity: 0.7;
        width: 26px;
        height: 26px;
        font-size: 14px;
    }
    
    .chat-bubble {
        padding-right: 35px; /* Espacio para el botón */
    }
}

.chat-message.sent .chat-bubble {
    background: #dcf8c6;
}

.chat-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    width: 0;
    height: 0;
    border: 6px solid transparent;
}

.chat-message:not(.sent) .chat-bubble::before {
    left: -6px;
    border-right-color: white;
    border-left: 0;
}

.chat-message.sent .chat-bubble::before {
    right: -6px;
    border-left-color: #dcf8c6;
    border-right: 0;
}

.chat-message-text {
    margin: 0;
    word-wrap: break-word;
    color: #303030;
    line-height: 1.4;
}

.chat-message-time {
    font-size: 0.7rem;
    color: #999;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
}

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

.chat-input-container {
    display: flex;
    padding: 10px;
    background: white;
    border-top: 1px solid var(--border-color);
    gap: 10px;
    align-items: flex-end;
}

.chat-input-wrapper {
    flex: 1;
    position: relative;
}

.chat-input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 24px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    max-height: 120px;
    overflow-y: auto;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

.chat-send-btn:hover {
    background: #3a7bc8;
    transform: scale(1.1);
}

.chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: scale(1);
}

.chat-send-btn svg {
    width: 20px;
    height: 20px;
}

.chat-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
}

.chat-empty-state svg {
    width: 60px;
    height: 60px;
    margin-bottom: 10px;
    opacity: 0.5;
}

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

/* Scrollbar personalizada */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.3);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.5);
}