/* Estilos personalizados para o sistema de gestão de usuários */

/* Utilitários */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Navegação */
.active-nav {
    font-weight: 600;
}

.sidebar.bg-indigo-800 .active-nav {
    background-color: rgba(79, 70, 229, 0.7);
}

.sidebar.bg-blue-700 .active-nav {
    background-color: rgba(37, 99, 235, 0.7);
}

/* Transições e animações */
.section {
    transition: opacity 0.3s ease;
}

.section.hidden {
    display: none;
}

/* Cards */
.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Botões */
button:focus {
    outline: none;
}

/* Formulários */
input:focus, select:focus, textarea:focus {
    outline: none;
}

/* Document cards */
.document-card {
    transition: all 0.2s ease;
}

.document-card:hover {
    background-color: rgba(243, 244, 246, 1);
}

/* Conversas */
.conversation-item {
    transition: background-color 0.2s ease;
}

.conversation-item:hover {
    background-color: rgba(243, 244, 246, 1);
}

/* Modal */
.modal {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

/* Animações para modal de teste */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

#agent-test-modal {
    animation: fadeIn 0.2s ease-out;
}

#agent-test-modal > div {
    animation: slideUp 0.3s ease-out;
}

#iframe-loading {
    transition: opacity 0.3s ease;
}

/* Responsividade */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        z-index: 40;
        height: 100vh;
    }
    
    .sidebar.hidden {
        transform: translateX(-100%);
    }
}

/* ========================================================================== */
/* Melhorias globais para mobile                                               */
/* ========================================================================== */

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Utilitário: min-height seguro para mobile (usa dvh quando disponível) */
.min-h-dvh {
    min-height: 100vh;
}

@supports (min-height: 100dvh) {
    .min-h-dvh {
        min-height: 100dvh;
    }
}

/* iOS: evita zoom automático em inputs com font-size < 16px */
@media (max-width: 768px) {
    input, select, textarea {
        font-size: 16px;
    }
}

/* Em browsers modernos, preferir viewport dinâmico para evitar corte no mobile */
@supports (height: 100dvh) {
    @media (max-width: 768px) {
        .sidebar {
            height: 100dvh;
        }
    }
}

/* Layouts com altura fixa apenas em desktop (evita travar scroll no mobile) */
.chat-layout {
    height: auto;
}

@media (min-width: 1024px) {
    .chat-layout {
        height: calc(100vh - 150px);
    }

    .training-panel-h {
        height: calc(100vh - 200px);
    }
}

@supports (height: 100dvh) {
    @media (min-width: 1024px) {
        .chat-layout {
            height: calc(100dvh - 150px);
        }

        .training-panel-h {
            height: calc(100dvh - 200px);
        }
    }
}

/* Personalização dos gráficos */
canvas {
    max-height: 300px;
}

/* Tabela de usuários */
.users-table tr:hover {
    background-color: rgba(243, 244, 246, 0.7);
}

/* Notificações */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 1rem;
    border-radius: 0.375rem;
    background-color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 50;
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification.success {
    border-left: 4px solid #10B981;
}

.notification.error {
    border-left: 4px solid #EF4444;
}

.notification.info {
    border-left: 4px solid #3B82F6;
}

/* Botão de upload */
.upload-zone {
    border: 2px dashed #E5E7EB;
    border-radius: 0.375rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.upload-zone:hover {
    border-color: #D1D5DB;
    background-color: #F9FAFB;
}

.upload-zone.active {
    border-color: #3B82F6;
    background-color: rgba(59, 130, 246, 0.05);
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.active {
    background-color: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.status-badge.inactive {
    background-color: rgba(239, 68, 68, 0.1);
    color: #DC2626;
}

.status-badge.pending {
    background-color: rgba(245, 158, 11, 0.1);
    color: #D97706;
}

/* Ajustes para melhorar a acessibilidade */
@media (prefers-reduced-motion) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
