/* ==========================================================================
   1. VARIÁVEIS GERAIS E RESET (GLOBAL)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;900&display=swap');

:root {
    --primary: #009c3b;       /* Verde Brasil Premium */
    --primary-dark: #007a2e;
    --secondary: #ffdf00;     /* Amarelo Ouro */
    --secondary-hover: #e6c800;
    --accent: #002776;        /* Azul Marinho Imperial */
    --accent-dark: #001233;
    --bg-light: #f6f9fc;
    --white: #ffffff;
    --text-dark: #1e293b;
    --text-gray: #64748b;
    --border: #e2e8f0;
    
    /* Sombras Suaves (Soft UI) */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.02);
    --shadow-md: 0 10px 25px -5px rgba(0,39,118,0.05), 0 8px 16px -6px rgba(0,39,118,0.05);
    --shadow-lg: 0 20px 40px -5px rgba(0,39,118,0.12), 0 10px 20px -6px rgba(0,39,118,0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    transition: all 0.2s ease;
}

/* Inputs Padrão (Usado em todas as páginas) */
.form-control {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    outline: none;
    color: var(--text-dark);
    transition: all 0.2s ease;
    background-color: var(--white);
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 156, 59, 0.1);
}

/* Alertas Globais (Erros e Sucesso) */
.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    line-height: 1.5;
}
.alert-danger { background-color: #fef2f2; color: #991b1b; border: 1px solid #fee2e2; }
.alert-success { background-color: #f0fdf4; color: #166534; border: 1px solid #dcfce7; }


/* ==========================================================================
   2. HEADER / NAVBAR (TODAS AS PÁGINAS LOGADAS)
   ========================================================================== */
.navbar {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    padding: 15px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}
.navbar-brand {
    color: var(--secondary);
    font-size: 24px;
    font-weight: 900;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.navbar-brand i { font-size: 22px; color: var(--white); }
.navbar-brand span { color: var(--white); font-weight: 400; }

.user-nav { display: flex; align-items: center; gap: 24px; }
.user-info { color: rgba(255,255,255,0.9); font-size: 14px; font-weight: 500; }
.user-info strong { color: var(--secondary); }

.nav-links { display: flex; gap: 12px; }
.btn-icon {
    background: rgba(255,255,255,0.1); color: var(--white);
    padding: 10px 20px; border-radius: 30px; font-size: 13px; font-weight: 700;
    display: flex; align-items: center; gap: 8px; transition: 0.3s;
}
.btn-icon:hover { background: var(--secondary); color: var(--accent); }
.btn-logout { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.btn-logout:hover { background: #ef4444; color: var(--white); }

@media (max-width: 768px) {
    .navbar { flex-direction: column; gap: 15px; padding: 15px; }
    .user-nav { width: 100%; flex-direction: column; gap: 10px; text-align: center; }
    .nav-links { width: 100%; justify-content: center; flex-wrap: wrap; }
}


/* ==========================================================================
   3. LOGIN E REGISTRO (AUTH)
   ========================================================================== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at top right, var(--accent) 0%, var(--accent-dark) 100%);
}
.auth-container {
    max-width: 450px;
    width: 100%;
    background: var(--white);
    padding: 40px 30px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    margin: auto;
}
.auth-header-logo {
    text-align: center; font-size: 28px; font-weight: 900;
    color: var(--accent); margin-bottom: 8px; letter-spacing: -0.5px;
}
.auth-header-logo span { color: var(--primary); }
.auth-title {
    text-align: center; margin-bottom: 30px; color: var(--text-gray);
    font-size: 14px; font-weight: 600; text-transform: uppercase;
}

.form-group { margin-bottom: 20px; position: relative; }
.form-group label {
    display: block; margin-bottom: 8px; font-weight: 700;
    font-size: 13px; color: var(--accent); text-transform: uppercase;
}

.btn-auth {
    width: 100%; padding: 15px; border-radius: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white); border: none; font-size: 16px; font-weight: 700;
    text-transform: uppercase; cursor: pointer; transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 156, 59, 0.2);
}
.btn-auth:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 156, 59, 0.4); }

.auth-footer { text-align: center; margin-top: 25px; font-size: 14px; font-weight: 500; }
.auth-footer a { color: var(--primary); font-weight: 700; margin-left: 5px; }

/* Tooltip Azul do CPF */
.cpf-label-container { display: flex; align-items: center; gap: 8px; }
.tooltip-icon {
    background-color: var(--accent); color: var(--white); width: 18px; height: 18px;
    border-radius: 50%; display: inline-flex; justify-content: center; align-items: center;
    font-size: 11px; cursor: help; position: relative;
}
.tooltip-text {
    visibility: hidden; width: 260px; background-color: var(--accent-dark); color: #fff;
    text-align: center; border-radius: 10px; padding: 12px; position: absolute;
    z-index: 10; bottom: 135%; left: 50%; transform: translateX(-50%); opacity: 0;
    transition: opacity 0.3s; font-weight: 500; font-size: 12px; line-height: 1.4;
}
.tooltip-text::after {
    content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px;
    border-width: 6px; border-style: solid; border-color: var(--accent-dark) transparent transparent transparent;
}
.tooltip-icon:hover .tooltip-text { visibility: visible; opacity: 1; }


/* ==========================================================================
   4. HOME E VITRINE (ALUNOS)
   ========================================================================== */
.search-wrapper {
    background: var(--accent-dark);
    padding: 30px 5% 50px 5%;
    border-radius: 0 0 30px 30px;
    text-align: center;
}
.search-form {
    max-width: 700px; margin: 0 auto; display: flex;
    background: var(--white); border-radius: 50px; padding: 6px; box-shadow: var(--shadow-lg);
}
.search-form input { flex: 1; border: none; padding: 15px 25px; border-radius: 50px; font-size: 16px; outline: none; }
.search-form button {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white); border: none; padding: 0 30px; border-radius: 50px;
    font-weight: 700; font-size: 15px; cursor: pointer; transition: 0.3s;
}

/* Menu Visual (Categorias) */
.visual-menu {
    max-width: 1200px; margin: -25px auto 40px auto; display: flex; gap: 15px;
    padding: 0 20px 10px 20px; overflow-x: auto; position: relative; z-index: 10;
    scrollbar-width: none;
}
.visual-menu::-webkit-scrollbar { display: none; }
.menu-item {
    background: var(--white); min-width: 120px; padding: 15px; border-radius: 16px;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    color: var(--accent); font-weight: 700; font-size: 13px; box-shadow: var(--shadow-sm);
    border: 2px solid transparent; transition: 0.3s;
}
.menu-item i { font-size: 24px; color: var(--primary); }
.menu-item:hover { border-color: var(--secondary); transform: translateY(-5px); color: var(--primary-dark); }
.menu-item.action-location { background: var(--secondary); color: var(--accent); }
.menu-item.action-location i { color: var(--accent); }

/* Grid de Cupons e Cartões */
.container { max-width: 1200px; margin: 0 auto 50px auto; padding: 0 20px; flex: 1; }
.section-title { margin-bottom: 30px; color: var(--accent); font-size: 24px; font-weight: 900; }

.grid-ofertas { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 30px; }

.card {
    background: var(--white); border-radius: 20px; overflow: hidden;
    box-shadow: var(--shadow-sm); transition: 0.3s; display: flex; flex-direction: column;
    border: 1px solid rgba(0,0,0,0.03); position: relative;
}
.card:hover { transform: translateY(-8px); box-shadow: var(--shadow-hover); }

.card-img-wrapper { height: 200px; width: 100%; position: relative; overflow: hidden; }
.card-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.card:hover .card-img { transform: scale(1.05); }

.badge-top {
    position: absolute; top: 15px; left: 15px; background: var(--secondary);
    color: var(--accent-dark); padding: 6px 12px; border-radius: 8px;
    font-size: 12px; font-weight: 900; text-transform: uppercase; box-shadow: 0 4px 10px rgba(0,0,0,0.2); z-index: 2;
}

.card-body { padding: 25px 20px; display: flex; flex-direction: column; flex: 1; }
.oferta-titulo { color: var(--accent); font-size: 18px; font-weight: 800; margin-bottom: 8px; line-height: 1.3; }
.oferta-desc { font-size: 14px; color: var(--text-gray); flex: 1; margin-bottom: 20px; line-height: 1.5; font-weight: 500; }
.distancia { font-size: 13px; color: var(--primary); font-weight: 700; margin-bottom: 15px; display: flex; align-items: center; gap: 6px; }

.btn-garantir {
    width: 100%; padding: 14px; border-radius: 12px; font-weight: 700; font-size: 14px;
    text-transform: uppercase; border: none; cursor: pointer; transition: 0.3s;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: var(--white);
    display: flex; justify-content: center; align-items: center; gap: 8px;
}
.btn-garantir:hover { box-shadow: 0 8px 20px rgba(0, 156, 59, 0.3); transform: translateY(-2px); }

@media (max-width: 768px) {
    .search-wrapper { padding: 20px 5% 30px 5%; border-radius: 0 0 20px 20px; }
    .search-form { flex-direction: column; background: transparent; box-shadow: none; gap: 10px; }
    .search-form input { border-radius: 12px; padding: 15px; }
    .search-form button { border-radius: 12px; padding: 15px; width: 100%; }
}


/* ==========================================================================
   5. PAINÉIS DE ADMINISTRAÇÃO (IEMI GESTÃO / PARCEIRO)
   ========================================================================== */
.admin-container { max-width: 1300px; width: 100%; margin: 30px auto; padding: 0 20px; }

/* Grid de Estatísticas */
.dashboard-stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px; margin-bottom: 30px;
}
.stat-card {
    background: var(--white); padding: 25px 20px; border-radius: 16px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    border-left: 5px solid var(--primary); text-align: left;
}
.stat-title { font-size: 13px; color: var(--text-gray); margin-bottom: 8px; text-transform: uppercase; font-weight: 700; }
.stat-value { font-size: 32px; color: var(--accent); font-weight: 900; }

/* Tabelas e Caixas de Formulário */
.admin-card-box {
    background: var(--white); padding: 25px; border-radius: 16px;
    border: 1px solid var(--border); box-shadow: var(--shadow-sm); margin-bottom: 30px;
}
.admin-card-box h3 { font-size: 18px; font-weight: 800; color: var(--accent); margin-bottom: 20px; }

.admin-table-container { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 600px; text-align: left; }
.admin-table th, .admin-table td { padding: 15px; font-size: 14px; border-bottom: 1px solid var(--border); }
.admin-table th { background-color: #f8fafc; color: var(--accent); font-weight: 700; text-transform: uppercase; font-size: 12px; }
.admin-table tr:hover td { background-color: #f8fafc; }

/* Badges e Botões Menores */
.badge-status { padding: 5px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.badge-status.ativo { background-color: #dcfce7; color: #156534; }
.badge-status.inativo { background-color: #fef2f2; color: #991b1b; }

.btn-sm { padding: 8px 12px; font-size: 12px; font-weight: 700; border-radius: 8px; border: none; cursor: pointer; text-transform: uppercase; }
.btn-success { background-color: var(--primary); color: var(--white); }
.btn-danger { background-color: #ef4444; color: var(--white); }


/* ==========================================================================
   6. FRENTE DE CAIXA (TERMINAL DE VALIDAÇÃO DO PARCEIRO)
   ========================================================================== */
.terminal-wrapper {
    max-width: 600px; width: 100%; margin: 50px auto; padding: 0 20px;
}
.terminal-box {
    background: var(--white); padding: 40px; border-radius: 24px;
    border: 1px solid var(--border); box-shadow: var(--shadow-lg); text-align: center;
}
.terminal-box h2 { color: var(--accent); font-size: 24px; font-weight: 900; margin-bottom: 25px; text-transform: uppercase; }

/* Input Gigante para digitação rápida */
.input-giant {
    font-size: 24px; text-align: center; padding: 15px; letter-spacing: 2px;
    font-weight: 900; color: var(--accent); border: 3px solid var(--border); border-radius: 16px;
    width: 100%; outline: none; margin-bottom: 20px; transition: 0.3s;
}
.input-giant:focus { border-color: var(--accent); box-shadow: 0 0 0 5px rgba(0, 39, 118, 0.1); }

.btn-terminal {
    width: 100%; padding: 18px; font-size: 18px; font-weight: 800; text-transform: uppercase;
    border-radius: 16px; border: none; background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: var(--white); cursor: pointer; transition: all 0.3s ease;
}
.btn-terminal:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 39, 118, 0.3); }