/* =========================================
   1. VARIÁVEIS GLOBAIS E RESET
   ========================================= */
:root {
    /* Cores Base */
    --primary: #4b92e3;
    --primary-hover: #3a7bc2;
    --secondary: #0a4d8c;
    --white: #ffffff;
    --bg-main: #fcfcfc;
    --bg-surface: #f1f5f9;
    --border-color: #eef0f2;
    --dark: #121212;

    /* Texto */
    --text-main: #1a1a1a;
    --text-muted: #94a3b8;

    /* Status / Badges */
    --success: #166534;
    --success-bg: #dcfce7;
    --warning: #854d0e;
    --warning-bg: #fef9c3;
    --danger: #991b1b;
    --danger-bg: #fee2e2;
    --danger-hover: #fef2f2;
    --danger-btn: #ef4444;

    /* Layout */
    --sidebar-w-collapsed: 80px;
    --sidebar-w-expanded: 260px;

    /* Efeitos & Bordas */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Satoshi', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-main);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.font-heading { font-family: 'Space Grotesk', sans-serif; }
.app-container { display: flex; height: 100vh; width: 100vw; }

/* =========================================
   2. REGRAS GLOBAIS E COMPONENTES BASE
   ========================================= */

/* Botões */
button { font-family: inherit; cursor: pointer; transition: var(--transition); border: none; }

.btn-primary, .btn-dark, .btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-weight: 500;
}

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-hover); }

.btn-dark { background: var(--dark); color: var(--white); }
.btn-dark:hover { opacity: 0.9; }

.btn-ghost { background: transparent; color: var(--text-main); }
.btn-ghost:hover { background: var(--bg-surface); }

.btn-block { width: 100%; padding: 14px; font-size: 1rem; }

/* Cards (Agrupamento inteligente para Dash e Performance) */
.chart-card, .goal-card, .activity-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 24px;
}

/* Badges */
.badge {
    padding: 6px 12px;
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: inline-block;
}
.badge-ativo { background-color: var(--success-bg); color: var(--success); }
.badge-pausado { background-color: var(--warning-bg); color: var(--warning); }
.badge-inativo { background-color: var(--danger-bg); color: var(--danger); }

/* Tabelas */
.table-wrapper {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
}

.leads-table { width: 100%; border-collapse: collapse; text-align: left; }
.leads-table th { padding: 16px; font-size: 0.85rem; color: var(--text-main); border-bottom: 1px solid var(--border-color); font-weight: 600; }
.leads-table td { padding: 16px; border-bottom: 1px solid var(--border-color); font-size: 0.9rem; }
.leads-table tbody tr:hover { background: var(--bg-surface); }

/* =========================================
   3. ESTILIZAÇÃO DE MODAIS (CORRIGIDO)
   ========================================= */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); z-index: 1000;
}

.modal-overlay.active { 
    display: flex; align-items: center; justify-content: center; 
    animation: fadeInModal 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInModal {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Base real do Card do Modal */
.modal-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 500px; /* Tamanho padrão */
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

/* Modificador para modais maiores (ex: Adicionar Lead) */
.modal-large { 
    max-width: 800px; 
}

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }

.btn-close {
    background: transparent; font-size: 1.5rem; color: var(--text-muted);
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md); line-height: 1;
}
.btn-close:hover { background-color: var(--bg-surface); color: var(--text-main); }
.btn-close:focus { outline: 2px solid var(--primary); outline-offset: 2px; }

/* =========================================
   4. INPUTS, SELECTS E RADIOS GLOBAIS
   ========================================= */
.form-section { margin-bottom: 32px; border-bottom: 1px solid var(--border-color); padding-bottom: 24px; }
.form-section h3 { font-size: 0.9rem; color: var(--primary); text-transform: uppercase; margin-bottom: 16px; }
.input-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

/* Textos, Datas e Selects */
input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="date"], input[type="time"], input[type="password"], select, textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-main);
    background-color: var(--white);
    outline: none;
    transition: var(--transition);
}

/* Focus: Borda Azul + Sombra Suave */
input:focus, select:focus, textarea:focus { 
    border-color: var(--primary); 
    box-shadow: 0 0 0 3px rgba(75, 146, 227, 0.15);
}

input[readonly] { background: var(--bg-surface); color: var(--text-muted); cursor: not-allowed; }

/* Checkboxes e Radios Premium */
input[type="checkbox"], input[type="radio"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
    cursor: pointer;
    transition: var(--transition);
}

.form-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

/* =========================================
   5. SIDEBAR (NAVEGAÇÃO)
   ========================================= */
