/* =============================================================================
   main.css — Estilos globais da Plataforma de Afiliados Nestlé
   ============================================================================= */

/* Fonte: DM Sans (clean, profissional, legível em telas) */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&display=swap');

:root {
    /* Paleta principal */
    --color-primary:     #1C4C8A;   /* Azul corporativo */
    --color-primary-dark:#153870;
    --color-accent:      #E8282F;   /* Vermelho Nestlé */
    --color-accent-dark: #C02026;

    /* Neutros */
    --color-bg:          #F5F6FA;
    --color-surface:     #FFFFFF;
    --color-border:      #E2E5ED;
    --color-text:        #1A1D23;
    --color-text-muted:  #6B7280;

    /* Status */
    --color-success:     #16A34A;
    --color-warning:     #D97706;
    --color-danger:      #DC2626;
    --color-info:        #0284C7;

    /* Sidebar */
    --sidebar-width:     240px;
    --sidebar-bg:        #111827;
    --sidebar-text:      #D1D5DB;
    --sidebar-active-bg: rgba(255,255,255,0.08);
    --sidebar-active-text: #FFFFFF;

    /* Misc */
    --radius:            8px;
    --radius-lg:         12px;
    --shadow-sm:         0 1px 3px rgba(0,0,0,.08);
    --shadow-md:         0 4px 12px rgba(0,0,0,.10);
    --transition:        .18s ease;
}

/* Base -------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-dark); }

/* Layout com sidebar ------------------------------------------------------- */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar ------------------------------------------------------------------ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-brand img {
    height: 32px;
}

.sidebar-brand .brand-name {
    font-size: 13px;
    font-weight: 600;
    color: #FFFFFF;
    letter-spacing: .3px;
    margin-top: 8px;
    display: block;
}

.sidebar-brand .brand-role {
    font-size: 11px;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: .6px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.sidebar-section {
    padding: 16px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 400;
    border-radius: 6px;
    margin: 1px 8px;
    transition: background var(--transition), color var(--transition);
}

.sidebar-nav a i {
    font-size: 16px;
    width: 18px;
    text-align: center;
    opacity: .75;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
}

.sidebar-nav a.active { font-weight: 600; }
.sidebar-nav a.active i { opacity: 1; }

.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: var(--sidebar-text);
    font-size: 14px;
    border-radius: 6px;
    transition: background var(--transition);
}
.sidebar-footer a:hover { background: rgba(255,255,255,.06); color: #fff; }

/* Main content ------------------------------------------------------------- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar ------------------------------------------------------------------- */
.topbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0 28px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-notif {
    position: relative;
    color: var(--color-text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: color var(--transition);
}
.topbar-notif:hover { color: var(--color-primary); }

.notif-badge {
    position: absolute;
    top: -4px; right: -5px;
    background: var(--color-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 5px;
    min-width: 17px;
    text-align: center;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.topbar-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.topbar-username {
    font-size: 14px;
    font-weight: 500;
}

/* Page content ------------------------------------------------------------- */
.page-content {
    padding: 28px;
    flex: 1;
}

/* Cards -------------------------------------------------------------------- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--color-border);
    padding: 16px 20px;
    font-weight: 600;
    font-size: 15px;
}

.card-body { padding: 20px; }

/* Stat cards --------------------------------------------------------------- */
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

.stat-card .stat-sub {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.stat-card .stat-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* Badges de status --------------------------------------------------------- */
.badge-pending    { background: #FEF3C7; color: #92400E; }
.badge-approved   { background: #DCFCE7; color: #166534; }
.badge-rejected   { background: #FEE2E2; color: #991B1B; }
.badge-active     { background: #DCFCE7; color: #166534; }
.badge-paused     { background: #F3F4F6; color: #374151; }
.badge-expired    { background: #F3F4F6; color: #374151; }
.badge-draft      { background: #F3F4F6; color: #374151; }
.badge-open       { background: #DBEAFE; color: #1E40AF; }
.badge-closed     { background: #F3F4F6; color: #374151; }
.badge-archived   { background: #F3F4F6; color: #374151; }
.badge-pj         { background: #EDE9FE; color: #5B21B6; }
.badge-cashin     { background: #FEF3C7; color: #92400E; }

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Botões ------------------------------------------------------------------- */
.btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    font-weight: 500;
}
.btn-primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
}

.btn-danger {
    background: var(--color-accent);
    border-color: var(--color-accent);
    font-weight: 500;
}
.btn-danger:hover {
    background: var(--color-accent-dark);
    border-color: var(--color-accent-dark);
}

/* Tabelas ------------------------------------------------------------------ */
.table th {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    border-bottom-width: 1px;
    padding: 10px 14px;
    white-space: nowrap;
}

.table td {
    padding: 12px 14px;
    vertical-align: middle;
    font-size: 14px;
}

.table tbody tr:hover { background: #F9FAFB; }

/* Formulários -------------------------------------------------------------- */
.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 5px;
}

.form-control, .form-select {
    border-color: var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    padding: 9px 12px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(28,76,138,.12);
}

.form-text {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* Alertas ------------------------------------------------------------------ */
.alert { border-radius: var(--radius); font-size: 14px; }

/* Página de auth (login) --------------------------------------------------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-md);
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo .logo-mark {
    width: 52px; height: 52px;
    border-radius: var(--radius-lg);
    background: var(--color-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
}

.auth-logo h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.auth-logo p {
    font-size: 13px;
    color: var(--color-text-muted);
    margin: 4px 0 0;
}

/* Utilities ---------------------------------------------------------------- */
.text-muted { color: var(--color-text-muted) !important; }
.fw-600 { font-weight: 600; }
.gap-8 { gap: 8px; }

/* Scrollbar personalizada -------------------------------------------------- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }
