/* ==========================================================================
   1. GERAL E LAYOUT BASE
   ========================================================================== */
   
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    background-color: #f4f7fa;
    margin: 0;
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
}

.grid-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-areas: "sidebar main";
    min-height: 100vh;
}

.main-content {
    grid-area: main;
    padding: 25px;
}

.main-footer {
    text-align: center;
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px solid #e0e0e0;
    color: #777;
    font-size: 13px;
}

/* ==========================================================================
   2. SIDEBAR (MENU LATERAL)
   ========================================================================== */
.sidebar {
    grid-area: sidebar;
    background-color: #0d1b2a;
    color: #e0e1dd;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100%;
    width: 260px;
    z-index: 100;
}
.sidebar-header {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #1b263b;
}
.sidebar-header .fa-whatsapp {
    color: #25D366;
    font-size: 32px;
    margin-right: 15px;
}
.sidebar-header h1 {
    font-size: 20px;
    margin: 0;
    font-weight: 600;
    color: #ffffff;
}
.sidebar-nav {
    flex-grow: 1;
    padding-top: 15px;
}
.sidebar-nav a, .sidebar-footer a {
    display: flex;
    align-items: center;
    color: #e0e1dd;
    padding: 15px 25px;
    text-decoration: none;
    font-size: 16px;
    transition: background-color 0.3s, color 0.3s;
}
.sidebar-nav a:hover, .sidebar-footer a:hover {
    background-color: #1a73e8;
    color: #ffffff;
}
.sidebar-nav a i, .sidebar-footer a i {
    margin-right: 20px;
    width: 20px;
    text-align: center;
}
.sidebar-footer {
    padding-bottom: 15px;
    border-top: 1px solid #1b263b;
}

/* ==========================================================================
   3. COMPONENTES REUTILIZÁVEIS
   ========================================================================== */

/* --- Títulos de Página --- */
h2 {
    color: #0d1b2a;
    border-bottom: 2px solid #1a73e8;
    padding-bottom: 10px;
    margin-top: 0;
    margin-bottom: 25px;
}

/* --- Cards --- */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.07);
    margin-bottom: 25px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
}
.card-header h3 {
    margin: 0;
    font-size: 20px;
    color: #0d1b2a;
}
.card-header h3 i {
    margin-right: 10px;
    color: #1a73e8;
}
.card-body {
    padding: 25px;
    line-height: 1.8;
}
.card-body i {
    margin-right: 10px;
    color: #555;
    width: 20px;
    text-align: center;
}

/* --- Botões --- */
.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.btn i {
    color: inherit !important; /* Faz o ícone HERDAR a cor do texto do botão */
}

