/* Reset e configurações básicas */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --accent-color: #06b6d4;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    --border-color: #334155;
    --border-light: #475569;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.alert {
    position: relative;
    min-width: 320px;
    max-width: 90vw;
    margin: 0 auto 8px auto;
    padding: 1rem 2.5rem 1rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 24px #0006;
    font-size: 1.08rem;
    font-family: 'Inter', Arial, sans-serif;
    z-index: 9999;
    text-align: center;
    opacity: 0.98;
    background: #23272f;
    color: #fff;
    border: 1.5px solid transparent;
    animation: fadeInDown 0.5s;
    transition: opacity 0.3s;
}

.alert-success {
    background: linear-gradient(90deg, #10b981 80%, #23272f 100%);
    color: #fff;
    border-color: #10b981;
}

.alert-error {
    background: linear-gradient(90deg, #ef4444 80%, #23272f 100%);
    color: #fff;
    border-color: #ef4444;
}

.alert-warning {
    background: linear-gradient(90deg, #f59e0b 80%, #23272f 100%);
    color: #fff;
    border-color: #f59e0b;
}

#alertContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    z-index: 9999;
}

@media (max-width: 480px) {
    .alert { font-size: 0.98rem; min-width: 90vw; padding: 0.75rem 1rem; }
}


.alert-success {
    background: var(--success-color);
    color: #fff;
}

.alert-error {
    background: var(--error-color);
    color: #fff;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-40px) translateX(-50%); }
    to { opacity: 0.98; transform: translateY(0) translateX(-50%); }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a202c 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Layout principal */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 2rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: var(--transition);
    z-index: 1000;
}

.sidebar-header {
    padding: 0 2rem 2rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo a {
    color: #ffffff; /* Define a cor do link do logo como branco */
    text-decoration: none; /* Remove o sublinhado do link */
    display: flex; /* Garante o alinhamento do ícone e texto */
    align-items: center;
}

.logo::before {
    content: "📱";
    font-size: 2rem;
}

.nav-menu {
    list-style: none;
    padding: 0 1rem;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary-color);
    color: white;
    transform: translateX(4px);
}

.nav-link::before {
    width: 20px;
    text-align: center;
}

.nav-link[href*="dashboard"]::before { content: "🏠"; }
.nav-link[href*="whatsapp"]::before { content: "📱"; }
.nav-link[href*="agendar"]::before { content: "📅"; }
.nav-link[href*="mensagens"]::before { content: "💬"; }
.nav-link[href*="logout"]::before { content: "🚪"; }

/* Conteúdo principal */
.main-content {
    flex: 1;
    margin-left: 280px;
    background: var(--bg-primary);
}

.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
}

.content {
    padding: 2rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-lg);
}

.card-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.card-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Formulários */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

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

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-error {
    background: var(--error-color);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

/* Tabelas */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    color: var(--text-secondary);
}

.table tbody tr:hover {
    background: var(--bg-tertiary);
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-pendente {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
}

.status-pendente::before {
    background: #fbbf24;
}

.status-enviado {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.status-enviado::before {
    background: #10b981;
}

.status-erro {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.status-erro::before {
    background: #ef4444;
}

/* QR Code container */
.qr-container {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: var(--radius-lg);
    margin: 2rem 0;
}

.qr-container img {
    max-width: 300px;
    border-radius: var(--radius-md);
}

/* Alertas */


/* Grid system */
.grid {
    display: grid;
    gap: 2rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Stats cards */
.stats-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
}

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stats-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stats-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Login page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a202c 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 3rem 2rem;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-secondary);
}

/* Responsividade */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .header {
        padding: 1rem;
    }
    
    .content {
        padding: 1rem;
    }
    
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .login-card {
        margin: 1rem;
        padding: 2rem 1.5rem;
    }
    
    .table-container {
        overflow-x: auto;
    }
}

/* Animações */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

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

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

.pulse {
    animation: pulse 2s infinite;
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Estilos Responsivos --- */

.menu-toggle {
    display: none; /* Escondido por padrão no desktop */
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

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

@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1000;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }

    .header {
        padding-left: 70px; /* Espaço para o botão de menu */
    }
    
    .content {
        padding: 1rem;
    }
}

/* --- Página de Login --- */
.login-container {
    display: flex;
    flex-direction: column; /* Empilha os itens verticalmente */
    align-items: center; /* Centraliza horizontalmente */
    justify-content: center; /* Centraliza verticalmente */
    min-height: 100vh;
    padding: 2rem;
}

.login-form {
    width: 100%;
    max-width: 400px;
}

.login-container .alert {
    position: static; /* Remove o posicionamento fixo do alerta na tela de login */
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 400px;
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

.hidden { display: none; }
.block { display: block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }

.w-full { width: 100%; }
.h-full { height: 100%; }

/* =================================================================
   Estilos do Modal de Contatos
   ================================================================= */

.label-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay[style*="display: flex"] {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: #2c2c3e; /* Cor de fundo escura do painel */
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay[style*="display: flex"] .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #4a4a6a;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #e0e0e0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #9a9a9a;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.modal-body {
    margin-bottom: 20px;
}

.contact-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #4a4a6a;
    border-radius: 8px;
    padding: 10px;
    margin-top: 15px;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 8px 5px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.contact-item:not(:last-child) {
    border-bottom: 1px solid #3a3a5a;
}

.contact-item:hover {
    background-color: #3a3a5a;
}

.contact-item input[type="checkbox"] {
    margin-right: 15px;
    width: 21px;
    height: 21px;
    accent-color: #4f46e5;
    flex-shrink: 0; /* Impede que o checkbox encolha */
    vertical-align: middle;
}

.contact-item label {
    font-size: 1rem;
    color: #c0c0c0;
    cursor: pointer;
}

.contact-item input[type="checkbox"]:disabled + label {
    color: #777;
    text-decoration: line-through;
    cursor: not-allowed;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.contact-item.ja-adicionado {
    background-color: #225d34; /* Verde escuro para contraste */
    border-color: #28a745;
}

.contact-item.ja-adicionado label {
    color: #f0f0f0;
    text-decoration: none; /* Remove o 'riscado' do disabled */
    font-weight: 500;
}

