/* Importar Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Cores principais inspiradas no ChatGPT */
    --color-primary: #10a37f;
    --color-primary-hover: #0d8b6b;
    --color-primary-light: #e6f7f3;

    /* Cores de fundo */
    --bg-primary: #ffffff;
    --bg-secondary: #f7f7f8;
    --bg-tertiary: #ececf1;
    --bg-dark: #2d2d30;
    --bg-chat: #f9f9f9;

    /* Cores de texto */
    --text-primary: #0d1117;
    --text-secondary: #6e6e80;
    --text-tertiary: #8e8ea0;
    --text-light: #ffffff;

    /* Cores de borda */
    --border-primary: #d9d9e3;
    --border-secondary: #ececf1;
    --border-focus: #10a37f;

    /* Estados */
    --color-success: #10a37f;
    --color-warning: #ff8500;
    --color-error: #ef4444;
    --color-info: #3b82f6;

    /* Novas cores para status de conversa */
    --conversation-active-bg: #e0f2f7; /* Um azul claro */
    --conversation-active-border: #007bb6; /* Um azul mais forte */
    --conversation-finished-bg: var(--color-primary-light); /* Um verde claro */
    --conversation-finished-border: var(--color-success); /* Um verde mais forte */

    /* Raios */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Adicionar em frontend/styles.css */
    --icon-color: #4B5563;
    --icon-hover-color: #111827;
    --icon-stroke-width: 1.5;

    --body-bg: #f4f6f8;
    --text-primary: #1F2937;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    width: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: transparent;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
    overflow: hidden;
    position: relative;
}

/* ============================================= */
/* ESTILOS DE AUTENTICAÇÃO MODERNOS */
/* ============================================= */

.auth-container {
    background: transparent;
    width: 90%;
    max-width: 480px;
    margin: 0 auto;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: visible;
    height: auto;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.auth-container.modern {
    animation: slideUp 0.3s ease-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-header {
    /* Efeito de Vidro Fosco (Glassmorphism) */
    background: rgba(255, 255, 255, 0.16);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5.3px);
    -webkit-backdrop-filter: blur(5.3px);
    padding: 32px;
    text-align: center;
    border-radius: var(--radius-xl); /* Bordas arredondadas em todos os cantos */
    color: var(--text-light);
    margin-bottom: 8px;
}

.auth-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    color: var(--text-light);
}

.auth-subtitle {
    font-size: 16px;
    opacity: 0.9;
    font-weight: 400;
    color: var(--text-light);
}

.auth-form {
    background: var(--bg-primary); /* Fundo branco sólido */
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding: 32px 40px;
    z-index: 2; /* Garante que o formulário fique acima do rodapé na sobreposição */
    position: relative;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-primary);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-group input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

.form-group input::placeholder {
    color: var(--text-tertiary);
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.toggle-password {
    position: absolute;
    right: 16px;
    cursor: pointer;
    color: var(--text-tertiary);
    z-index: 2;
}

.auth-btn {
    width: 100%;
    padding: 14px 24px;
    /* Aplicando o degradê estático do tema */
    background: linear-gradient(90deg, rgba(42,155,123,1) 0%, rgba(87,199,133,1) 100%);
    color: var(--text-light);
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0;
}

.auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.auth-footer {
    padding: 24px 40px;
    background: var(--bg-primary);
    text-align: center;
    border-top: 1px solid var(--bg-primary); /* Borda da mesma cor para camuflar a junção */
    margin-top: -1px; /* Sobrepõe 1px para eliminar a fenda */
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
    position: relative;
    z-index: 1; /* Garante que o rodapé fique atrás do formulário */
}

.auth-footer p {
    color: var(--text-primary);
    font-size: 14px;
}

.auth-footer a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    margin-top: 16px;
}

.success-message {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    margin-top: 16px;
}

/* ============================================= */
/* ESTILOS DA APLICAÇÃO DE CHAT */
/* ============================================= */

.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    background: var(--bg-primary);
    overflow: hidden;
}

@media (min-width: 1024px) {
    .app-container {
        border-radius: var(--radius-lg);
        margin: 20px;
        width: calc(100vw - 40px);
        height: calc(100vh - 40px);
        box-shadow: var(--shadow-xl);
        border: 1px solid var(--border-secondary);
    }
}

/* ============================================= */
/* SIDEBAR */
/* ============================================= */

.sidebar {
    width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-primary);
}

.sidebar-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.3px;
    text-align: center;
    width: 100%;
}

.sidebar-search {
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-secondary);
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-search input {
    flex-grow: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-md);
    font-size: 14px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

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

