/* Sistema de Controle de Campanhas - Estilos Personalizados */

/* Cores principais */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
}

/* Layout geral */
body {
    font-family: 'Open Sans', sans-serif;
    background-color: #f4f5f7;
}

/* Header personalizado */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-bottom: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar-brand {
    color: white !important;
    font-weight: 600;
}

/* Sidebar */
.sidebar {
    background: #2c3e50;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar .nav > li > a {
    color: #bdc3c7;
    transition: all 0.3s ease;
}

.sidebar .nav > li > a:hover,
.sidebar .nav > li.active > a {
    background: var(--primary-color);
    color: white;
}

/* Panels */
.panel {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.panel-heading {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 8px 8px 0 0;
    padding: 15px 20px;
}

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

/* Widgets de estatísticas */
.widget-stats {
    border-radius: 8px;
    padding: 20px;
    color: white;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.widget-stats::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    transform: translate(30px, -30px);
}

.widget-stats .stats-icon {
    font-size: 48px;
    opacity: 0.8;
    margin-bottom: 15px;
}

.widget-stats .stats-info h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 5px 0;
    letter-spacing: 1px;
}

.widget-stats .stats-info p {
    font-size: 32px;
    font-weight: 700;
    margin: 0;
}

.widget-stats .stats-link {
    margin-top: 15px;
}

.widget-stats .stats-link a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 12px;
    transition: all 0.3s ease;
}

.widget-stats .stats-link a:hover {
    color: white;
}

/* Cores dos widgets */
.bg-blue { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.bg-info { background: linear-gradient(135deg, #17a2b8 0%, #138496 100%); }
.bg-orange { background: linear-gradient(135deg, #fd7e14 0%, #e55a00 100%); }
.bg-red { background: linear-gradient(135deg, #dc3545 0%, #c82333 100%); }

/* Tabelas */
.table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

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

.table tbody td {
    padding: 15px;
    vertical-align: middle;
    border-color: #e9ecef;
}

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

/* Botões */
.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 8px 16px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Formulários */
.form-control {
    border-radius: 6px;
    border: 1px solid #e9ecef;
    padding: 10px 15px;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Alertas */
.alert {
    border: none;
    border-radius: 8px;
    padding: 15px 20px;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 20px;
}

/* Breadcrumb */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #6c757d;
}

/* Page header */
.page-header {
    color: var(--dark-color);
    font-weight: 600;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.page-header small {
    color: #6c757d;
    font-weight: 400;
}

/* Responsividade */
@media (max-width: 768px) {
    .widget-stats {
        margin-bottom: 20px;
    }
    
    .panel {
        margin-bottom: 20px;
    }
    
    .table-responsive {
        border-radius: 8px;
    }
}

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

.panel, .widget-stats {
    animation: fadeIn 0.5s ease-out;
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Customizações específicas do ColorAdmin */
.page-container {
    background: #f4f5f7;
}

#content {
    padding: 20px;
}

/* Lista de informações */
.list-group-item {
    border: none;
    padding: 12px 20px;
    background: transparent;
}

.list-group-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.list-group-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* ============================================= */
/* AJUSTES FINAIS DE LAYOUT PARA PAINEL E TABELA */
/* ============================================= */

/* 1. Corrige o cabeçalho do painel com Flexbox */
/* Transforma o cabeçalho em um contêiner flexível, alinhando o título à esquerda
   e o botão à direita, ambos centralizados verticalmente. */
.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 2. Remove a margem inferior do título do painel para um alinhamento perfeito */
.panel-title {
    margin-bottom: 0;
}

/* 3. Alinha o conteúdo da tabela e define larguras */
.table th,
.table td {
    vertical-align: middle !important; /* Força o alinhamento vertical ao centro */
    padding: 0.75rem;
}

/* Alinha as colunas de valores à direita para melhor legibilidade */
.table td:nth-child(3),  /* Verba */
.table td:nth-child(4),  /* Valor Usado */
.table td:nth-child(5),  /* Leads */
.table td:nth-child(6),  /* CPL */
.table td:nth-child(7),  /* CTR */
.table td:nth-child(8),  /* Alcance */
.table td:nth-child(9),  /* Impressões */
.table td:nth-child(10) { /* Cliques */
    text-align: right;
}

/* Centraliza o cabeçalho da coluna de Ações */
.table th:last-child {
    text-align: center;
}

/* Define uma largura mínima e alinhamento para a coluna de Ações */
.table td:last-child {
    min-width: 120px;
    text-align: center;
}