/* ============================================================
   HIPERFLUXOGRAMA — Design System v2
   Melhorias UX: legibilidade, feedback visual, acessibilidade
   ============================================================ */

:root {
    --azul:        #48A1D9;
    --azul-escuro: #2a75a1;
    --azul-brilho: #64dce7;
    --bg-page:     #1a1c20;
    --bg-header:   rgba(16, 16, 18, 0.92);
    --text-primary:   #F2F2F2;
    --text-muted:     #8b949e;
    --border-subtle:  rgba(255,255,255,0.08);
    --radius-box: 12px;
    --trans-fast:   0.18s ease;
    --trans-normal: 0.28s ease;
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    overflow-x: hidden;
    cursor: default;
    user-select: none;
    background-image:
        linear-gradient(rgba(72,161,217,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(72,161,217,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* ── HEADER ─────────────────────────────────────────────── */
.modern-header {
    background: var(--bg-header);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.7rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0,0,0,0.35);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: opacity var(--trans-fast);
}
.brand-logo:hover { opacity: 0.85; }
.brand-logo img { height: 42px; width: auto; }

.brand-text h1 {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1;
}
.brand-text span { color: var(--azul); }

.nav-menu {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
}

.nav-link {
    text-decoration: none;
    color: #c9d1d9;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: 6px;
    transition: color var(--trans-fast), background var(--trans-fast);
    position: relative;
}
.nav-link:not(.btn-logout):hover {
    color: #fff;
    background: rgba(255,255,255,0.07);
}
.nav-link.active { color: var(--azul); }
.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 14px; right: 14px;
    height: 2px;
    background: var(--azul);
    border-radius: 2px;
}

.btn-logout {
    border: 1px solid rgba(255,255,255,0.15) !important;
    border-radius: 50px !important;
    padding: 7px 20px !important;
    font-size: 0.85rem;
}
.btn-logout:hover {
    background: rgba(239,68,68,0.12) !important;
    border-color: rgba(239,68,68,0.35) !important;
    color: #fca5a5 !important;
}

.mobile-toggle {
    display: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background var(--trans-fast);
}
.mobile-toggle:hover { background: rgba(255,255,255,0.08); }

/* ── BARRA DE PROGRESSO (topo) ──────────────────────────── */
.progress-strip {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--azul), var(--azul-brilho));
    border-radius: 0 3px 3px 0;
    z-index: 9999;
    transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 0 8px rgba(72,161,217,0.6);
    pointer-events: none;
}

/* ── HUD contador ────────────────────────────────────────── */
.hud-counter {
    position: fixed;
    bottom: 24px; right: 24px;
    background: rgba(15,17,22,0.92);
    border: 1px solid rgba(72,161,217,0.2);
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 12px;
    color: var(--text-muted);
    z-index: 200;
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: fadeUp 0.4s ease;
}
.hud-counter strong {
    color: var(--azul);
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
}
.hud-label { line-height: 1.3; }

/* ── LABEL DO PERÍODO ────────────────────────────────────── */
.periodo-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-align: center;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
    width: 148px;
}

/* ── MAIN / FLUXOGRAMA ───────────────────────────────────── */
main {
    transform: scale(0.8);
    transform-origin: top left;
    width: 125%;
    padding: 24px 0 60px;
    min-height: calc(100vh - 120px);
}

.fileira {
    display: flex;
    justify-content: flex-start;
    padding: 20px 40px;
    gap: 10px;
}

.coluna {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 150px;
}

/* ── BOX DAS MATÉRIAS ────────────────────────────────────── */
.box {
    width: 148px;
    min-height: 118px;
    margin: 6px 0;
    border-radius: var(--radius-box);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    transition:
        transform var(--trans-normal),
        box-shadow var(--trans-normal),
        filter var(--trans-normal),
        opacity var(--trans-normal);
    cursor: pointer;
    overflow: hidden;
    box-shadow:
        0 2px 8px rgba(0,0,0,0.35),
        inset 0 1px 0 rgba(255,255,255,0.07);
}

/* Reflexo interno */
.box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.07) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--trans-fast);
    pointer-events: none;
    border-radius: inherit;
}
.box:hover::before { opacity: 1; }

/* Badge "cursada" */
.box.cursada::after {
    content: '✓';
    position: absolute;
    top: 8px; right: 8px;
    font-size: 10px;
    font-weight: 800;
    color: rgba(255,255,255,0.9);
    background: rgba(34,197,94,0.35);
    width: 18px; height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(34,197,94,0.5);
}

.titulo {
    color: rgba(255,255,255,0.92);
    font-size: 11.5px;
    font-weight: 500;
    text-align: center;
    padding: 10px 12px 6px;
    z-index: 2;
    line-height: 1.4;
    text-shadow: 0 1px 3px rgba(0,0,0,0.45);
    letter-spacing: 0.15px;
}

/* ── BOTÃO ACESSE ────────────────────────────────────────── */
.btn {
    background: rgba(0,0,0,0.22);
    color: rgba(255,255,255,0.88);
    border: 1px solid rgba(255,255,255,0.18);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0.3px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all var(--trans-fast);
    z-index: 2;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}
.btn:hover {
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.38);
    color: #fff;
    transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }

/* ── TOOLTIP ─────────────────────────────────────────────── */
.custom-tooltip {
    position: fixed;
    background: rgba(12,14,18,0.97);
    color: #e2e8f0;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    font-family: 'Poppins', sans-serif;
    white-space: pre-line;
    z-index: 9999;
    pointer-events: none;
    max-width: 260px;
    border: 1px solid rgba(72,161,217,0.25);
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
    line-height: 1.55;
    animation: tooltipIn 0.12s ease forwards;
}
@keyframes tooltipIn {
    from { opacity:0; transform:translateY(-4px); }
    to   { opacity:1; transform:translateY(0); }
}

