/* LMS — customização mínima em cima do Bootstrap 5.
   Foco: mobile-first legível (360px+) e sticky footer. */

/* ============================================================
   Design tokens — promovidos a :root em E29-01 pra serem reusados
   por lms-student-area, lms-teacher-area e lms-admin-area. Antes
   estavam scoped em body.lms-student-area. Cascade preservada:
   overrides especificos (ex.: body.lms-student-area.lms-theme-dark)
   continuam ganhando por especificidade.
   ============================================================ */
:root {
    --lms-primary-1: #6366F1;
    --lms-primary-2: #EC4899;
    --lms-gradient-primary: linear-gradient(135deg, #6366F1, #EC4899);

    --lms-success: #10B981;
    --lms-success-dark: #047857;
    --lms-success-tint: #D1FAE5;

    --lms-warning: #F59E0B;
    --lms-warning-dark: #92400E;
    --lms-warning-tint: #FEF3C7;

    --lms-danger: #EF4444;
    --lms-danger-dark: #B91C1C;
    --lms-danger-tint: #FEE2E2;

    --lms-violet: #8B5CF6;
    --lms-violet-dark: #5B21B6;
    --lms-violet-tint: #EDE9FE;

    --lms-muted: #94A3B8;
    --lms-muted-dark: #475569;
    --lms-muted-tint: #F1F5F9;

    --lms-neutral-900: #111827;
    --lms-neutral-700: #374151;
    --lms-neutral-500: #6B7280;
    --lms-neutral-300: #D1D5DB;
    --lms-neutral-200: #E5E7EB;
    --lms-neutral-100: #F3F4F6;
    --lms-neutral-50:  #F9FAFB;

    --lms-page-bg: #F8F7FB;
    --lms-card-bg: #FFFFFF;

    --lms-radius-chip: 999px;
    --lms-radius-inner: 12px;
    --lms-radius-card: 20px;
    --lms-radius-hero: 24px;

    --lms-shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04);
    --lms-shadow-card-hover: 0 18px 40px -18px rgba(16, 24, 40, 0.22);
    --lms-shadow-card-indigo: 0 10px 24px -8px rgba(99, 102, 241, 0.25);
    --lms-shadow-cta: 0 6px 14px -6px rgba(99, 102, 241, 0.6);
}

html, body { min-height: 100vh; }
body {
    display: flex;
    flex-direction: column;
    font-size: 16px; /* inputs com <16px causam auto-zoom no iOS Safari */
}

/* ============================================================
   Teacher + Admin areas — shell visual (E29-01)
   Aplica fontes + page bg + overrides Bootstrap leves via cascade.
   Sem sidebar (decisao PO 2026-04-26 — diferente do aluno).
   Sem dark mode (out-of-scope no MVP).
   ============================================================ */
body.lms-teacher-area,
body.lms-admin-area {
    background: var(--lms-page-bg);
    color: var(--lms-neutral-700);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
body.lms-teacher-area h1, body.lms-teacher-area h2, body.lms-teacher-area h3, body.lms-teacher-area h4,
body.lms-teacher-area .h1, body.lms-teacher-area .h2, body.lms-teacher-area .h3, body.lms-teacher-area .h4,
body.lms-admin-area h1, body.lms-admin-area h2, body.lms-admin-area h3, body.lms-admin-area h4,
body.lms-admin-area .h1, body.lms-admin-area .h2, body.lms-admin-area .h3, body.lms-admin-area .h4 {
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--lms-neutral-900);
}
body.lms-teacher-area .card,
body.lms-admin-area .card {
    border-radius: 16px;
    border: 1px solid var(--lms-neutral-200);
    box-shadow: var(--lms-shadow-card);
}
body.lms-teacher-area .form-control,
body.lms-teacher-area .form-select,
body.lms-admin-area .form-control,
body.lms-admin-area .form-select {
    border-radius: 10px;
    border-color: var(--lms-neutral-200);
}
body.lms-teacher-area .btn,
body.lms-admin-area .btn {
    border-radius: 10px;
    font-weight: 600;
}

/* ============================================================
   Hero pattern (lms-dashboard-*) — promovido pra app.css em E29-02
   pra ser usado por aluno + teacher + admin. Antes vivia em
   student-area.css.
   ============================================================ */
.lms-dashboard-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    width: 100%;
}
.lms-dashboard-eyebrow {
    display: block;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #7C3AED;
    margin-bottom: 6px;
}
.lms-dashboard-title {
    font-size: 32px;
    line-height: 1.15;
    margin: 0 0 6px;
}
.lms-dashboard-subtitle {
    margin: 0;
    color: var(--lms-neutral-500);
    font-size: 14px;
}
@media (max-width: 575.98px) {
    .lms-dashboard-header { margin-bottom: 16px; }
    .lms-dashboard-title { font-size: 24px; }
}

