/* ============================================
   UAZAPI - Painel Administrativo
   Stylesheet Principal
   ============================================ */

/* ============================================
   IMPORTAÇÕES E FONTES
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ============================================
   RESET E CONFIGURAÇÕES GLOBAIS
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Remove outline de links e botões */
a,
button,
.whatsapp-float,
.whatsapp-button {
    outline: none !important;
}

a:focus,
button:focus {
    outline: none !important;
}

/* ============================================
   VARIÁVEIS CSS - TEMA CLARO
   ============================================ */
:root {
    /* Cores Primárias */
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --warning-color: #f59e0b;

    /* Cores de Texto */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;

    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

    /* Bordas e Sombras */
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ============================================
   VARIÁVEIS CSS - TEMA ESCURO
   ============================================ */
[data-theme="dark"] {
    /* Cores de Texto */
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;

    /* Backgrounds */
    --bg-primary: #1f2937;
    --bg-secondary: #111827;
    --bg-gradient: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);

    /* Bordas e Sombras */
    --border-color: #374151;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.85);
}

[data-theme="dark"] .qr-image {
    background: white !important;
}

/* ============================================
   BODY E ESTRUTURA BASE
   ============================================ */
body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    margin: 0 auto;
}

.hidden {
    display: none;
}

/* Bootstrap Icons nos cards */
.instance-info .info-item i {
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.stat-icon i {
    font-size: 38px;
}

.btn-small i {
    font-size: 13px;
}

.search-icon i {
    font-size: 18px;
}

/* ============================================
   PÁGINA DE LOGIN
   ============================================ */
.login-container {
    max-width: 420px;
    margin: 0 auto;
}

.login-card {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo h1 {
    font-size: 27px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.logo p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ============================================
   FORMULÁRIOS
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.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: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    transition: all 0.2s;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group input:disabled {
    background: var(--bg-secondary);
    cursor: not-allowed;
    opacity: 0.7;
}

.help-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ============================================
   BOTÕES
   ============================================ */
.btn {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-logout {
    padding: 10px 20px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #dc2626;
}

.btn-cancel-delete {
    padding: 10px 20px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    transition: all 0.2s;
}

.btn-cancel-delete:hover {
    background: #dc2626;
}

.btn-edit {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-edit:hover {
    background: var(--primary-hover);
}

.btn-theme {
    padding: 10px 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}

.btn-theme:hover {
    background: var(--bg-primary);
    border-color: var(--primary-color);
}

.btn-small {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small.primary {
    background: var(--primary-color);
    color: white;
}

.btn-small.primary:hover {
    background: var(--primary-hover);
}

.btn-small.secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-small.secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-small.danger {
    background: var(--danger-color);
    color: white;
}

.btn-small.danger:hover {
    background: #dc2626;
}

.btn-action {
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    color: var(--text-primary);
}

.btn-action:hover {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
    transform: translateY(-2px);
}

/* .btn-floating {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
} */

/* .btn-floating:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.5);
} */

.copy-button {
    width: 100%;
    padding: 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.copy-button:hover {
    background: var(--primary-hover);
}

.copy-button.copied {
    background: var(--success-color);
}

/* ============================================
   ALERTAS
   ============================================ */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.alert.show {
    display: block;
    animation: slideDown 0.3s ease;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-info {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 16px;
    border: 1px solid rgba(79, 70, 229, 0.2);
}

/* ============================================
   DASHBOARD
   ============================================ */
.dashboard {
    display: none;
}

.dashboard.active {
    display: block;
}

/* ============================================
   HEADER DO DASHBOARD
   ============================================ */
.header {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.header-info h2 {
    font-size: 24px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.header-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

.header-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* ============================================
   BARRA DE BUSCA
   ============================================ */
.search-container {
    width: 100%;
    margin-bottom: 24px;
}

.search-box {
    position: relative;
    width: 100%;
    max-width: 100%;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 18px;
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    display: none;
}

.search-clear:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.search-clear.show {
    display: block;
}

.search-results-info {
    margin-top: 8px;
    font-size: 13px;
    color: #fff;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-primary);
}

.no-results-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ============================================
   CARDS DE ESTATÍSTICAS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.primary {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

.stat-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.stat-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.stat-content h3 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-content p {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.progress-fill.warning {
    background: var(--warning-color);
}

.progress-fill.danger {
    background: var(--danger-color);
}

/* ============================================
   SEÇÃO DE INSTÂNCIAS
   ============================================ */
/* Cabeçalho da seção de instâncias */
.instances-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.instances-section-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-add-instance {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.btn-add-instance:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.btn-add-instance i {
    font-size: 18px;
}

/* Responsivo */
@media (max-width: 768px) {
    .instances-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .btn-add-instance {
        width: 100%;
        justify-content: center;
    }
}


.instances-section {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.instances-section h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.instances-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.instance-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
    background: var(--bg-secondary);
}

.instance-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.instance-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 16px;
}

.instance-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.instance-name-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.btn-edit-name {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-edit-name:hover {
    background: var(--bg-primary);
    color: var(--primary-color);
    transform: scale(1.1);
}

.btn-edit-name i {
    font-size: 12px;
}

.instance-id {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

.instance-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-connected {
    background: #d1fae5;
    color: #065f46;
}

.status-disconnected {
    background: #fee2e2;
    color: #991b1b;
}

.status-connecting {
    background: #fef3c7;
    color: #92400e;
}

.instance-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.info-item strong {
    color: var(--text-primary);
}

.instance-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.instance-actions button {
    width: 100%;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    margin-bottom: 16px;
}

.loading-instances {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    display: none;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    position: relative;
    z-index: 1001;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-content {
    color: var(--text-primary);
}

/* ============================================
   QR CODE
   ============================================ */
.qr-container {
    text-align: center;
    padding: 20px;
}

.qr-image {
    max-width: 100%;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    background: white;
    margin-bottom: 16px;
}

.qr-instructions {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    text-align: left;
}

.qr-instructions h4 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.qr-instructions ol {
    margin-left: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.qr-instructions li {
    margin-bottom: 8px;
}

.qr-timer {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 12px;
}

.qr-timer strong {
    color: var(--primary-color);
    font-size: 16px;
}

.qr-timer.refreshing {
    color: var(--warning-color);
}



/* ============================================
   WEBHOOK
   ============================================ */
.webhook-info {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.webhook-url {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    word-break: break-all;
    margin: 12px 0;
}

.webhook-form {
    padding: 20px 0;
}

.webhook-form .form-group {
    margin-bottom: 20px;
}

.webhook-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.webhook-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    transition: all 0.2s;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.webhook-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.webhook-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.webhook-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ============================================
   CHECKBOX E TOGGLE
   ============================================ */
.webhook-form .checkbox-group {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.webhook-form .checkbox-group:hover {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.webhook-form .checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.webhook-form .checkbox-group label {
    margin: 0;
    cursor: pointer;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.webhook-form .checkbox-group label .checkbox-title {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.webhook-form .checkbox-group label .checkbox-description {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: normal;
}

.toggle-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    transition: all 0.2s;
}

.toggle-group:hover {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.toggle-group .toggle-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toggle-group .toggle-title {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.toggle-group .toggle-description {
    font-size: 12px;
    color: var(--text-secondary);
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--success-color);
}

input:checked+.slider:before {
    transform: translateX(24px);
}

input:disabled+.slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.toggle-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.toggle-status.active {
    background: #d1fae5;
    color: #065f46;
}

.toggle-status.inactive {
    background: #fee2e2;
    color: #991b1b;
}

/* ============================================
   PERFIL
   ============================================ */
.profile-form {
    padding: 20px 0;
}

.profile-form .form-group {
    margin-bottom: 20px;
}

.profile-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.profile-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    transition: all 0.2s;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.profile-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.profile-form input:disabled {
    background: var(--bg-secondary);
    cursor: not-allowed;
    opacity: 0.7;
}

.profile-form .help-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.profile-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.profile-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ============================================
   CONFIRMAÇÕES E AÇÕES
   ============================================ */
.delete-confirmation {
    padding: 20px;
    text-align: center;
}

.delete-confirmation .instance-name-highlight {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 16px;
    margin: 16px 0;
}

.delete-confirmation .warning-text {
    background: #fef3c7;
    color: #92400e;
    padding: 12px;
    border-radius: 8px;
    margin: 16px 0;
    font-size: 13px;
    border: 1px solid #fde68a;
}

.delete-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.delete-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.delete-actions {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.delete-actions:hover {
    background: var(--border-color);
}

.delete-actions .btn-confirm-delete {
    background: var(--danger-color);
    color: white;
}

.delete-actions .btn-confirm-delete:hover:not(:disabled) {
    background: #dc2626;
}

.delete-actions .btn-confirm-delete:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.success-icon {
    font-size: 48px;
    margin-bottom: 16px;
    text-align: center;
}

.success-message {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-actions .btn-cancel {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.modal-actions .btn-cancel:hover {
    background: var(--border-color);
}

.modal-actions .btn-confirm {
    background: var(--primary-color);
    color: white;
}

.modal-actions .btn-confirm:hover:not(:disabled) {
    background: var(--primary-hover);
}

.modal-actions .btn-confirm:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-modal {
    margin-bottom: 16px;
}

.form-modal label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-modal input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    transition: all 0.2s;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-modal input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.instance-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.instance-actions>*:last-child {
    grid-column: 1 / -1;
}

/* ============================================
   Dropdown de Ações
   ============================================ */

/* Dropdown de Integrações */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    padding: 10px 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    justify-content: center;
}

.dropdown-toggle:hover {
    background: var(--primary-hover);
}

.dropdown-toggle i.bi-chevron-down {
    font-size: 10px;
    transition: transform 0.2s;
}

.dropdown.active .dropdown-toggle i.bi-chevron-down {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.dropdown.active .dropdown-menu {
    display: block;
    animation: slideDown 0.2s ease;
}

.dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: 'Poppins', sans-serif;
}

.dropdown-item:hover {
    background: var(--bg-secondary);
}

.dropdown-item:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.dropdown-item i {
    font-size: 14px;
    width: 16px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   SPINNER E LOADING
   ============================================ */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ============================================
   ANIMAÇÕES
   ============================================ */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */
@media (max-width: 768px) {
    .login-card {
        padding: 24px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .header-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .search-container {
        margin-bottom: 16px;
    }

    .search-box {
        max-width: 100%;
    }

    .btn-floating {
        bottom: 16px;
        right: 16px;
    }

    .instances-grid {
        grid-template-columns: 1fr;
    }

    .instance-actions {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Botão WhatsApp Flutuante 
   ============================================ */

.whatsapp-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    transition: all 0.3s ease;
    outline: none !important;
}

.whatsapp-button {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #25D366;
    color: white;
    padding: 14px 14px;
    border-radius: 50px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    max-width: 56px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 14px;
    outline: none !important;
}

.whatsapp-button:hover {
    background: #128C7E;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
    max-width: 300px;
    padding: 14px 24px;
    outline: none !important;
}

.whatsapp-button:focus {
    outline: none !important;
    /* Remove outline no focus */
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.whatsapp-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.whatsapp-icon i {
    font-size: 28px;
}

.whatsapp-text {
    opacity: 0;
    transition: opacity 0.3s ease 0.1s;
    white-space: nowrap;
}

.whatsapp-button:hover .whatsapp-text {
    opacity: 1;
}

/* Animação de pulso */
@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    }

    50% {
        box-shadow: 0 4px 20px rgba(37, 211, 102, 0.7);
    }

    100% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    }
}

.whatsapp-button {
    animation: pulse 2s infinite;
}

.whatsapp-button:hover {
    animation: none;
}

/* Responsivo */
@media (max-width: 768px) {
    .whatsapp-float {
        bottom: 16px;
        right: 16px;
    }

    .whatsapp-button {
        padding: 12px 16px;
        max-width: 50px;
    }

    .whatsapp-icon {
        width: 24px;
        height: 24px;
    }

    .whatsapp-icon i {
        font-size: 24px;
    }

    .whatsapp-button:hover {
        max-width: 280px;
        padding: 12px 20px;
    }
}

/* ============================================
   TAGS - COMPONENTES BÁSICOS
   ============================================ */
.instance-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.instance-tag i {
    font-size: 10px;
}

.instance-tag.removable {
    padding-right: 6px;
}

.instance-tag.addable:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.remove-tag-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 4px;
    padding: 0;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.remove-tag-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    color: var(--danger-color);
}

.remove-tag-btn i {
    font-size: 10px;
}

.no-tags {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Tags no Card de Instância */
.instance-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.instance-tags-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.btn-manage-tags {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    border-radius: 20px;
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-manage-tags:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.btn-manage-tags i {
    font-size: 10px;
}

/* ============================================
   FILTRO DE TAGS NA BUSCA
   ============================================ */
.search-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-filters {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
}

.tag-filter-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tag-filter-wrapper label {
    font-size: 13px;
    color: #fff;
    white-space: nowrap;
}

#tagFilter {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    min-width: 160px;
    cursor: pointer;
    transition: all 0.2s;
}

#tagFilter:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

#tagFilter:hover {
    border-color: var(--primary-color);
}

.btn-manage-all-tags {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-manage-all-tags:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.btn-manage-all-tags i {
    font-size: 14px;
}

/* ============================================
   MODAL DE GERENCIAMENTO DE TAGS
   ============================================ */
.tags-manager {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.create-tag-section,
.tags-list-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
}

.create-tag-section h4,
.tags-list-section h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.create-tag-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    margin-bottom: 0;
}

.color-picker {
    width: 100%;
    height: 42px;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    background: var(--bg-primary);
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-picker::-webkit-color-swatch {
    border-radius: 4px;
    border: none;
}

.btn-create-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-create-tag:hover {
    background: var(--primary-hover);
}

.btn-create-tag:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Lista de Tags */
.tags-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.tag-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.tag-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tag-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.tag-badge i {
    font-size: 11px;
}

.tag-count {
    font-size: 12px;
    color: var(--text-secondary);
}

.tag-desc {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
}

.btn-delete-tag {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete-tag:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.empty-tags {
    text-align: center;
    padding: 32px;
    color: var(--text-secondary);
}

.empty-tags i {
    font-size: 32px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-tags p {
    font-size: 14px;
}

/* ============================================
   MODAL DE TAGS DA INSTÂNCIA
   ============================================ */
.instance-tags-manager {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.instance-info-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 10px;
    font-weight: 500;
    color: var(--text-primary);
}

.instance-info-header i {
    color: var(--primary-color);
}

.current-tags-section,
.add-tag-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
}

.current-tags-section h4,
.add-tag-section h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.current-tags,
.available-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.no-available-tags {
    text-align: center;
    padding: 16px;
    color: var(--text-secondary);
    font-size: 13px;
}

.no-available-tags a {
    color: var(--primary-color);
    text-decoration: none;
}

.no-available-tags a:hover {
    text-decoration: underline;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */
@media (max-width: 768px) {
    .search-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        min-width: 100%;
    }

    .tag-filter-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .tag-filter-wrapper label {
        margin-bottom: 4px;
    }

    #tagFilter {
        width: 100%;
    }

    .btn-manage-all-tags {
        width: 100%;
        justify-content: center;
    }

    .form-row {
        flex-direction: column;
    }

    .tag-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .btn-delete-tag {
        align-self: flex-end;
    }

    .instance-tags-container {
        flex-direction: column;
    }
}

/* Tema escuro - ajustes específicos para tags */
[data-theme="dark"] .tag-item {
    background: var(--bg-secondary);
}

[data-theme="dark"] .create-tag-section,
[data-theme="dark"] .tags-list-section,
[data-theme="dark"] .current-tags-section,
[data-theme="dark"] .add-tag-section {
    background: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .color-picker {
    background: var(--bg-secondary);
}

[data-theme="dark"] .btn-manage-tags:hover {
    background: rgba(79, 70, 229, 0.15);
}

[data-theme="dark"] .btn-manage-all-tags:hover {
    background: rgba(79, 70, 229, 0.15);
}


/* ============================================
   FIM DO ARQUIVO CSS
   ============================================ */