/**
 * EXP UNIFIED THEME - CSS MASTER
 * Baseado na interface "Enviar mensagens" (perfeita)
 * Substitui todas as cores roxas por azuis
 * Unifica todo o design do sistema
 */

/* ===== VARIÁVEIS CSS GLOBAIS ===== */
:root {
    /* Cores Principais - Azul (substituindo roxo) */
    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --primary-dark: #1d4ed8;
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    --primary-hover: rgba(59, 130, 246, 0.1);
    --primary-active: rgba(59, 130, 246, 0.2);
    
    /* Cores Secundárias */
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    
    /* Sombras e Efeitos */
    --card-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --hover-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --border-color: #e5e7eb;
    --text-secondary: #6b7280;
    
    /* WhatsApp Colors */
    --whatsapp-green: #25d366;
    --whatsapp-dark: #128c7e;
}

/* ===== RESET DE CORES ROXAS ===== */
/* Substituir todas as ocorrências de cores roxas */
[style*="#7367f0"], [style*="#667eea"], [style*="#764ba2"], [style*="#6f42c1"] {
    color: var(--primary) !important;
}

[style*="background: #7367f0"], [style*="background-color: #7367f0"],
[style*="background: #667eea"], [style*="background-color: #667eea"],
[style*="background: #764ba2"], [style*="background-color: #764ba2"],
[style*="background: #6f42c1"], [style*="background-color: #6f42c1"] {
    background: var(--primary) !important;
    background-color: var(--primary) !important;
}

/* ===== FONTE MELHORADA ===== */
* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ===== CARDS MODERNOS ===== */
.card, .sendmsg-section {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    border: none;
    margin-bottom: 25px;
}

.card:hover, .sendmsg-section:hover {
    transform: translateY(-2px);
    box-shadow: var(--hover-shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 25px 25px 20px 25px;
    border-radius: 16px 16px 0 0;
}

.card-body {
    padding: 25px;
}

/* ===== BOTÕES MODERNOS E ESPAÇAMENTOS ===== */

/* Botões Base */
.btn {
    border-radius: 12px;
    font-weight: 500;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    border: 2px solid transparent;
    line-height: 1.5;
    min-height: 44px; /* Altura mínima para acessibilidade */
}

/* Tamanhos de Botões */
.btn-sm, .btn.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 32px;
    border-radius: 6px;
    line-height: 1.4;
}

.btn-lg, .btn.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
    min-height: 48px;
    border-radius: 8px;
    line-height: 1.5;
}

.btn-xl, .btn.btn-xl {
    padding: 18px 36px;
    font-size: 18px;
    min-height: 56px;
    border-radius: 10px;
    line-height: 1.5;
}

/* Botão Primário */
.btn-primary, .btn.btn-primary {
    background: var(--primary-gradient);
    border: 2px solid transparent;
    padding: 12px 24px;
    color: white !important;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover, .btn.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--hover-shadow);
    background: var(--primary-dark);
    color: white !important;
}

.btn-primary:focus, .btn.btn-primary:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
    outline: none;
}

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

/* Botão Outline Primário */
.btn-outline-primary, .btn.btn-outline-primary {
    border: 2px solid var(--primary);
    color: var(--primary) !important;
    background: transparent;
    padding: 10px 22px;
}

.btn-outline-primary:hover, .btn.btn-outline-primary:hover {
    background: var(--primary);
    color: white !important;
    transform: translateY(-1px);
    box-shadow: var(--hover-shadow);
}

/* Botão Secundário */
.btn-secondary, .btn.btn-secondary {
    background: #6c757d;
    border: 2px solid #6c757d;
    padding: 12px 24px;
    color: white !important;
}

.btn-secondary:hover, .btn.btn-secondary:hover {
    background: #5a6268;
    border-color: #5a6268;
    transform: translateY(-1px);
    color: white !important;
}

