/* =========================================================================
   E-educa Plugin — Stylesheet compartilhado
   Consumido por: eeduca-relatorio, eeduca-pontos, eeduca-analytics
   ========================================================================= */

/* --- Tokens ---------------------------------------------------------------- */
:root {
    --eeduca-bg:           #f1f5f9;
    --eeduca-card-bg:      #ffffff;
    --eeduca-border:       rgba(226, 232, 240, 1);
    --eeduca-text-main:    #1e293b;
    --eeduca-text-muted:   #64748b;
    --eeduca-accent:       #3b82f6;
    --eeduca-accent-hover: #2563eb;
    --eeduca-radius:       12px;
    --eeduca-font:         'Inter', system-ui, -apple-system, BlinkMacSystemFont,
                           "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- Wrapper --------------------------------------------------------------- */
.eeduca-wrap {
    max-width: 1240px;
    margin: 20px auto;
    font-family: var(--eeduca-font);
    color: var(--eeduca-text-main);
    background: var(--eeduca-bg);
    padding: 24px;
    border-radius: var(--eeduca-radius);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,.05), 0 2px 4px -1px rgba(0,0,0,.03);
}

.eeduca-wrap h2 {
    font-weight: 700;
    font-size: 1.1rem;
    margin-top: 32px;
    margin-bottom: 16px;
    color: var(--eeduca-text-main);
    border-bottom: none;
    border-left: 3px solid var(--eeduca-accent);
    padding-left: 10px;
    padding-bottom: 0;
    margin-left: -2px;
}

/* --- Cards ----------------------------------------------------------------- */
.eeduca-cards {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.eeduca-card {
    flex: 1 1 180px;
    background: var(--eeduca-card-bg);
    border: 1px solid var(--eeduca-border);
    border-top: 3px solid var(--eeduca-card-accent, var(--eeduca-accent));
    border-radius: var(--eeduca-radius);
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
    transition: transform .2s ease, box-shadow .2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.eeduca-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px -4px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.04);
    border-color: var(--eeduca-card-accent, var(--eeduca-accent));
    border-top-color: var(--eeduca-card-accent, var(--eeduca-accent));
}

.eeduca-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.eeduca-card h3 {
    margin: 0;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--eeduca-text-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
}

.eeduca-card-icon-badge {
    position: relative;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.eeduca-card-icon-badge::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 7px;
    background: var(--eeduca-card-accent, var(--eeduca-accent));
    opacity: 0.12;
}

.eeduca-card-icon-badge svg {
    width: 16px;
    height: 16px;
    color: var(--eeduca-card-accent, var(--eeduca-accent));
    position: relative;
}

.eeduca-card .val {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--eeduca-text-main);
    line-height: 1.15;
}

