/* ============================================
   USER CHAT - Estilos do Chat do Usuário
   ============================================ */

.user-chat-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.user-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.user-chat-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1F2937;
}

.user-chat-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .user-chat-grid {
        grid-template-columns: 1fr;
    }
}

/* Seções */
.user-chat-section,
.user-notifications-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
    background: #F9FAFB;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1F2937;
    margin: 0;
}

/* Chat Messages */
.chat-messages {
    height: 500px;
    overflow-y: auto;
    padding: 20px;
    background: #F3F4F6;
}

.chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
    align-items: flex-end;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.from-admin {
    flex-direction: row;
    justify-content: flex-start;
}

.chat-message.from-user {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.message-avatar {
    flex-shrink: 0;
    margin-bottom: 4px;
}

.avatar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #E5E7EB;
    font-size: 1.25rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-message.from-admin .avatar-icon {
    background: #E5E7EB;
    padding: 6px;
}

.chat-message.from-admin .avatar-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: white;
    border-radius: 50%;
    padding: 4px;
}

.chat-message.from-user .avatar-icon {
    background: #F31100;
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(243, 17, 0, 0.3);
}

.chat-message.from-user .avatar-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    flex: 1;
    max-width: 65%;
    position: relative;
}

.chat-message.from-admin .message-content {
    background: linear-gradient(135deg, #F3F4F6 0%, #E5E7EB 100%);
    color: #1F2937;
    border-radius: 20px 20px 20px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.chat-message.from-user .message-content {
    background: linear-gradient(135deg, #F31100 0%, #C70D00 100%) !important;
    color: white !important;
    border-radius: 20px 20px 4px 20px;
    box-shadow: 0 4px 12px rgba(243, 17, 0, 0.3);
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px 6px;
    font-size: 0.7rem;
    opacity: 0.9;
}

.chat-message.from-user .message-header {
    color: rgba(255,255,255,0.95);
}

.chat-message.from-admin .message-header {
    color: #6B7280;
}

.message-time {
    margin-left: auto;
    font-size: 0.65rem;
    opacity: 0.8;
}

.ai-badge {
    background: #8B5CF6;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
}

.message-text {
    padding: 0 14px 12px;
    line-height: 1.5;
    font-size: 0.875rem;
}

.chat-message.from-admin .message-text {
    color: #1F2937;
}

.chat-message.from-user .message-text {
    color: white;
}

.chat-message.unread {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.95;
    }
}

/* Chat Form */
.chat-form {
    padding: 16px 20px;
    border-top: 1px solid #E5E7EB;
    background: white;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-form textarea {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #E5E7EB;
    border-radius: 24px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: none;
    min-height: 48px;
    max-height: 120px;
}

.chat-form textarea:focus {
    outline: none;
    border-color: #D1D5DB;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.chat-form button {
    background: #F31100;
    color: white;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(243, 17, 0, 0.3);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-form button:hover {
    background: #C70D00;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(243, 17, 0, 0.4);
}

.chat-form button:active {
    transform: scale(0.95);
}

/* Notificações */
.notifications-list {
    max-height: 600px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #F3F4F6;
    transition: background 0.2s;
    position: relative;
}

.notification-item:hover {
    background: #F9FAFB;
}

.notification-item.unread {
    background: #EFF6FF;
}

.notification-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.notification-info {
    background: #DBEAFE;
}

.notification-success {
    background: #D1FAE5;
}

.notification-warning {
    background: #FEF3C7;
}

.notification-error {
    background: #FEE2E2;
}

.notification-content {
    flex: 1;
}

.notification-content h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1F2937;
    margin: 0 0 4px 0;
}

.notification-content p {
    font-size: 0.875rem;
    color: #6B7280;
    margin: 0 0 8px 0;
}

.notification-time {
    font-size: 0.75rem;
    color: #9CA3AF;
}

.notification-link {
    color: #3B82F6;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.notification-link:hover {
    text-decoration: underline;
}

.mark-read-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #10B981;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mark-read-btn:hover {
    background: #059669;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #9CA3AF;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary {
    background: #DBEAFE;
    color: #1E40AF;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #10B981;
}

.alert-error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #EF4444;
}

/* ============================================
   CHAT WIDGET FLUTUANTE
   ============================================ */

.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}

.chat-widget-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F31100 0%, #C70D00 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(243, 17, 0, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.2s;
}