.sidebar-search svg {
    width: 20px;
    height: 20px;
    color: var(--text-tertiary);
}

.new-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    /* Aplicando o degradê estático do tema */
    background: linear-gradient(90deg, rgba(42,155,123,1) 0%, rgba(87,199,133,1) 100%);
    color: var(--text-light);
}

.new-chat-btn i,
.admin-link i,
.logout-btn i {
    width: 18px;
    height: 18px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.new-chat-btn svg,
.admin-link svg,
.logout-btn svg,
.sidebar-toggle svg,
.assistant-avatar svg,
.chat-input-toolbar .btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.new-chat-btn:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
}

.sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.conversations-wrapper {
    flex: 1;
    overflow-y: auto;
}

#conversationList {
    list-style: none;
    padding: 8px 0;
}

#conversationList li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-secondary);
    cursor: pointer;
    transition: background-color 0.2s;
}

#conversationList li:hover {
    background-color: var(--bg-tertiary);
}

#conversationList li.active-conversation {
    background-color: var(--conversation-active-bg);
    border-left: 4px solid var(--conversation-active-border);
    padding-left: 11px; /* Ajustar padding devido à borda */
}

#conversationList li.finished-conversation {
    background-color: var(--conversation-finished-bg);
    border-left: 4px solid var(--conversation-finished-border);
    padding-left: 11px; /* Ajustar padding devido à borda */
    opacity: 0.8; /* Suavizar um pouco o visual */
}

#conversationList li.finished-conversation:hover {
    background-color: var(--conversation-finished-bg); /* Manter a cor mesmo no hover */
}

.conversation-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    flex-grow: 1;
}

.customer-info {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-info .phone-info {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.conversation-title {
    font-size: 0.9em;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 10px;
}

.conversation-actions .edit-btn,
.conversation-actions .finish-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.conversation-actions .edit-btn:hover,
.conversation-actions .finish-btn:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
    color: var(--color-primary);
}

.conversation-actions .finish-btn.finished {
    color: var(--color-success);
    cursor: default;
}

.conversation-actions .finish-btn:disabled {
    cursor: default;
    opacity: 0.6;
}

.conversation-actions .finish-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-link,
.logout-btn {
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
    border: none;
    background: none;
    color: var(--text-secondary);
}

.admin-link:hover,
.logout-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ============================================= */
/* ÁREA DE CHAT */
/* ============================================= */

.chat-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative; /* Para posicionar elementos filhos */
}

/* ============================ */
/* CABEÇALHO DA ÁREA DE CHAT    */
/* ============================ */

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Distribui espaço entre os itens */
    padding: 10px 20px; /* Reduzido para um layout mais compacto */
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    flex-wrap: wrap; /* Permite que os elementos se ajustem em várias linhas se necessário */
    gap: 16px; /* Adiciona espaçamento entre os grupos de elementos */
}

/* Novo container para os botões do cabeçalho */
.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 10px; /* Espaço entre os botões */
}

.chat-identity {
    display: flex;
    justify-content: space-between; /* Mantém a separação interna */
    align-items: center;
    flex-grow: 1; /* Permite que este elemento ocupe o espaço restante */
    gap: 16px;
    min-width: 0; /* Ajuda a evitar overflow de conteúdo flex */
}

.assistant-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.assistant-avatar {
    font-size: 24px;
    background-color: var(--color-primary);
    color: var(--text-light);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.assistant-details {
    display: flex;
    flex-direction: column;
}

.assistant-details h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
}

.assistant-details .slogan {
    font-size: 12px;
    color: var(--text-secondary);
}

.patient-info-header {
    text-align: right;
}

.patient-info-header .patient-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.patient-info-header .patient-phone {
    font-size: 14px;
    color: var(--text-secondary);
}

#chatInterfacePlaceholder {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-height: 0;
    overflow: hidden;
    height: 100%;
    max-height: 100%;
}

.welcome-message {
    text-align: center;
    max-width: 400px;
}

.welcome-icon {
    margin-bottom: 24px;
    color: var(--text-tertiary);
}

.welcome-message h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.welcome-message p {
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.5;
}

/* ============================================= */
/* PAINEL ADMINISTRATIVO */
/* ============================================= */