/* --- Card color auto-cycle (nth-child, spec 0-3-0) ----------------------- */
.eeduca-cards > .eeduca-card:nth-child(5n+1) { --eeduca-card-accent: #3b82f6; }
.eeduca-cards > .eeduca-card:nth-child(5n+2) { --eeduca-card-accent: #06b6d4; }
.eeduca-cards > .eeduca-card:nth-child(5n+3) { --eeduca-card-accent: #10b981; }
.eeduca-cards > .eeduca-card:nth-child(5n+4) { --eeduca-card-accent: #f59e0b; }
.eeduca-cards > .eeduca-card:nth-child(5n+0) { --eeduca-card-accent: #8b5cf6; }

/* --- Card color variants (spec 0-3-0 matching nth-child, declared last → wins) */
.eeduca-cards > .eeduca-card.eeduca-card--blue   { --eeduca-card-accent: #3b82f6; }
.eeduca-cards > .eeduca-card.eeduca-card--teal   { --eeduca-card-accent: #06b6d4; }
.eeduca-cards > .eeduca-card.eeduca-card--green  { --eeduca-card-accent: #10b981; }
.eeduca-cards > .eeduca-card.eeduca-card--amber  { --eeduca-card-accent: #f59e0b; }
.eeduca-cards > .eeduca-card.eeduca-card--purple { --eeduca-card-accent: #8b5cf6; }
.eeduca-cards > .eeduca-card.eeduca-card--red    { --eeduca-card-accent: #ef4444; }

/* --- Tables ---------------------------------------------------------------- */
.eeduca-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 12px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

.eeduca-table th,
.eeduca-table td {
    padding: 11px 16px;
    text-align: left;
    border-bottom: 1px solid var(--eeduca-border);
    font-size: 0.875rem;
}

.eeduca-table th {
    background: #1e293b;
    font-weight: 600;
    color: #e2e8f0;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 0.7rem;
}

.eeduca-table tbody tr:nth-child(even) { background: #f8fafc; }
.eeduca-table tbody tr:last-child td   { border-bottom: none; }
.eeduca-table tbody tr:hover           { background: #eff6ff; box-shadow: inset 3px 0 0 var(--eeduca-accent); }

/* --- Pills (módulo Pontos) ------------------------------------------------- */
.eeduca-pill-positive {
    display: inline-block;
    padding: 2px 8px;
    background: #dcfce7;
    color: #166534;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.8rem;
}

.eeduca-pill-negative {
    display: inline-block;
    padding: 2px 8px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.8rem;
}

/* --- Filter bar ------------------------------------------------------------ */
.eeduca-filter {
    margin: 12px 0 20px;
    display: flex;
    gap: 16px;
    align-items: center;
    background: #f8fafc;
    padding: 14px 16px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    border: 1px solid var(--eeduca-border);
    flex-wrap: wrap;
}

.eeduca-filter label {
    font-weight: 500;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
}

.eeduca-filter input[type="date"],
.eeduca-filter input[type="text"],
.eeduca-filter select {
    padding: 7px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.875rem;
    color: #111827;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}

.eeduca-filter input:focus,
.eeduca-filter select:focus {
    outline: none;
    border-color: var(--eeduca-accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,.25);
}

.eeduca-filter .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: .5rem;
}

@media (max-width: 600px) {
    .eeduca-filter {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .eeduca-filter label {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .eeduca-filter input[type="date"],
    .eeduca-filter input[type="text"],
    .eeduca-filter select {
        width: 100%;
    }

    .eeduca-filter .actions {
        margin-bottom: 0;
    }

    .eeduca-filter .actions .eeduca-btn {
        flex: 1 1 auto;
        justify-content: center;
    }
}

/* --- Buttons --------------------------------------------------------------- */
.eeduca-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    font-family: inherit;
    border: 1px solid transparent;
    white-space: nowrap;
}

.eeduca-btn-primary {
    background: var(--eeduca-accent);
    color: #fff;
}

.eeduca-btn-primary:hover {
    background: var(--eeduca-accent-hover);
    color: #fff;
    box-shadow: 0 4px 6px -1px rgba(59,130,246,.4);
}

.eeduca-btn-secondary {
    background: #fff;
    color: #374151;
    border-color: #d1d5db;
}

.eeduca-btn-secondary:hover {
    background: #f9fafb;
    color: #111827;
    border-color: #9ca3af;
}

/* --- Note / caption -------------------------------------------------------- */
.eeduca-note {
    color: var(--eeduca-text-muted);
    font-size: 0.75rem;
    margin-top: 6px;
    line-height: 1.4;
}

/* --- Analytics: grid de seções -------------------------------------------- */
.eeduca-analytics-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 32px;
}

.eeduca-analytics-row .eeduca-section { margin-top: 0; }

.eeduca-section { margin-top: 32px; }

.eeduca-section h2 {
    font-weight: 700;
    font-size: 1rem;
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--eeduca-text-main);
    border-bottom: none;
    border-left: 3px solid var(--eeduca-accent);
    padding-left: 10px;
    padding-bottom: 0;
    margin-left: -2px;
}

@media (max-width: 720px) {
    .eeduca-analytics-row { grid-template-columns: 1fr; }
}

/* --- Loader de navegação (analytics) --------------------------------------- */
.eeduca-nav-loader {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(241, 245, 249, 0.88);
    backdrop-filter: blur(4px);
    z-index: 9999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.eeduca-nav-loader.active { display: flex; }

.eeduca-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--eeduca-accent);
    border-radius: 50%;
    animation: eeduca-spin .7s linear infinite;
}

.eeduca-nav-loader p {
    font-family: var(--eeduca-font);
    font-size: 0.9rem;
    color: var(--eeduca-text-muted);
    margin: 0;
}

@keyframes eeduca-spin {
    to { transform: rotate(360deg); }
}

/* --- Charts (módulo Overview) ------------------------------------------- */
.eeduca-chart-box {
    background: var(--eeduca-card-bg);
    border: 1px solid var(--eeduca-border);
    border-radius: var(--eeduca-radius);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
}

.eeduca-chart-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--eeduca-text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin: 0 0 16px;
}

/* --- Print --------------------------------------------------------------- */
.eeduca-print-header {
    display: none;
}

@media print {
    /* Cabeçalho visível só na impressão */
    .eeduca-print-header {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        margin-bottom: 20px;
        padding-bottom: 12px;
        border-bottom: 2px solid #e5e7eb;
        font-size: 0.9rem;
        color: #374151;
    }

    .eeduca-print-header strong {
        font-size: 1.1rem;
        color: #1f2937;
    }

    /* Esconde elementos de navegação e interação */
    .eeduca-db-sidebar,
    .eeduca-db-topbar,
    .eeduca-db-page-header,
    .eeduca-nav-loader,
    .eeduca-filter,
    #wpadminbar {
        display: none !important;
    }

    /* Desfaz o layout flex do body do dashboard */
    body.eeduca-db-body {
        display: block !important;
        background: #fff !important;
    }

    .eeduca-db-main {
        overflow: visible !important;
    }

    /* Remove sombras e fundos coloridos */
    .eeduca-wrap {
        box-shadow: none !important;
        background: #fff !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }

    .eeduca-card {
        box-shadow: none !important;
        border: 1px solid #e5e7eb !important;
        break-inside: avoid;
    }

    .eeduca-section {
        break-inside: avoid;
    }

    .eeduca-analytics-row {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Garante que links não mostrem URLs */
    a[href]::after {
        content: none !important;
    }
}