/* Botão Success */
.btn-success, .btn.btn-success {
    background: var(--success-color);
    border: 2px solid var(--success-color);
    padding: 12px 24px;
    color: white !important;
}

.btn-success:hover, .btn.btn-success:hover {
    background: #059669;
    border-color: #059669;
    transform: translateY(-1px);
    color: white !important;
}

/* Botão Danger */
.btn-danger, .btn.btn-danger {
    background: var(--danger-color);
    border: 2px solid var(--danger-color);
    padding: 12px 24px;
    color: white !important;
}

.btn-danger:hover, .btn.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    transform: translateY(-1px);
    color: white !important;
}

/* Botão Warning */
.btn-warning, .btn.btn-warning {
    background: var(--warning-color);
    border: 2px solid var(--warning-color);
    padding: 12px 24px;
    color: white !important;
}

.btn-warning:hover, .btn.btn-warning:hover {
    background: #d97706;
    border-color: #d97706;
    transform: translateY(-1px);
    color: white !important;
}

/* Botão Info */
.btn-info, .btn.btn-info {
    background: var(--info-color);
    border: 2px solid var(--info-color);
    padding: 12px 24px;
    color: white !important;
}

.btn-info:hover, .btn.btn-info:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    color: white !important;
}

/* Botão Light */
.btn-light, .btn.btn-light {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    padding: 12px 24px;
    color: #495057 !important;
}

.btn-light:hover, .btn.btn-light:hover {
    background: #e2e6ea;
    border-color: #dae0e5;
    transform: translateY(-1px);
    color: #495057 !important;
}

/* ===== ESTRUTURAS PADRONIZADAS DE LAYOUT ===== */

/* Grupo de ações padrão - Header/Toolbar */
.actions-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.actions-group .btn {
    margin: 0 !important;
    margin-right: 2px !important;
}

.actions-group .btn:last-child {
    margin-right: 0 !important;
}

/* Grupo de ações principais - Cards/Forms */
.actions-primary {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.actions-primary .btn {
    margin: 0 !important;
    margin-right: 2px !important;
}

.actions-primary .btn:last-child {
    margin-right: 0 !important;
}

/* Grupo de ações inline - Tables/Lists */
.actions-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-wrap: wrap;
}

.actions-inline .btn {
    margin: 0 !important;
}

/* Grupo de ações full - Modal footers */
.actions-full {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
    width: 100%;
}

.actions-full .btn {
    margin: 0 !important;
    margin-right: 2px !important;
}

.actions-full .btn:last-child {
    margin-right: 0 !important;
}

/* ===== CORREÇÕES PARA CLASSES WAVES ===== */

/* Remover margens das classes waves que podem interferir */
.btn.waves-effect,
.btn.waves-float,
.btn.waves-light {
    margin-right: 0 !important;
    margin-left: 0 !important;
}

/* Regra removida - já definida individualmente acima */

/* Correção específica para .actions-inline */
.actions-inline {
    gap: 8px !important;
}

.actions-inline > .btn,
.actions-inline > a.btn {
    margin: 0 !important;
    margin-right: 2px !important;
    display: inline-flex;
    align-items: center;
}

.actions-inline > .btn:last-child,
.actions-inline > a.btn:last-child {
    margin-right: 0 !important;
}

/* Remover todas as margens Bootstrap que possam interferir */
.actions-inline .btn[class*="me-"],
.actions-primary .btn[class*="me-"],
.actions-group .btn[class*="me-"],
.actions-full .btn[class*="me-"] {
    margin-right: 2px !important;
    margin-left: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.actions-inline .btn[class*="me-"]:last-child,
.actions-primary .btn[class*="me-"]:last-child,
.actions-group .btn[class*="me-"]:last-child,
.actions-full .btn[class*="me-"]:last-child {
    margin-right: 0 !important;
}

/* Garantia anti-colagem - aplicar a TODOS os botões */
.btn {
    margin-right: 2px;
}

.btn:last-child,
.btn.btn:last-of-type {
    margin-right: 0;
}

/* Override específico para grupos organizados */
.actions-group .btn,
.actions-primary .btn,
.actions-inline .btn,
.actions-full .btn {
    margin-right: 2px !important;
}

.actions-group .btn:last-child,
.actions-primary .btn:last-child,
.actions-inline .btn:last-child,
.actions-full .btn:last-child {
    margin-right: 0 !important;
}

/* ===== PADRÕES DE CABEÇALHO ===== */

/* Cabeçalho padrão de lista */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding: 1rem;
}