.chat-widget-btn:hover {
    transform: scale(1.1);
}

.chat-icon {
    font-size: 1.75rem;
}

.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #EF4444;
    color: white;
    border-radius: 12px;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 24px;
    text-align: center;
    border: 2px solid white;
}

.chat-widget-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .chat-widget-window {
        width: calc(100vw - 48px);
        height: 70vh;
    }
}

.chat-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #F31100 0%, #C70D00 100%);
    color: white;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.chat-widget-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.chat-widget-actions {
    display: flex;
    gap: 8px;
}

.expand-btn,
.close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.expand-btn:hover,
.close-btn:hover {
    background: rgba(255,255,255,0.3);
}

.chat-widget-messages {
    flex: 1;
    overflow-y: auto !important;
    overflow-x: hidden;
    padding: 16px;
    background: #F3F4F6;
    min-height: 0;
    max-height: calc(500px - 120px);
    -webkit-overflow-scrolling: touch;
}

.widget-message {
    margin-bottom: 12px;
    animation: slideIn 0.3s ease;
    display: flex;
    flex-direction: column;
}

.widget-message.from-admin .widget-message-content {
    background: linear-gradient(135deg, #F3F4F6 0%, #E5E7EB 100%);
    color: #1F2937;
    border-radius: 16px 16px 16px 4px;
    padding: 12px 14px;
    max-width: 80%;
    align-self: flex-start;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.widget-message.from-user .widget-message-content {
    background: linear-gradient(135deg, #F31100 0%, #C70D00 100%);
    color: white;
    border-radius: 16px 16px 4px 16px;
    padding: 12px 14px;
    max-width: 80%;
    align-self: flex-end;
    box-shadow: 0 2px 8px rgba(243, 17, 0, 0.3);
}

.widget-message-content strong {
    font-size: 0.75rem;
    display: block;
    margin-bottom: 4px;
    opacity: 0.9;
}

.widget-message-content p {
    margin: 4px 0;
    font-size: 0.875rem;
    line-height: 1.4;
}

.widget-message-time {
    font-size: 0.7rem;
    opacity: 0.8;
    display: block;
    margin-top: 4px;
}

.loading-messages,
.empty-messages {
    text-align: center;
    padding: 40px 20px;
    color: #9CA3AF;
    font-size: 0.875rem;
}

.chat-widget-form {
    display: flex !important;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #E5E7EB;
    background: white;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
    align-items: center;
}

.chat-widget-form input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #E5E7EB;
    border-radius: 20px;
    font-size: 0.875rem;
    min-height: 40px;
}

.chat-widget-form input:focus {
    outline: none;
    border-color: #F31100;
    box-shadow: 0 0 0 3px rgba(243, 17, 0, 0.1);
}

.chat-widget-form button {
    padding: 10px 16px;
    background: #F31100;
    color: white;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
    flex-shrink: 0;
    min-height: 40px;
    white-space: nowrap;
}

.chat-widget-form button:hover {
    background: #C70D00;
    transform: scale(1.05);
}

/* ============================================
   BOTÕES DE AÇÃO NAS MENSAGENS
   ============================================ */

.chat-button {
    display: inline-block;
    margin: 8px 4px 8px 0;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chat-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.chat-button-instagram {
    background: linear-gradient(135deg, #833AB4 0%, #FD1D1D 50%, #F77737 100%);
    color: white;
}

.chat-button-event {
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    color: white;
}

.chat-button-company {
    background: linear-gradient(135deg, #F093FB 0%, #F5576C 100%);
    color: white;
}

/* Lista estilizada nas mensagens */
.chat-list {
    margin: 12px 0;
    padding-left: 20px;
    list-style: none;
}

.chat-list li {
    margin: 8px 0;
    padding-left: 8px;
    position: relative;
}

.chat-list li:before {
    content: "•";
    position: absolute;
    left: -12px;
    color: #3B82F6;
    font-weight: bold;
}

/* Strong (negrito) nas mensagens */
.message-text strong {
    color: #1F2937;
    font-weight: 700;
}

/* ============================================
   INDICADOR DE DIGITAÇÃO
   ============================================ */

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #F3F4F6 0%, #E5E7EB 100%);
    border-radius: 20px 20px 20px 4px;
    max-width: 80px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6B7280;
    animation: typingDot 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.chat-message.typing {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