.sidebar {
    width: var(--sidebar-w-collapsed);
    background: var(--white);
    border-right: 1px solid var(--border-color);
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 32px 0; transition: var(--transition); overflow: hidden; z-index: 100;
}
.sidebar:hover { width: var(--sidebar-w-expanded); }

.logo-wrapper { height: 32px; display: flex; align-items: center; margin-bottom: 48px; padding: 0 24px; }
.logo-full { display: none; height: 20px; width: auto; }
.logo-icon { display: block; height: 28px; width: auto; }
.sidebar:hover .logo-full { display: block; }
.sidebar:hover .logo-icon { display: none; }

.nav-list { display: flex; flex-direction: column; gap: 8px; padding: 0 12px; }
.nav-item {
    display: flex; align-items: center; height: 48px; text-decoration: none;
    color: var(--text-muted); border-radius: var(--radius-md); transition: var(--transition); overflow: hidden;
}
.icon-box { min-width: 56px; display: flex; align-items: center; justify-content: center; }
.icon-box i { width: 20px; height: 20px; stroke-width: 2px; }
.nav-text { margin-left: 4px; opacity: 0; font-weight: 500; white-space: nowrap; transition: opacity 0.2s; }
.sidebar:hover .nav-text { opacity: 1; }
.nav-item:hover { background: #f8fafc; color: var(--text-main); }
.nav-item.active { background: var(--bg-surface); color: var(--primary); }

.sidebar-bottom { border-top: 1px solid var(--border-color); padding: 24px 12px 0 12px; }
.dev-container { display: flex; flex-direction: column; padding-left: 12px; margin-bottom: 20px; }
.dev-label { font-size: 9px; text-transform: uppercase; color: var(--text-muted); display: none; margin-bottom: 4px; }
.sidebar:hover .dev-label { display: block; }
.dev-logo { width: 32px; opacity: 0.6; transition: width 0.3s; }
.sidebar:hover .dev-logo { width: 80px; }

.btn-logout { display: flex; align-items: center; background: none; color: var(--danger-btn); width: 100%; height: 48px; border-radius: var(--radius-md); padding: 0; }
.btn-logout:hover { background: var(--danger-hover); }

/* =========================================
   6. WORKSPACE E HEADERS
   ========================================= */
.workspace { flex-grow: 1; padding: 48px 64px; overflow-y: auto; }

.workspace-header, .workspace-header-alt { margin-bottom: 40px; }
.workspace-header h1 { font-size: 2.2rem; font-weight: 600; letter-spacing: -1px; color: #0f172a; }
.workspace-header p { color: var(--text-muted); font-size: 0.95rem; margin-top: 8px; }

.workspace-header-alt { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 24px; }
.user-greeting h1 { font-size: 1.5rem; color: var(--text-main); }
.user-email { color: var(--text-muted); font-size: 0.9rem; }

/* =========================================
   7. COMPONENTES: LEADS E CLIENTES
   ========================================= */
.view-toggle { display: flex; background: var(--bg-surface); padding: 4px; border-radius: var(--radius-md); }
.toggle-btn {
    display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: transparent;
    border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 500;
}
.toggle-btn i { width: 16px; height: 16px; }
.toggle-btn.active { background: var(--white); color: var(--primary); box-shadow: var(--shadow-sm); }

/* Cards de Métricas Superiores */
.infos-gerais { margin-bottom: 32px; }
.section-subtitle { font-size: 1.1rem; margin-bottom: 16px; color: var(--text-main); }
.cards-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.metric-card { padding: 32px 24px; border-radius: var(--radius-xl); display: flex; flex-direction: column; justify-content: center; min-height: 140px; }
.metric-card span { font-size: 0.85rem; margin-bottom: 8px; opacity: 0.8; }
.metric-card h3 { font-size: 2rem; font-weight: 700; }
.bg-blue { background-color: var(--primary); color: var(--white); }
.bg-dark { background-color: var(--dark); color: var(--white); }

/* Toolbar de Busca */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.search-box { display: flex; align-items: center; background: var(--dark); padding: 10px 16px; border-radius: 30px; width: 300px; }
.search-box i { color: var(--white); width: 18px; margin-right: 8px; }
.search-box input { background: transparent; border: none; color: var(--white); width: 100%; outline: none; }
/* Override do estilo global de focus apenas para a caixa de pesquisa preta */
.search-box input:focus { box-shadow: none; border-color: transparent; padding: 0; }
.search-box input::placeholder { color: #888; }
.toolbar-actions { display: flex; align-items: center; gap: 12px; }
.leads-count { color: var(--text-main); font-weight: 500; margin-right: auto; }

/* Transição de Views e Kanban */
.view-container { display: none; }
.view-container.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.kanban-board { display: flex; gap: 20px; overflow-x: auto; padding-bottom: 16px; }
.kanban-col { background: var(--bg-surface); border-radius: var(--radius-lg); min-width: 280px; padding: 16px; }
.col-header { font-weight: 600; display: flex; justify-content: space-between; margin-bottom: 16px; color: var(--text-main); }
.col-header span { background: #e2e8f0; padding: 2px 8px; border-radius: var(--radius-lg); font-size: 0.8rem; }
.col-body { min-height: 200px; }

/* =========================================
   8. COMPONENTES: DASHBOARD E PERFORMANCE
   ========================================= */
.dashboard-grid-main, .charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-top: 24px; }
.dashboard-side-panel { display: flex; flex-direction: column; gap: 20px; }

.goal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.goal-header h3, .chart-title { font-size: 1.1rem; color: var(--text-main); font-weight: 600; margin-bottom: 16px; }
.goal-header span { font-size: 0.9rem; font-weight: 700; color: var(--primary); }

.progress-wrapper { background: var(--border-color); height: 8px; border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.progress-bar { background: var(--primary); height: 100%; border-radius: 10px; transition: width 1s ease-in-out; }
.goal-text { font-size: 0.8rem; color: var(--text-muted); }

.activity-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.activity-item { display: flex; align-items: center; gap: 12px; }
.activity-icon { width: 36px; height: 36px; background: var(--bg-surface); color: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.activity-icon i { width: 16px; height: 16px; }
.activity-info h4 { font-size: 0.9rem; color: var(--text-main); font-weight: 600; margin-bottom: 2px; }
.activity-info p { font-size: 0.75rem; color: var(--text-muted); }

.view-all-link { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--primary); text-decoration: none; font-weight: 500; }
.view-all-link:hover { text-decoration: underline; }

.canvas-container { position: relative; height: 300px; width: 100%; flex-grow: 1; }
.date-filter { background: var(--bg-surface); padding: 6px; border-radius: var(--radius-md); }
.filter-select { background: transparent; border: none; font-family: inherit; font-weight: 500; color: var(--text-main); padding: 4px 8px; outline: none; cursor: pointer;}
.filter-select:focus { box-shadow: none; border-color: transparent;}

/* =========================================
   9. TELA DE LOGIN
   ========================================= */
.login-wrapper { display: flex; height: 100vh; width: 100vw; overflow: hidden; background-color: var(--white); }
.login-left { flex: 0 0 45%; min-width: 500px; padding: 60px 80px; display: flex; flex-direction: column; justify-content: space-between; }
.brand-logo { height: 32px; width: auto; }
.login-center { max-width: 400px; width: 100%; }
.login-title { font-size: 2.5rem; color: var(--primary); letter-spacing: -1px; margin-bottom: 8px; }
.login-subtitle { font-size: 1.1rem; color: var(--text-main); margin-bottom: 24px; }
.login-divider { border: none; border-top: 1px solid var(--border-color); margin-bottom: 32px; }

.input-group { margin-bottom: 20px; }
.input-group label { display: block; font-size: 0.85rem; color: var(--text-main); margin-bottom: 8px; font-weight: 500; }
.input-icon-wrapper { position: relative; display: flex; align-items: center; }
.input-icon-wrapper i { position: absolute; left: 16px; color: #cbd5e1; width: 18px; height: 18px; z-index: 2;}

/* Override do padding para caber o ícone no login */
.input-icon-wrapper input { padding-left: 44px !important; }

.login-options { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; font-size: 0.8rem; }
.custom-checkbox { display: flex; align-items: center; gap: 8px; color: var(--text-main); cursor: pointer; }
.forgot-password { color: var(--primary); text-decoration: none; font-weight: 500; }
.forgot-password:hover { text-decoration: underline; }

.login-bottom { display: flex; align-items: center; gap: 8px; }
.dev-text-muted { font-size: 0.75rem; color: var(--text-muted); }
.dev-brand-logo { height: 18px; width: auto; opacity: 0.8; }

.login-right { flex: 1; background-image: url('assets/imagem.jpg'); background-size: cover; background-position: center; background-repeat: no-repeat; position: relative; }

/* =========================================
   10. ESTILOS DE NOTIFICAÇÕES E AGENDA
   ========================================= */
.header-actions-right { display: flex; align-items: center; gap: 24px; }
.notification-wrapper { position: relative; }

.btn-icon-circular {
    background: var(--white); border: 1px solid var(--border-color);
    width: 44px; height: 44px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; color: var(--text-muted);
    cursor: pointer; position: relative;
}
.btn-icon-circular:hover { background: var(--bg-surface); color: var(--primary); }

.badge-indicator {
    position: absolute; top: -2px; right: -2px; background: var(--danger-btn); color: var(--white);
    font-size: 0.65rem; font-weight: 700; width: 18px; height: 18px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg-main);
}

.notification-dropdown {
    display: none; position: absolute; top: calc(100% + 12px); right: 0; width: 340px;
    background: var(--white); border: 1px solid var(--border-color); border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); z-index: 1000; overflow: hidden;
}
.notification-dropdown.active { display: block; animation: fadeInModal 0.2s ease-out; }

.dropdown-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border-color); background: var(--bg-surface); }
.dropdown-header h3 { font-size: 0.9rem; font-weight: 600; }
.btn-ghost-small { background: transparent; border: none; color: var(--text-muted); font-size: 0.8rem; cursor: pointer; }
.btn-ghost-small:hover { color: var(--primary); text-decoration: underline; }

.dropdown-body { max-height: 300px; overflow-y: auto; }
.notification-item { display: flex; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border-color); transition: var(--transition); cursor: pointer; }
.notification-item:hover { background: var(--bg-surface); }
.notification-item.unread { background: #f0f7ff; }

.notif-icon { width: 32px; height: 32px; background: var(--white); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--primary); flex-shrink: 0; }
.notif-content h4 { font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; color: var(--text-main); }
.notif-content p { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; line-height: 1.3; }
.notif-time { font-size: 0.75rem; font-weight: 600; color: var(--danger-btn); }