.list-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.list-title h5 {
    margin: 0;
    font-weight: 600;
}

.list-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Padrão de pesquisa */
.search-input-group {
    display: flex;
    align-items: center;
    max-width: 300px;
}

/* ===== PADRÕES DE DROPDOWN ===== */

.dropdown-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.dropdown-menu .dropdown-item i {
    width: 16px;
    height: 16px;
    margin-right: 8px;
}

.dropdown-menu .dropdown-item:hover {
    background-color: var(--primary-hover);
    color: var(--primary);
}

/* ===== PADRÕES DE FORMULÁRIO ===== */

/* Formulário padrão */
.form-standard {
    padding: 1.5rem;
}

.form-standard .form-group {
    margin-bottom: 1.5rem;
}

.form-standard .form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
}

.form-standard .form-control {
    border-radius: 6px;
    border: 1px solid #d1d5db;
    padding: 0.75rem;
    transition: all 0.2s ease;
}

.form-standard .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-hover);
}

/* Modal forms */
.modal .form-standard {
    padding: 0;
}

.modal-body .actions-full {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Form actions específicas */
.form-actions-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.form-actions-stacked {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 1.5rem;
}

/* ===== ESPAÇAMENTOS E GRUPOS DE BOTÕES ===== */

/* Espaçamento padrão entre botões */
.btn + .btn {
    margin-left: 12px;
}

/* Correção para botões inline sem wrapper */
a.btn + a.btn,
button.btn + a.btn,
a.btn + button.btn {
    margin-left: 8px;
}

/* Botões em listas */
li .btn + .btn {
    margin-left: 8px;
}

/* Correção global para botões sem margem apropriada */
.btn:not(:last-child):not(.dropdown-toggle):not(.actions-group .btn):not(.actions-primary .btn):not(.actions-inline .btn):not(.actions-full .btn) {
    margin-right: 8px;
}

/* Espaçamento mínimo para botões consecutivos fora de grupos */
.btn + .btn:not(.actions-group .btn):not(.actions-primary .btn):not(.actions-inline .btn):not(.actions-full .btn) {
    margin-left: 8px;
}

/* Override removido - já está definido acima */

/* Garantir espaçamento em containers flexbox */
.d-flex .btn:not(:last-child),
.d-inline-flex .btn:not(:last-child) {
    margin-right: 8px;
}

/* Correção para botões em input-group */
.input-group .btn {
    margin-right: 0;
}

/* Grupos de botões em toolbars e headers */
.input-group .btn + .btn,
.card-header .btn + .btn,
.toolbar .btn + .btn {
    margin-left: 6px;
}

/* Botões float-end consecutivos */
.float-end + .float-end {
    margin-right: 6px;
}

/* Fix para botões consecutivos com float-end */
.float-end.btn + .float-end.btn {
    margin-left: 0;
    margin-right: 6px;
}

.btn + .dropdown-toggle-split {
    margin-left: 0;
}

/* Grupos de Botões Horizontais */
.btn-group {
    display: inline-flex;
    gap: 0;
    border-radius: 12px;
    overflow: hidden;
}

.btn-group .btn {
    margin: 0;
    border-radius: 0;
    position: relative;
    z-index: 1;
}

.btn-group .btn:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.btn-group .btn:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.btn-group .btn:not(:first-child) {
    margin-left: -2px;
}

.btn-group .btn:hover,
.btn-group .btn:focus,
.btn-group .btn:active {
    z-index: 2;
}

/* Grupos de Botões Verticais */
.btn-group-vertical {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
}

.btn-group-vertical .btn {
    width: 100%;
    margin: 0;
}

.btn-group-vertical .btn + .btn {
    margin-left: 0;
    margin-top: 2px;
}

/* Toolbar de Botões */
.btn-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.btn-toolbar .btn-group {
    margin: 0;
}

/* ===== ESPAÇAMENTOS EM CONTAINERS ===== */

/* Cards com botões */
.card-footer .btn,
.card-body .btn:last-child {
    margin-bottom: 0;
}

.card-footer {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
}

.card-footer.text-center {
    justify-content: center;
}

.card-footer.text-start {
    justify-content: flex-start;
}

/* Modal com botões */
.modal-footer {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
}

.modal-footer .btn {
    margin: 0;
}

/* Card Footer Actions */
.card-footer .btn + .btn,
.card-actions .btn + .btn {
    margin-left: 8px;
}

/* Dropdown Button Groups */
.btn-group > .btn + .btn {
    margin-left: 0;
}

.btn-group > .btn:not(:first-child) {
    border-left: 0;
}

/* Formulários com botões */
.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.form-actions.text-center {
    justify-content: center;
}

.form-actions.text-start {
    justify-content: flex-start;
}

/* Botões de ação em tabelas */
.table .btn {
    padding: 6px 12px;
    font-size: 14px;
    min-height: 32px;
}

.table .btn + .btn {
    margin-left: 6px;
}

/* Botões de navegação/paginação */
.pagination-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
}