.admin-container {
    background: var(--bg-primary);
    width: 100%;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    border: none;
    overflow: hidden;
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-header {
    background: linear-gradient(135deg, var(--green-primary, #075e54) 0%, var(--green-dark, #054d44) 100%);
    color: var(--text-light);
    padding: 20px 40px;
    text-align: center;
}

.admin-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.admin-subtitle {
    font-size: 18px;
    opacity: 0.9;
    font-weight: 400;
}

.admin-content {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    overflow-y: auto;
    padding-bottom: 80px; /* Espaço para o rodapé fixo */
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.stat-card {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: var(--radius-lg, 12px);
    border: 1px solid var(--border-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md, 0 2px 4px rgba(0,0,0,0.1));
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg, 0 4px 8px rgba(0,0,0,0.15));
}

.stat-card.primary {
    border-left: 4px solid var(--color-primary);
}

.stat-card.success {
    border-left: 4px solid var(--color-success);
}

.stat-card.warning {
    border-left: 4px solid var(--color-warning);
}

.stat-card.info {
    border-left: 4px solid var(--color-info);
}

.stat-icon {
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-md, 8px);
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.approved-users-section,
.pending-users-section {
    margin-top: 32px;
    max-height: none;
    display: flex;
    flex-direction: column;
}

.section-header {
    margin-bottom: 24px;
}

.section-header h3 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 16px;
}

.users-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg, 12px);
    padding: 24px;
    border: 1px solid var(--border-secondary);
    margin-bottom: 32px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.users-list {
    display: grid;
    gap: 20px;
}

.user-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg, 12px);
    padding: 24px;
    border: 1px solid var(--border-secondary);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md, 0 2px 4px rgba(0,0,0,0.1));
}

.user-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg, 0 4px 8px rgba(0,0,0,0.15));
}

.user-details h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.2px;
}

.user-details p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 4px;
}

.user-phone {
    color: var(--text-tertiary) !important;
    font-size: 13px !important;
}

.user-meta {
    text-align: right;
    color: var(--text-tertiary);
    font-size: 12px;
}

.user-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-approve,
.btn-reject {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md, 8px);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-approve i,
.btn-reject i {
    font-size: 14px;
}

/* Estilos específicos para ícones dos botões do chat */
/* Removemos essas regras porque o estilo .chat-input-toolbar .btn svg é mais genérico */
/* .chat-input-toolbar .btn i {
    font-size: 16px;
    line-height: 1;
}

.chat-send-btn i,
.chat-attach-btn i {
    font-size: 16px;
}

/* Ícone de observações do atendente */
.btn.attendant i {
    font-size: 15px;
}

/* Ícone de colar */
#paste-button i {
    font-size: 14px;
}

/* Ícone de microfone */
#record-button i {
    font-size: 16px;
}

/* Ícone de enviar */
#send-button i {
    font-size: 15px;
} */

