/* crm_cards.css - Design Limpo e Profissional */

:root {
    --primary: #6366f1; /* Indigo moderno */
    --primary-hover: #4f46e5;
    --bg-surface: #ffffff;
    --bg-page: #f3f4f6;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --danger: #ef4444;
}

/* --- WRAPPERS --- */
.view-container {
    width: 100%;
    padding: 1rem 0;
}

/* --- GRID VIEW (CARDS) --- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.crm-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.crm-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.card-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Avatar / Logo no Card */
.card-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    position: relative;
}

.status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid white;
}
.status-active { background-color: #10b981; }
.status-inactive { background-color: #9ca3af; }

.card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 0.25rem 0;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.card-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--bg-page);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    margin-top: auto;
}

/* Ações do Card (Rodapé Fixo) */
.card-footer {
    border-top: 1px solid var(--border);
    padding: 0.75rem;
    background: #f9fafb;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

/* --- LIST VIEW (TABELA) --- */
.list-wrapper {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden; /* Arredonda cantos da tabela */
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.crm-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.crm-table th {
    background: #f9fafb;
    padding: 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.crm-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    vertical-align: middle;
}

.crm-table tr:last-child td {
    border-bottom: none;
}

.crm-table tr:hover {
    background-color: #f9fafb;
}

/* --- BOTÕES --- */
.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #eff6ff;
}

.btn-icon.delete:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: #fef2f2;
}

/* --- PAGINAÇÃO --- */
.pagination-container {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    align-items: center;
}

.page-badge {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* --- FIX DO MODAL E INDICADOR DE CARREGAMENTO --- */
.htmx-indicator {
    opacity: 0;
    pointer-events: none; /* O segredo: permite clicar através dele quando invisível */
    transition: opacity 0.2s ease-in;
    z-index: 50;
}

/* Quando o HTMX estiver trabalhando, mostre o indicador */
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    opacity: 1;
    pointer-events: auto;
}

/* Garante que o indicador não suma ao trocar de lista para grid */
.loader-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}