/* ===== BOTÕES ESPECIAIS ===== */

/* Botão com ícone */
.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
}

.btn-icon.btn-lg {
    width: 48px;
    height: 48px;
}

/* Botão com ícone e texto */
.btn i, .btn svg {
    margin-right: 8px;
}

.btn i:last-child, .btn svg:last-child {
    margin-right: 0;
    margin-left: 8px;
}

.btn-icon i, .btn-icon svg {
    margin: 0;
}

/* Botão flutuante/FAB */
.btn-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    z-index: 1000;
    padding: 0;
}

.btn-float:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 24px rgba(0,0,0,0.4);
}

/* Estados especiais */
.btn:disabled, .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn.loading {
    position: relative;
    color: transparent !important;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: btn-loading 0.8s linear infinite;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    color: white;
}

@keyframes btn-loading {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== FORMULÁRIOS MODERNOS ===== */
.form-control, .form-select {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 15px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: white;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-hover);
}

.form-label {
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

/* ===== MENU LATERAL ===== */
.main-menu {
    background: white;
    box-shadow: var(--card-shadow);
}

.main-menu .navigation .nav-item.active > a,
.main-menu .navigation .nav-item.active > a:hover,
.main-menu .navigation .nav-item.active > a:focus {
    background: var(--primary-gradient) !important;
    color: white !important;
    border-radius: 8px !important;
    margin: 4px 8px !important;
}

.main-menu .navigation .nav-item > a:hover {
    background: var(--primary-hover) !important;
    color: var(--primary) !important;
    border-radius: 8px !important;
    margin: 4px 8px !important;
}

.main-menu .navigation .nav-item > a {
    transition: all 0.3s ease;
    padding: 12px 16px;
    margin: 2px 8px;
    border-radius: 8px;
}

/* ===== HEADER/NAVBAR ===== */
.header-navbar {
    background: white;
    box-shadow: var(--card-shadow);
}

.navbar-brand .brand-text {
    color: var(--primary) !important;
}

/* ===== TABELAS ===== */
.table {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.table thead th {
    background: #f8f9fa;
    border: none;
    color: #374151;
    font-weight: 600;
    padding: 15px;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

.table tbody td {
    padding: 15px;
    border: none;
    border-bottom: 1px solid #f1f5f9;
}

/* ===== BADGES/TAGS ===== */
.badge-primary {
    background: var(--primary) !important;
    color: white !important;
}

.badge-light-primary {
    background: var(--primary-hover) !important;
    color: var(--primary) !important;
}

/* ===== ALERTAS ===== */
.alert-primary {
    background: var(--primary-hover);
    border: 1px solid var(--primary-light);
    color: var(--primary-dark);
    border-radius: 12px;
}

/* ===== DROPDOWNS ===== */
.dropdown-menu {
    border-radius: 12px;
    border: none;
    box-shadow: var(--hover-shadow);
    padding: 8px;
}

.dropdown-item {
    border-radius: 8px;
    margin: 2px 0;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background: var(--primary-hover);
    color: var(--primary);
}

/* ===== MODAIS ===== */
.modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: var(--hover-shadow);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 24px;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 24px;
}

/* ===== PAGINAÇÃO ===== */
.page-link {
    border: 2px solid var(--border-color);
    color: var(--primary);
    border-radius: 8px;
    margin: 0 2px;
    transition: all 0.3s ease;
}

.page-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ===== STATS CARDS (DA INTERFACE PERFEITA) ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--hover-shadow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 12px;
}

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

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== GRID SYSTEM ===== */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
}