.btn-approve {
    background: var(--color-success, #16a34a);
    color: var(--text-light);
}

.btn-approve:hover {
    background: var(--color-success-hover, #0d8b6b);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md, 0 2px 4px rgba(0,0,0,0.1));
}

.btn-reject {
    background: var(--color-error, #dc3545);
    color: var(--text-light);
}

.btn-reject:hover {
    background: var(--color-error-hover, #dc2626);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md, 0 2px 4px rgba(0,0,0,0.1));
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h4 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 16px;
}

.admin-footer {
    padding: 15px 40px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-secondary);
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 10;
}

.btn-back {
    background: var(--green-primary, #075e54);
    color: var(--text-light);
    text-decoration: none;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-back:hover {
    background: var(--green-dark, #054d44);
    transform: translateY(-1px);
}

/* Estilos para chat-box responsivo */
chat-box {
    display: block;
    width: 100%;
    height: 90%;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
    flex: 1;
}

.chat-input-area {
    width: 100%;
    min-width: 0;
    flex-shrink: 0;
}

.chat-input-container {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    width: 100%;
    max-width: 100%;
    padding: 16px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-primary);
}

.chat-input {
    flex: 1;
    min-width: 0;
    resize: none;
    padding: 12px 16px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    max-height: 120px;
    min-height: 44px;
}

.chat-send-btn,
.chat-attach-btn {
    padding: 10px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 44px;
    height: 44px;
}

.chat-send-btn {
    background: var(--color-primary);
    color: white;
}

.chat-attach-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Responsividade */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
    }

    .admin-footer {
        padding: 10px 24px;
    }
    
    .admin-content {
        padding: 24px;
        padding-bottom: 60px;
    }
    
    .stat-card {
        padding: 12px;
        gap: 10px;
    }
    
    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    .stat-number {
        font-size: 20px;
    }
    
    .stat-label {
        font-size: 11px;
    }
    
    .approved-users-section,
    .pending-users-section {
        max-height: none;
        top: 24px;
    }
}

@media (max-width: 640px) {
    .sidebar {
        width: 100%;
        position: absolute;
        z-index: 1000;
        transform: translateX(0);
        transition: transform 0.3s ease;
    }

    .app-container.sidebar-hidden .sidebar {
        display: block;
        transform: translateX(-100%);
    }

    .auth-container {
        width: 95%;
        max-width: none;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        margin: 0;
        max-height: 90vh;
    }

    .auth-form {
        padding: 24px;
    }

    .auth-header {
        padding: 24px;
    }

    .chat-input-container {
        flex-direction: column;
        gap: 12px;
    }

    .chat-send-btn,
    .chat-attach-btn {
        width: 100%;
        height: 48px;
    }

    .create-user-form input,
    .create-user-form button {
        flex: 1 1 100% !important;
    }
    .user-card {
        flex-direction: column;
    }

    .admin-footer {
        padding: 8px 16px;
    }
    
    .admin-content {
        padding: 16px;
        padding-bottom: 50px;
    }
    
    .stat-card {
        padding: 10px;
        gap: 8px;
    }
    
    .stat-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .stat-number {
        font-size: 18px;
    }
    
    .stat-label {
        font-size: 10px;
    }
    
    .approved-users-section,
    .pending-users-section {
        max-height: none;
        top: 16px;
    }
}

@media (max-width: 480px) {
    .auth-container {
        width: 100%;
        max-height: 85vh;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
}

.action-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.action-btn:active {
    transform: scale(0.95);
}

.round-btn {
    border-radius: 50% !important;
    width: 42px;
    height: 42px;
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.round-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.round-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.send-btn {
    background: var(--color-primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.send-btn:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
}

.send-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.send-btn.round-btn {
    background: var(--color-primary);
    border: 2px solid var(--color-primary);
    width: 42px;
    height: 42px;
}

.send-btn.round-btn:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

/* Chat Interface */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

.chat-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.chat-identity {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.assistant-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.assistant-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.assistant-details h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
}

.assistant-status {
    font-size: 0.85rem;
    color: var(--color-success);
    display: flex;
    align-items: center;
    gap: 4px;
}

.user-info {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.user-role {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.slogan, #chat-slogan {
    font-size: inherit;
}

.trust-indicators {
    margin-top: 16px;
    text-align: center;
}

.trust-indicators small {
    color: var(--color-success);
    font-weight: 500;
    display: block;
    margin-bottom: 8px;
}

.footer-links {
    margin-top: 8px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

/* CSS corrigido */

/* === Sidebar toggle === */
.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    color: var(--color-primary);
    margin-right: 10px;
    transition: transform 0.3s ease;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.sidebar-toggle:hover {
    transform: scale(1.1);
    background-color: rgba(7, 94, 84, 0.1);
}

/* estado oculto */
.app-container.sidebar-hidden .sidebar { /* removido: controlado por media query abaixo */ }
@media (min-width: 641px) {
  .app-container.sidebar-hidden .sidebar { display: none; }
}
.app-container.sidebar-hidden .chat-area { width: 100%; }

/* === Admin page scroll === */
body.admin-page {
  overflow: auto;
}
.admin-content {
  overflow-y: auto;
}

/* ============================ */
/* ESTILOS DO MODAL             */
/* ============================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-primary);
    padding: 32px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 450px;
    animation: fadeIn 0.3s ease-out;
}

.modal-content h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.modal-content p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.modal-actions {
    margin-top: 32px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.modal-actions .btn-primary {
    background-color: var(--color-primary);
    color: white;
}
.modal-actions .btn-primary:hover {
    background-color: var(--color-primary-hover);
}

.modal-actions .btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    border-color: var(--border-primary);
}
.modal-actions .btn-secondary:hover {
    background-color: var(--border-primary);
}

.history-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--icon-color); /* Usar cor de ícone padrão */
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; /* Tamanho consistente */
    height: 40px; /* Tamanho consistente */
    border-radius: 50%;
}

.history-toggle:hover {
    background-color: var(--bg-tertiary);
    color: var(--icon-hover-color);
}

/* Deixar o número de telefone do paciente em negrito no cabeçalho do chat */
.patient-phone {
    font-weight: bold;
}

/* Ajustar o tamanho da fonte do título no cabeçalho do chat para ser igual ao do número de telefone */
#chat-header-title {
    font-size: inherit;
}

/* Garantir que o scroll seja suave */
.users-container::-webkit-scrollbar {
    width: 8px;
}

.users-container::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md, 8px);
}

.users-container::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: var(--radius-md, 8px);
}

.users-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Estilos para o canvas de fundo com degradê animado */
#gradient-canvas {
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 0;
    --gradient-color-1: #2A9B7B;
    --gradient-color-2: #57C785;
    --gradient-color-3: #CEED53;
    --gradient-color-4: #A5D82E;
}