main { flex: 1 0 auto; }

/* Garante que inputs mantêm 16px em foco — Bootstrap usa 1rem que herda do body */
.form-control, .form-select { font-size: 1rem; }

/* Trunca nome/email longo do usuário no navbar em telas estreitas */
.navbar .user-label {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Evita que o menu dropdown saia fora da viewport em mobile */
@media (max-width: 575.98px) {
    .navbar .user-label { max-width: 10rem; }
}

/* ============================================================
   Cards de disciplina/CU no painel do aluno (#99)
   ------------------------------------------------------------
   Borda lateral pinta por status: cinza=não iniciada, laranja=
   em andamento, verde=concluída. Anel de progresso via
   conic-gradient (zero JS). Link envolve o card inteiro.
   ============================================================ */

.lms-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: #fff;
    border-radius: .5rem;
    border-left: 4px solid #adb5bd; /* não iniciada */
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
    color: inherit;
    text-decoration: none;
    transition: box-shadow .15s ease;
}
.lms-card:hover {
    box-shadow: 0 3px 8px rgba(0, 0, 0, .1);
    color: inherit;
}
.lms-card--in-progress { border-left-color: #fd7e14; }
.lms-card--completed   { border-left-color: #198754; }

.lms-card__body { flex: 1 1 auto; min-width: 0; }
.lms-card__title {
    font-weight: 600;
    font-size: 1rem;
    margin: 0 0 .25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lms-card__meta {
    color: #6c757d;
    font-size: .875rem;
}

.lms-progress-ring {
    --pct: 0;
    --ring-color: #adb5bd;
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), #e9ecef 0);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lms-progress-ring::before {
    content: "";
    position: absolute;
    inset: 5px;
    background: #fff;
    border-radius: 50%;
}
.lms-progress-ring__label {
    position: relative;
    font-weight: 600;
    font-size: .8rem;
    color: #495057;
}
.lms-progress-ring--in-progress { --ring-color: #fd7e14; }
.lms-progress-ring--completed   { --ring-color: #198754; }

@media (max-width: 575.98px) {
    .lms-card { padding: .75rem .9rem; gap: .75rem; }
    .lms-progress-ring { width: 48px; height: 48px; }
    .lms-progress-ring__label { font-size: .75rem; }
}

/* ============================================================
   Navbar + sino de notificações (E10-01)
   ------------------------------------------------------------
   Design tokens locais — a expansão pra globals (Plus Jakarta
   Sans, Inter, paleta, etc.) acontece no E14.
   ============================================================ */

[x-cloak] { display: none !important; }

.lms-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: #fff;
    border-bottom: 1px solid #E5E7EB;
    height: 64px;
}
.lms-navbar__inner {
    max-width: 1280px;
    height: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.lms-navbar__brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #111827;
}
.lms-navbar__brand:hover { color: #111827; }
.lms-navbar__logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366F1, #EC4899);
    color: #fff;
    font-weight: 800;
    font-size: 18px;
    line-height: 1;
    box-shadow: 0 4px 10px -4px rgba(99, 102, 241, 0.5);
}
.lms-navbar__logo-img {
    /* Altura controlada; largura proporcional ao aspect ratio nativo da
       imagem. !important blinda contra eventual regra global de img. */
    display: block;
    height: 48px !important;
    width: auto !important;
    max-width: none !important;
}
.lms-navbar__wordmark {
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.01em;
}
.lms-navbar__right {
    display: inline-flex;
    align-items: center;
    gap: 16px;
}

/* Primary nav links (entre brand e right group). margin-right:auto empurra
   o right group pra borda mantendo o layout [brand][nav] ........ [right]. */
.lms-navbar__nav {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: auto;
}
.lms-navbar__link {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 999px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background 160ms ease, color 160ms ease;
}
.lms-navbar__link:hover { background: #F3F4F6; color: #111827; }
.lms-navbar__link.is-active { background: #EEF2FF; color: #4F46E5; }
.lms-navbar__link-icon { display: none; font-size: 18px; line-height: 1; }
.lms-navbar__link-text { display: inline; }

/* Avatar nas linhas de ranking (E17-05). Funciona em /teacher/ranking
   (Bootstrap default) e /student/ranking (override em student-area.css
   se quiser ajustar tamanho). 32x32 redondo. Oculto em mobile via
   d-none d-md-inline-block aplicado no markup. */
.lms-ranking-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: #F3F4F6;
    vertical-align: middle;
    margin-right: 8px;
}

/* Patente pill no ranking (E28-02). Funciona em /teacher/ranking (Bootstrap)
   e /student/ranking (student-area). Cor de fundo vem inline via style="" do
   markup — rank.color_hex e validado server-side como #RRGGBB antes de sair.
   Texto sempre branco; cores muito pastel ficam ilegiveis (anotar em doc/99
   se PO reportar). Modificador --inline encolhe pill pra caber ao lado do
   nome em mobile. */
.lms-rank-pill {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 999px;
    background: #6B7280;
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.2;
    white-space: nowrap;
    vertical-align: middle;
}
.lms-rank-pill--inline {
    margin-left: 6px;
    padding: 2px 10px;
    font-size: 10px;
}

/* Language pill */
.lms-navbar__lang-form { display: inline-flex; }
.lms-navbar__lang {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #E5E7EB;
    background: #fff;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease;
}
.lms-navbar__lang:hover { background: #F3F4F6; border-color: #D1D5DB; }
.lms-navbar__lang-label { white-space: nowrap; }

/* Divider vertical */
.lms-navbar__divider {
    width: 1px;
    height: 24px;
    background: #E5E7EB;
}

/* Usuário */
.lms-navbar__user .dropdown-toggle::after { margin-left: 6px; }
.lms-navbar__user-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 4px 4px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    color: #374151;
    cursor: pointer;
}
.lms-navbar__user-btn:hover { background: #F3F4F6; }
.lms-navbar__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}
.lms-navbar__user-name {
    font-weight: 600;
    font-size: 14px;
    max-width: 14rem;
}

/* ===== Sino ===== */
.lms-bell { position: relative; }
.lms-bell__btn {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #E5E7EB;
    color: #374151;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 160ms ease;
}
.lms-bell__btn:hover { background: #F3F4F6; }
.lms-bell__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: linear-gradient(135deg, #EC4899, #EF4444);
    border: 2px solid #fff;
    color: #fff;
    font-weight: 700;
    font-size: 10px;
    line-height: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.lms-bell__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    box-shadow: 0 18px 40px -18px rgba(16, 24, 40, 0.22);
    overflow: hidden;
    z-index: 1040;
}
.lms-bell__dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #F3F4F6;
}
.lms-bell__dropdown-title {
    font-weight: 700;
    font-size: 14px;
    color: #111827;
}
.lms-bell__mark-all {
    background: transparent;
    border: 0;
    padding: 0;
    color: #6366F1;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.lms-bell__mark-all:hover { text-decoration: underline; }
.lms-bell__empty {
    padding: 24px 16px;
    text-align: center;
    color: #6B7280;
    font-size: 13px;
}
.lms-bell__list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 360px;
    overflow-y: auto;
}
.lms-bell__item { border-bottom: 1px solid #F3F4F6; }
.lms-bell__item:last-child { border-bottom: 0; }
.lms-bell__item--unread { background: #F5F3FF; }
.lms-bell__item-btn {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
}
.lms-bell__item-btn:hover { background: rgba(99, 102, 241, 0.08); }
.lms-bell__dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    margin-top: 6px;
    border-radius: 50%;
    background: #6366F1;
}
.lms-bell__item-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.lms-bell__item-title {
    font-weight: 600;
    font-size: 13px;
    color: #111827;
    line-height: 1.35;
}
.lms-bell__item-text {
    font-size: 12px;
    color: #6B7280;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.lms-bell__item-time {
    font-size: 11px;
    color: #9CA3AF;
    margin-top: 2px;
}
.lms-bell__dropdown-footer {
    padding: 10px 16px;
    border-top: 1px solid #F3F4F6;
    text-align: center;
}
.lms-bell__view-all {
    font-size: 12px;
    font-weight: 600;
    color: #6366F1;
    text-decoration: none;
}
.lms-bell__view-all:hover { text-decoration: underline; }

/* Mobile */
@media (max-width: 575.98px) {
    .lms-navbar__inner { padding: 0 12px; gap: 8px; }
    .lms-navbar__right { gap: 8px; }
    .lms-navbar__lang-label { display: none; }
    .lms-navbar__lang { padding: 8px; }
    .lms-navbar__divider { display: none; }
    .lms-navbar__user-name { display: none; }
    .lms-navbar__nav { display: none; }
    .lms-bell__dropdown { width: calc(100vw - 16px); right: -8px; }
}

/* ============================================================
   Página /notifications (E10-01)
   ============================================================ */

.lms-notif-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
}
.lms-notif-list__empty {
    padding: 48px 16px;
    text-align: center;
    color: #6B7280;
}
.lms-notif-row {
    border-bottom: 1px solid #F3F4F6;
}
.lms-notif-row:last-child { border-bottom: 0; }
.lms-notif-row--unread { background: #F5F3FF; }
.lms-notif-row__btn {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 16px;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
}
.lms-notif-row__btn:hover { background: rgba(99, 102, 241, 0.08); }
.lms-notif-row__dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    margin-top: 8px;
    border-radius: 50%;
    background: #6366F1;
}
.lms-notif-row__spacer { width: 8px; flex: 0 0 auto; }
.lms-notif-row__body { flex: 1 1 auto; min-width: 0; }
.lms-notif-row__title {
    font-weight: 600;
    font-size: 14px;
    color: #111827;
    margin: 0 0 2px;
}
.lms-notif-row__text {
    font-size: 13px;
    color: #6B7280;
    line-height: 1.5;
    margin: 0 0 4px;
}
.lms-notif-row__time {
    font-size: 12px;
    color: #9CA3AF;
}

/* ============================================================
   /teacher/settings/notifications — matriz de toggles (E21-03 + fix #247)
   Render unico: desktop = 3 colunas (label / sino / email);
   mobile <768px = 1 coluna empilhada com label da celula visivel.
   ============================================================ */

.lms-notif-matrix {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.lms-notif-matrix__header {
    display: grid;
    grid-template-columns: 1fr 110px 110px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #DEE2E6;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6B7280;
}

.lms-notif-matrix__col-channel {
    text-align: center;
}

.lms-notif-matrix__row {
    display: grid;
    grid-template-columns: 1fr 110px 110px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #F3F4F6;
}

.lms-notif-matrix__row:last-child {
    border-bottom: none;
}

.lms-notif-matrix__label {
    font-weight: 500;
    color: #1F2937;
}

.lms-notif-matrix__cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    cursor: pointer;
    min-height: 32px;
}

.lms-notif-matrix__cell .form-check-input {
    margin: 0;
    cursor: pointer;
    width: 1.25em;
    height: 1.25em;
}

/* Em desktop o label da celula fica oculto — coluna do header ja indica. */
.lms-notif-matrix__cell-label {
    display: none;
    margin-right: 8px;
    color: #4B5563;
    font-size: 14px;
}

/* Mobile: empilha em 1 coluna. Header some, cada celula mostra seu label
   inline pra nao ficar so o checkbox boiando. */
@media (max-width: 767.98px) {
    .lms-notif-matrix__header {
        display: none;
    }
    .lms-notif-matrix__row {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 14px 0;
    }
    .lms-notif-matrix__label {
        font-weight: 600;
        margin-bottom: 4px;
    }
    .lms-notif-matrix__cell {
        justify-content: flex-start;
        padding: 6px 0;
    }
    .lms-notif-matrix__cell-label {
        display: inline;
    }
}

/* ============================================================
   Tenant picker no login (E22-01 + polish E22-03)
   ============================================================ */

.lms-tenant-picker__card {
    min-height: 70px;       /* consistent height entre cards de tenant_name longo/curto */
    transition: transform 120ms ease;
}
.lms-tenant-picker__card:hover {
    transform: translateY(-1px);
}
.lms-tenant-picker__card:focus-visible {
    outline: 2px solid var(--bs-primary, #0d6efd);
    outline-offset: 2px;
}

.lms-tenant-picker__name {
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.lms-tenant-picker__teacher {
    color: #6c757d; /* text-muted base */
}

/* No hover/focus do btn-outline-primary, o teacher fica branco semi
   transparente pra preservar contraste contra o bg azul. */
.lms-tenant-picker__card:hover .lms-tenant-picker__teacher,
.lms-tenant-picker__card:focus .lms-tenant-picker__teacher,
.lms-tenant-picker__card:active .lms-tenant-picker__teacher {
    color: rgba(255, 255, 255, 0.85);
}

/* Mobile <576px: cards um pouco mais compactos. */
@media (max-width: 575.98px) {
    .lms-tenant-picker__card {
        min-height: 60px;
        padding: 0.75rem 1rem;
    }
}

/* ============================================================
   Loading overlay no submit de formulários (anti duplo-clique).
   Ativado via JS em public/assets/js/app.js. z-index 1080 fica
   acima de modais Bootstrap (1055) e backdrops (1050).
   ============================================================ */

.lms-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 24, 39, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 120ms ease;
}

.lms-loading-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.lms-loading-overlay__panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 24px 32px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 50px -12px rgba(16, 24, 40, 0.35);
    min-width: 180px;
}

.lms-loading-overlay__spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid #E5E7EB;
    border-top-color: #6366F1;
    animation: lms-loading-spin 720ms linear infinite;
}

.lms-loading-overlay__label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

@keyframes lms-loading-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .lms-loading-overlay { transition: none; }
    .lms-loading-overlay__spinner { animation-duration: 1600ms; }
}