@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== LOADING STATES ===== */
.loading-spinner {
    border: 3px solid var(--primary-hover);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== RESPONSIVIDADE DAS ESTRUTURAS ===== */

/* Mobile: Stacking dos grupos de ações */
@media (max-width: 768px) {
    .actions-group {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    
    .actions-group .btn {
        margin-right: 0 !important;
        margin-bottom: 2px !important;
    }
    
    .actions-group .btn:last-child {
        margin-bottom: 0 !important;
    }
    
    .actions-primary {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .actions-primary .btn {
        margin-right: 0 !important;
        margin-bottom: 2px !important;
    }
    
    .actions-primary .btn:last-child {
        margin-bottom: 0 !important;
    }
    
    .actions-inline {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }
    
    .actions-inline .btn {
        margin-right: 0 !important;
        margin-bottom: 2px !important;
    }
    
    .actions-inline .btn:last-child {
        margin-bottom: 0 !important;
    }
    
    .actions-full {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .actions-full .btn {
        margin-right: 0 !important;
        margin-bottom: 2px !important;
    }
    
    .actions-full .btn:last-child {
        margin-bottom: 0 !important;
    }
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
    .card, .sendmsg-section {
        margin: 0 10px 20px 10px;
        padding: 20px;
    }
    
    /* Botões em telas pequenas */
    .btn {
        min-height: 48px; /* Altura maior para touch */
        font-size: 16px; /* Evita zoom no iOS */
    }
    
    .btn-sm {
        min-height: 40px;
        font-size: 13px;
        padding: 8px 14px;
    }
    
    .btn-lg {
        min-height: 52px;
        font-size: 17px;
        padding: 12px 24px;
    }
    
    /* Botões em formulários móveis */
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-actions .btn {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .form-actions .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Grupos de botões mobile - stack vertical */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        border-radius: 6px;
        margin-bottom: 4px;
        width: 100%;
    }
    
    .btn-group .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Card footers em mobile */
    .card-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .card-footer .btn {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .card-footer .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Modal footers em mobile */
    .modal-footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .modal-footer .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Btn groups em mobile */
    .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
        border-radius: 12px;
    }
    
    .btn-group .btn {
        border-radius: 0;
        margin: 0;
        border-bottom: 1px solid rgba(255,255,255,0.2);
    }
    
    .btn-group .btn:first-child {
        border-top-left-radius: 12px;
        border-top-right-radius: 12px;
        border-bottom-left-radius: 0;
    }
    
    .btn-group .btn:last-child {
        border-bottom-left-radius: 12px;
        border-bottom-right-radius: 12px;
        border-top-right-radius: 0;
        border-bottom: none;
    }
    
    /* Toolbar em mobile */
    .btn-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .btn-toolbar .btn-group {
        width: 100%;
    }
    
    /* Botões em tabelas em mobile */
    .table .btn {
        font-size: 12px;
        padding: 4px 8px;
        min-height: 32px;
    }
    
    /* Espaçamento entre botões consecutivos em mobile */
    .btn + .btn {
        margin-left: 0;
        margin-top: 8px;
    }
    
    /* Menos espaço em grupos horizontais em mobile */
    .d-flex .btn + .btn {
        margin-top: 0;
        margin-left: 8px;
    }
}

@media (max-width: 576px) {
    /* Botões ainda menores em telas muito pequenas */
    .btn {
        padding: 14px 20px;
        font-size: 15px;
    }
    
    .btn-sm {
        padding: 8px 14px;
        font-size: 12px;
    }
    
    .btn-lg {
        padding: 18px 24px;
        font-size: 17px;
    }
    
    /* Botão flutuante menor */
    .btn-float {
        width: 48px;
        height: 48px;
        bottom: 16px;
        right: 16px;
    }
    
    /* Ícones menores em botões pequenos */
    .btn i, .btn svg {
        font-size: 14px;
        width: 14px;
        height: 14px;
    }
    
    .btn-icon {
        width: 40px;
        height: 40px;
    }
}

/* Breakpoint para tablets (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .btn {
        padding: 10px 20px;
        font-size: 15px;
        min-height: 42px;
    }
    
    .btn-sm {
        padding: 6px 14px;
        font-size: 13px;
        min-height: 36px;
    }
    
    .btn-lg {
        padding: 12px 26px;
        font-size: 17px;
        min-height: 50px;
    }
    
    /* Botões em grupos horizontais em tablet */
    .btn + .btn {
        margin-left: 10px;
    }
    
    .input-group .btn + .btn {
        margin-left: 4px;
    }
}

/* Breakpoint para desktop (acima de 1024px) */
@media (min-width: 1024px) {
    /* Garantir que botões tenham espaçamento adequado */
    .btn + .btn {
        margin-left: 12px;
    }
    
    /* Grupos de botões em desktop */
    .btn-toolbar .btn-group + .btn-group {
        margin-left: 16px;
    }
    
    /* Botões em cards grandes */
    .card-lg .btn {
        padding: 12px 24px;
        font-size: 16px;
    }
}

/* ===== MELHORIAS PARA ACESSIBILIDADE ===== */
@media (prefers-reduced-motion: reduce) {
    .btn {
        transition: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    .btn-loading::after {
        animation: none;
    }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    .btn-light {
        background: #343a40;
        border-color: #495057;
        color: #f8f9fa !important;
    }
    
    .btn-light:hover {
        background: #495057;
        border-color: #6c757d;
        color: #f8f9fa !important;
    }
}

/* ===== WHATSAPP SPECIFIC ===== */
.whatsapp-status.connected {
    color: var(--whatsapp-green);
}

.whatsapp-status.disconnected {
    color: var(--danger-color);
}

.device-card.selected {
    border: 2px solid var(--primary);
    background: var(--primary-hover);
}

/* ===== CLASSES DE UTILIDADE PARA BOTÕES ===== */

/* Espaçamentos específicos */
.btn-spacing-sm {
    margin-right: 8px;
    margin-bottom: 8px;
}

.btn-spacing-md {
    margin-right: 12px;
    margin-bottom: 12px;
}

.btn-spacing-lg {
    margin-right: 16px;
    margin-bottom: 16px;
}

/* Grupos de ação comuns */
.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 20px;
}

.action-buttons.center {
    justify-content: center;
}

.action-buttons.end {
    justify-content: flex-end;
}

.action-buttons.start {
    justify-content: flex-start;
}

.action-buttons.between {
    justify-content: space-between;
}

/* Botões de status */
.btn-status {
    position: relative;
    padding-left: 32px;
}

.btn-status::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.btn-status.status-online::before {
    background: var(--whatsapp-green);
}

.btn-status.status-offline::before {
    background: var(--danger-color);
}

.btn-status.status-connecting::before {
    background: var(--warning-color);
    animation: pulse 1.5s infinite;
}

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

/* Botões WhatsApp específicos */
.btn-whatsapp {
    background: var(--whatsapp-green);
    border-color: var(--whatsapp-green);
    color: white !important;
}

.btn-whatsapp:hover {
    background: var(--whatsapp-dark);
    border-color: var(--whatsapp-dark);
    color: white !important;
}

.btn-outline-whatsapp {
    border: 2px solid var(--whatsapp-green);
    color: var(--whatsapp-green) !important;
    background: transparent;
}

.btn-outline-whatsapp:hover {
    background: var(--whatsapp-green);
    color: white !important;
}

/* Botões com badges/contadores */
.btn-with-badge {
    position: relative;
}

.btn-with-badge .badge {
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 10px;
    padding: 4px 6px;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--danger-color);
    color: white;
    border: 2px solid white;
}

/* Botões de confirmação/destructivos */
.btn-confirm {
    background: var(--success-color);
    border-color: var(--success-color);
}

.btn-confirm:hover {
    background: #047857;
    border-color: #047857;
}

.btn-destructive {
    background: var(--danger-color);
    border-color: var(--danger-color);
}

.btn-destructive:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

/* Botões sem margem para casos específicos */
.btn-no-margin {
    margin: 0 !important;
}

.btn-full-width {
    width: 100% !important;
    display: flex !important;
}

/* Correções para botões em componentes específicos */
.dataTables_wrapper .btn {
    margin: 2px;
}

.dataTables_wrapper .btn + .btn {
    margin-left: 4px;
}

.select2-container .btn {
    height: auto !important;
    min-height: 38px;
}

/* Botões em cards específicos do sistema */
.device-card .btn,
.message-card .btn,
.contact-card .btn {
    font-size: 14px;
    padding: 8px 16px;
    min-height: 36px;
}

/* Botões de ação rápida */
.quick-actions {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
}

.quick-actions .btn {
    border-radius: 50%;
    width: 56px;
    height: 56px;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Estados de carregamento específicos */
.btn.sending {
    position: relative;
    color: transparent !important;
}

.btn.sending::after {
    content: '📤';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: bounce 1s infinite;
    color: white;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translate(-50%, -50%) translateY(0); }
    40% { transform: translate(-50%, -50%) translateY(-6px); }
    60% { transform: translate(-50%, -50%) translateY(-3px); }
}

/* Fix para botões que estão sendo cortados */
.btn-container {
    overflow: visible !important;
    padding: 4px;
}

/* Melhorias para botões em modais */
.modal .btn {
    min-width: 100px;
}

.modal .btn-sm {
    min-width: 80px;
}

.modal .btn-lg {
    min-width: 120px;
}

/* ===== OVERRIDE DE CORES ESPECÍFICAS ===== */
/* Menu ativo */
.vertical-menu-modern .main-menu .navigation > li > a.active,
.vertical-menu-modern .main-menu .navigation > li.active > a {
    background: var(--primary-gradient) !important;
    color: white !important;
}

/* Links primários */
a.text-primary, .text-primary {
    color: var(--primary) !important;
}

/* Backgrounds primários */
.bg-primary {
    background: var(--primary-gradient) !important;
}

/* Borders primários */
.border-primary {
    border-color: var(--primary) !important;
}

/* ===== ANIMAÇÕES SUAVES ===== */
* {
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* ===== FIM DO CSS UNIFICADO ===== */