/* ===========================
   FireNet Fibra v5.0
   Enhanced Chat Styles
   =========================== */

/* Chat Buttons Container */
.chat-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

/* Individual Chat Button */
.chat-btn {
    background: linear-gradient(135deg, var(--primary-blue), #38bdf8);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Poppins', sans-serif;
}

.chat-btn:hover {
    background: linear-gradient(135deg, #0284c7, var(--primary-blue));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.chat-btn:active {
    transform: translateY(0);
}

/* Button variants */
.chat-btn.primary {
    background: linear-gradient(135deg, var(--primary-blue), #38bdf8);
}

.chat-btn.success {
    background: linear-gradient(135deg, var(--primary-green), #34d399);
}

.chat-btn.warning {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.chat-btn.secondary {
    background: linear-gradient(135deg, #6b7280, #9ca3af);
}

/* Enhanced message bubble for rich content */
.message-bubble p {
    margin: 0;
    line-height: 1.6;
}

.message-bubble strong {
    color: var(--primary-blue);
    font-weight: 600;
}

.message-bubble br {
    line-height: 1.8;
}

/* User message (right side) */
.chat-message.user {
    flex-direction: row-reverse;
}

.chat-message.user .message-bubble {
    background: var(--primary-blue);
    color: white;
}

.chat-message.user .message-bubble strong {
    color: white;
}

/* Bot message with buttons */
.chat-message.bot .message-bubble {
    max-width: 85%;
}

/* Responsive chat buttons */
@media (max-width: 480px) {
    .chat-buttons {
        flex-direction: column;
    }
    
    .chat-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
    }
}

/* Typing indicator enhancement */
.chat-message .message-bubble p:contains("Digitando") {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Team chat styles (admin panel) */
.team-member {
    padding: 15px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-member:hover {
    background: #f9fafb;
}

.team-member.active {
    background: #eff6ff;
    border-left: 3px solid var(--primary-blue);
}

.team-member img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.team-member strong {
    display: block;
    font-size: 14px;
    color: #111827;
    margin-bottom: 4px;
}

.team-member small {
    font-size: 12px;
    color: #6b7280;
}

/* Admin chat container */
.admin-team-chat-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    height: 600px;
}

.team-members-list {
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
}

.team-members-list h4 {
    padding: 15px;
    margin: 0;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.team-chat-area {
    display: flex;
    flex-direction: column;
}

.team-chat-header {
    padding: 15px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.team-chat-header h4 {
    margin: 0;
    font-size: 16px;
    color: #111827;
}

.team-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fafafa;
}

.team-chat-input {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
}

.team-chat-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.team-chat-input input:focus {
    border-color: var(--primary-blue);
}

.team-chat-input button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    background: var(--primary-blue);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.team-chat-input button:hover {
    background: #0284c7;
    transform: scale(1.05);
}

.team-chat-input button:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

/* Chat message styles for admin */
.team-chat-messages .chat-message {
    margin-bottom: 16px;
}

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

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

.team-chat-messages .chat-message.sent .message-content {
    background: var(--primary-blue);
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.team-chat-messages .chat-message.received .message-content {
    background: white;
    color: #111827;
    border-radius: 18px 18px 18px 4px;
}

.team-chat-messages .message-content {
    padding: 10px 16px;
    max-width: 70%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.team-chat-messages .message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    display: block;
}

/* Responsive team chat */
@media (max-width: 968px) {
    .admin-team-chat-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .team-members-list {
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }
}

/* Badge styles for admin panel */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge.active {
    background: #d1fae5;
    color: #065f46;
}

.badge.inactive {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* Log severity colors */
.text-info {
    color: var(--primary-blue);
}

.text-success {
    color: var(--primary-green);
}

.text-warning {
    color: #f59e0b;
}

.text-danger {
    color: #ef4444;
}

/* Permissions grid (already exists but enhanced) */
.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
}

.permissions-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.permissions-grid label:hover {
    background: white;
}

.permissions-grid input[type="checkbox"] {
    cursor: pointer;
}

/* Animation for new messages */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.chat-message {
    animation: slideInLeft 0.3s ease;
}

.chat-message.user {
    animation: slideInRight 0.3s ease;
}

/* Print friendly */
@media print {
    .chat-fab,
    .chat-window {
        display: none !important;
    }
}