.btn-sm { padding: 6px 12px; font-size: 14px; margin-right: 8px; }
.btn-primary { background-color: #1a73e8; }
.btn-success { background-color: #28a745; }
.btn-danger { background-color: #e53935; }
.btn-warning { background-color: #ffc107; color: #333; }
.btn-info { background-color: #31a0e3; } 

/* --- Alertas --- */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 6px;
}
.alert-sucesso { background-color: #d4edda; color: #155724; border-color: #c3e6cb; }
.alert-erro { background-color: #f8d7da; color: #721c24; border-color: #f5c6cb; }

/* --- Tabelas de Listagem --- */
.tabela-listagem {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}
.tabela-listagem thead th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    background-color: #f8f9fa;
    color: #333;
    border-bottom: 2px solid #e9ecef;
}
.tabela-listagem tbody tr {
    background-color: #ffffff;
    border-radius: 8px;
    transition: box-shadow 0.2s ease-in-out, transform 0.2s ease-in-out;
}
.tabela-listagem tbody tr:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}
.tabela-listagem tbody td {
    padding: 15px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f1f1;
}
.tabela-listagem tbody tr td:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.tabela-listagem tbody tr td:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.tabela-listagem tbody tr:last-child td { border-bottom: none; }
.sem-dados { text-align: center; padding: 40px; color: #777; }

/* --- Status Badges --- */
.status-badge {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    text-transform: capitalize;
}
.status-ativo, .status-pago { background-color: #28a745; }
.status-pendente { background-color: #ffc107; color: #333; }
.status-encerrado { background-color: #6c757d; }
.status-cancelado { background-color: #dc3545; }
.status-assinado { background-color: #198754; font-size: 10px; padding: 2px 8px;}
.status-assinado i { font-size: 9px; margin-right: 3px; }

/* ==========================================================================
   4. FORMULÁRIOS
   ========================================================================== */
.form-card {
    border: none;
    padding: 0;
    margin: 0;
}
.form-card fieldset {
    border: none;
    padding: 0;
    margin: 0 0 25px 0;
}
.form-card legend {
    font-size: 18px;
    font-weight: 600;
    color: #1a73e8;
    margin-bottom: 20px;
    padding-bottom: 5px;
    width: 100%;
    border-bottom: 1px solid #e0e0e0;
}
.form-card input, .form-card textarea, .form-card select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    margin-bottom: 20px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 15px;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.form-card input:focus, .form-card textarea:focus, .form-card select:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 5px rgba(26, 115, 232, 0.5);
    outline: none;
}
.form-row { display: flex; gap: 20px; }
.form-group { flex: 1; }
.input-group { position: relative; }
.input-group i { position: absolute; left: 15px; top: 14px; color: #999; }
.input-group input { padding-left: 45px; }
.cep-group { display: flex; gap: 10px; align-items: flex-start; }
.cep-group .input-group { flex-grow: 0; flex-basis: 200px; }
#btn-cep-ajuda { height: 48px; }
.link-voltar { text-align: center; margin-top: 20px; }

/* Seletor de Tipo de Contrato */
.tipo-contrato-seletor { display: flex; border: 1px solid #ccc; border-radius: 8px; overflow: hidden; width: fit-content; margin-bottom: 20px; }
.tipo-contrato-seletor label { padding: 12px 20px; cursor: pointer; background-color: #f8f9fa; color: #555; transition: background-color 0.3s, color 0.3s; border-left: 1px solid #ccc; }
.tipo-contrato-seletor label:first-of-type { border-left: none; }
.tipo-contrato-seletor input[type="radio"] { display: none; }
.tipo-contrato-seletor input[type="radio"]:checked + label { background-color: #1a73e8; color: #ffffff; font-weight: 600; }

/* ==========================================================================
   5. DASHBOARD
   ========================================================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}
.dashboard-grid .full-width-card {
    grid-column: 1 / -1; /* Faz o card ocupar a largura total */
}

.stat-card {
    background-color: #ffffff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.07);
    display: flex;
    flex-direction: column;
}
.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #5a6268;
    font-weight: 700;
}
.stat-card-header i { font-size: 24px; color: #1a73e8; opacity: 0.7; }
.stat-card-value { font-size: 36px; font-weight: 700; color: #0d1b2a; margin: 10px 0; }
.list-card ul { list-style: none; padding: 0; margin: 15px 0 0 0; }
.list-card li { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid rgba(0,0,0,0.05); font-size: 14px; }
.list-card li:last-child { border-bottom: none; }
.list-card li a { text-decoration: none; font-weight: 500; color: #333; }
.list-card li a:hover { color: #1a73e8; }
.list-card li span, .list-card li small { color: #6c757d; }
.list-card.aguardando-assinatura { background-color: #e7f3ff; border-left: 5px solid #0d6efd; }
.list-card.proximo-vencimento { background-color: #fff8e1; border-left: 5px solid #ffc107; }

.tabela-detalhes { width: 100%; border-collapse: collapse; margin-top: 15px; }
.tabela-detalhes th, .tabela-detalhes td { padding: 8px 5px; text-align: left; border-bottom: 1px solid #f1f1f1; font-size: 14px; }
.tabela-detalhes th { font-weight: 600; color: #6c757d; }
.tabela-detalhes tbody tr:last-child td { border-bottom: none; }
.tabela-detalhes a { text-decoration: none; font-weight: 500; color: #333; }
.tabela-detalhes a:hover { color: #1a73e8; }

/* ==========================================================================
   6. RESPONSIVIDADE
   ========================================================================== */
@media (max-width: 992px) {
    .dashboard-grid .full-width-card {
        grid-column: span 1;
    }
}
@media (max-width: 768px) {
    .grid-container { grid-template-columns: 1fr; grid-template-areas: "main"; }
    .sidebar { position: relative; width: 100%; height: auto; }
    .main-content { padding: 15px; }
    .form-row { flex-direction: column; gap: 0; }
    
    .tabela-listagem { display: block; width: 100%; }
    .tabela-listagem thead { display: none; }
    .tabela-listagem tr { display: block; margin-bottom: 15px; border-radius: 8px; background-color: #fff; padding: 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
    .tabela-listagem td { display: flex; justify-content: space-between; align-items: center; text-align: right !important; padding: 10px 0; border-bottom: 1px solid #f1f1f1; }
    .tabela-listagem td:last-child { border-bottom: none; }
    .tabela-listagem td::before { content: attr(data-label); font-weight: 600; text-align: left; margin-right: 15px; color: #333; }
}

.dashboard-grid .span-2-card {
    grid-column: span 2; /* Faz o card ocupar 2 colunas do grid */
}

/* --- Estilos para Filtro e Paginação --- */
.form-filtro {
    display: flex;
    gap: 15px;
    align-items: center;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 25px;
}
.form-filtro input, .form-filtro select {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
}

.paginacao {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 25px;
}
.paginacao a {
    text-decoration: none;
    color: #1a73e8;
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    transition: all 0.3s;
}
.paginacao a:hover {
    background-color: #e7f3ff;
    border-color: #1a73e8;
}
.paginacao a.ativo {
    background-color: #1a73e8;
    color: white;
    border-color: #1a73e8;
    font-weight: 600;
}


.tabela-listagem th.sortable a {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tabela-listagem th.sortable a:hover {
    color: #1a73e8;
}
.tabela-listagem th.sortable i {
    font-size: 12px;
}


/* ==========================================================================
   7. PÁGINA DE LOGIN - NOVO DESIGN (SPLIT SCREEN)
   ========================================================================== */
   
   
.login-wrapper {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden; /* Previne barras de rolagem indesejadas */
}

/* LADO ESQUERDO: ÁREA DE BRANDING */
.login-branding {
    flex: 1;
    background-image: linear-gradient(135deg, #1a73e8 0%, #0d1b2a 100%);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px;
}

.login-branding .brand-logo .fa-whatsapp {
    font-size: 80px;
    margin-bottom: 20px;
    text-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.login-branding h1 {
    font-size: 2.5rem; /* 40px */
    font-weight: 700;
    margin: 0 0 10px 0;
    letter-spacing: 1px;
}

.login-branding p {
    font-size: 1.125rem; /* 18px */
    max-width: 400px;
    opacity: 0.8;
    line-height: 1.6;
}

/* LADO DIREITO: ÁREA DO FORMULÁRIO */
.login-form-area {
    flex: 1;
    background-color: #f4f7fa;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

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

.form-container h2 {
    font-size: 2rem; /* 32px */
    color: #0d1b2a;
    margin-bottom: 30px;
    text-align: left;
    border-bottom: 3px solid #1a73e8;
    padding-bottom: 10px;
}

.form-container .form-group {
    margin-bottom: 25px;
    position: relative;
}

.form-container .form-group label {
    display: block;
    font-weight: 600;
    color: #5a6268;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-container .form-group input {
    width: 100%;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
}

.form-container .form-group input:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
    outline: none;
}

.form-container .options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    margin-bottom: 30px;
}

.form-container .options .remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-container .options a {
    color: #1a73e8;
    text-decoration: none;
    font-weight: 600;
}
.form-container .options a:hover {
    text-decoration: underline;
}

.form-container .btn-login {
    width: 100%;
    padding: 16px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 8px;
    /* Reutiliza a classe .btn para o comportamento base */
}

.form-container .alert-erro {
    text-align: center;
}

/* RESPONSIVIDADE PARA CELULARES */
@media (max-width: 992px) {
    .login-wrapper {
        flex-direction: column;
    }

    .login-branding {
        flex: 0;
        padding: 50px 20px;
    }

    .login-branding h1 {
        font-size: 2rem;
    }
    .login-branding p {
        font-size: 1rem;
    }

    .login-form-area {
        flex: 1; /* Ocupa o resto do espaço */
    }
}

/* Estilo para o Bloco de Usuário Logado na Sidebar */
.usuario-logado {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    border-top: 1px solid #1b263b;
    background-color: rgba(0,0,0,0.2);
}
.usuario-logado i {
    font-size: 24px;
    margin-right: 15px;
    color: #fff;
}
.usuario-logado span {
    color: #fff;
    font-weight: 500;
    line-height: 1.2;
}
.usuario-logado small {
    display: block;
    font-size: 12px;
    color: #adb5bd;
    font-weight: 400;
}

.btn-icon {
    width: 32px;  /* Largura fixa */
    height: 32px; /* Altura fixa (para alinhar com o .btn-sm) */
    padding: 0;   /* Remove o padding para centralizar o ícone */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Impede que o botão encolha */
}

.btn-icon i {
    margin-right: 0; /* Remove a margem do ícone que não é mais necessária */
    font-size: 14px;
}