.table-actions { display: flex; gap: 8px; }
.btn-icon-small { background: transparent; border: none; color: var(--text-muted); width: 28px; height: 28px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.btn-icon-small i { width: 16px; height: 16px; }
.btn-icon-small:hover { background: var(--bg-surface); color: var(--primary); }
.btn-agendar:hover { color: var(--success); }

/* Responsividade Básica */
@media (max-width: 1100px) {
    .dashboard-grid-main, .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .login-right { display: none; }
    .login-left { flex: 1; min-width: auto; padding: 40px; align-items: center; }
    .login-center, .login-top, .login-bottom { width: 100%; max-width: 400px; }
}
/* =========================================
   KANBAN: DRAG & DROP (Efeitos Visuais)
   ========================================= */

/* Cursor de mãozinha no Card */
.kanban-card {
    background: white;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    cursor: grab;
    transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.kanban-card:active {
    cursor: grabbing;
}

/* Quando o usuário clica e puxa o card */
.kanban-card.dragging {
    opacity: 0.5;
    transform: scale(0.95) rotate(-2deg);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

/* Área que recebe o Card mudando de cor quando vc passa o mouse em cima arrastando */
.col-body {
    min-height: 200px; /* Garante que a coluna vazia ainda possa receber o Drop */
    transition: background-color 0.2s ease, border 0.2s ease;
    border-radius: 8px;
    border: 2px dashed transparent;
}

.col-body.drag-over {
    background-color: var(--bg-surface);
    border-color: var(--primary);
}
/* =========================================
   SISTEMA DE TOASTS (NOTIFICAÇÕES GLOBAIS) E MODAL VIEW
   ========================================= */
#toast-container {
    position: fixed; top: 24px; right: 24px; z-index: 10000;
    display: flex; flex-direction: column; gap: 12px; pointer-events: none;
}
.nascen-toast {
    background: var(--white); color: var(--text-main);
    padding: 16px 24px; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    border-left: 4px solid var(--primary); display: flex; align-items: center;
    gap: 12px; min-width: 300px; transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    opacity: 0; pointer-events: auto;
}
.nascen-toast.show { transform: translateX(0); opacity: 1; }
.nascen-toast i { width: 20px; height: 20px; }
.toast-success { border-left-color: #22c55e; } .toast-success i { color: #22c55e; }
.toast-error { border-left-color: var(--danger-btn); } .toast-error i { color: var(--danger-btn); }
.toast-warning { border-left-color: #f59e0b; } .toast-warning i { color: #f59e0b; }

.view-lead-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.view-lead-section h4 { color: var(--primary); font-size: 0.9rem; margin-bottom: 12px; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; }
.view-lead-item { margin-bottom: 12px; }
.view-lead-item label { display: block; font-size: 0.75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; margin-bottom: 2px; }
.view-lead-item p { font-size: 0.95rem; color: var(--text-main); font-weight: 500; word-break: break-word;}