/* Linha divisória dentro do tooltip */
.custom-tooltip .tt-divider {
    margin: 6px -14px;
    border: none;
    border-top: 1px solid rgba(255,255,255,0.08);
}

/* ── PAINEL LATERAL ──────────────────────────────────────── */
.info-panel {
    position: fixed;
    right: -300px;
    top: 50%;
    transform: translateY(-50%);
    width: 280px;
    background: rgba(16,18,24,0.97);
    border: 1px solid rgba(255,255,255,0.08);
    border-right: none;
    border-radius: 14px 0 0 14px;
    padding: 18px;
    z-index: 500;
    transition: right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(16px);
    box-shadow: -6px 0 28px rgba(0,0,0,0.35);
}
.info-panel.visible { right: 0; }
.info-panel h3 { font-size: 13px; color: #fff; margin-bottom: 8px; line-height: 1.5; }
.info-panel .meta { font-size: 11.5px; color: var(--text-muted); margin-bottom: 3px; }
.info-panel .meta span { color: var(--azul); font-weight: 600; }
.info-panel .req-list { margin-top: 10px; }
.info-panel .req-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    padding: 5px 0;
    border-bottom: 1px solid var(--border-subtle);
    color: #c9d1d9;
}
.info-panel .req-item:last-child { border-bottom: none; }
.req-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.req-dot.ok    { background: #22c55e; box-shadow: 0 0 5px rgba(34,197,94,0.5); }
.req-dot.falta { background: #ef4444; box-shadow: 0 0 5px rgba(239,68,68,0.5); }

/* ── SELECIONADA ─────────────────────────────────────────── */
.selecionada {
    outline: 2px solid rgba(255,255,255,0.8);
    outline-offset: 3px;
}

/* ── EMPTY BOX ───────────────────────────────────────────── */
.box-empty {
    width: 148px;
    height: 118px;
    margin: 6px 0;
    visibility: hidden;
}

/* ── FOOTER ──────────────────────────────────────────────── */
.main-footer {
    background: #0d0e11;
    color: rgba(255,255,255,0.55);
    padding: 50px 0 20px;
    margin-top: 60px;
    border-top: 1px solid rgba(72,161,217,0.12);
    position: relative;
}
.main-footer::before {
    content: '';
    position: absolute;
    inset: -200px -200px auto;
    height: 300px;
    background: radial-gradient(circle, rgba(72,161,217,0.1), transparent 60%);
    pointer-events: none;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 28px 32px;
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr;
    gap: 44px;
    position: relative;
    z-index: 1;
}

.footer-section h3, .footer-section h4 {
    color: #fff;
    margin-bottom: 14px;
    font-weight: 600;
}
.footer-section h3 span { color: var(--azul); }
.brand-section p { font-size: 0.9rem; line-height: 1.65; color: rgba(255,255,255,0.55); }

.links-section ul { list-style: none; display: grid; gap: 9px; }
.links-section ul li a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 0.9rem;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.links-section ul li a:hover { color: var(--azul); transform: translateX(3px); }
.links-section ul li a::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    background: rgba(72,161,217,0.4);
    transition: 0.2s;
}
.links-section ul li a:hover::before { background: var(--azul); }

.social-icons { display: flex; gap: 10px; }
.social-icons a {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 14px;
    transition: 0.2s;
}
.social-icons a:hover {
    transform: translateY(-2px);
    border-color: rgba(72,161,217,0.35);
    color: var(--azul);
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 28px 0;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.38);
    position: relative;
    z-index: 1;
}

/* ── ORIENTATION WARNING ─────────────────────────────────── */
.orientation-warning {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.95);
    color: white;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
    text-align: center;
}
.orientation-warning.show { display: flex; }
.orientation-warning h2 { color: var(--azul); margin-bottom: 16px; }
.orientation-warning p  { color: rgba(255,255,255,0.7); }

/* ── MEDIA QUERIES ───────────────────────────────────────── */
@media (max-width: 768px) {
    .nav-menu    { display: none; }
    .mobile-toggle { display: block; }
    .nav-menu.open {
        display: flex; flex-direction: column;
        position: fixed; top: 60px; left: 0; right: 0;
        background: rgba(14,16,20,0.99);
        padding: 12px;
        border-bottom: 1px solid var(--border-subtle);
        z-index: 999;
    }
    .fileira   { flex-direction: column; padding: 12px; }
    .coluna    { flex-direction: row; flex-wrap: wrap; justify-content: center; }
    .box       { width: 130px; min-height: 110px; }
    .footer-content { grid-template-columns: 1fr; gap: 24px; }
    .footer-bottom  { flex-direction: column; text-align: center; gap: 6px; }
    .hud-counter    { bottom: 16px; right: 16px; }
}

/* ── KEYFRAMES ───────────────────────────────────────────── */
@keyframes glowing {
    0%   { background-position: 0 0; }
    50%  { background-position: 400% 0; }
    100% { background-position: 0 0; }
}
@keyframes fadeUp {
    from { opacity:0; transform:translateY(10px); }
    to   { opacity:1; transform:translateY(0); }
}
@keyframes pulseIn {
    from { transform:scale(0.9); opacity:0; }
    to   { transform:scale(1);   opacity:1; }
}
