/* =========================================================================
   css/style.css - CASCA GLOBAL, DESIGN SYSTEM & LAYOUT MESTRE (PORTAL)
   Portal do Careca • Prof. Raphael Paulino
   ========================================================================= */

/* -------------------------------------------------------------------------
   1. DESIGN TOKENS, VARIÁVEIS CANÔNICAS & ALIASES RELACIONAIS
   ------------------------------------------------------------------------- */
:root {
    /* Cores de Superfície e Fundo */
    --bg-page: #0b0f19;
    --bg-surface: #111827;
    --bg-card: #182238;
    --bg-card-hover: #1f2c47;
    
    /* Aliases para compatibilidade entre módulos */
    --bg-primary: var(--bg-page);
    --bg-secondary: var(--bg-surface);

    /* Linhas e Delimitações */
    --border-color: #23324d;
    --border-card: var(--border-color);
    --border-subtle: rgba(255, 255, 255, 0.08);

    /* Tipografia e Escalas de Texto */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-main: var(--text-primary);

    /* Cores Temáticas de Identidade e Ação */
    --brand-blue: #38bdf8;
    --brand-blue-hover: #0ea5e9;
    --accent-blue: var(--brand-blue);
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --accent-violet: #8b5cf6;
    --danger: var(--accent-rose);

    /* Métricas Estruturais da Casca */
    --sidebar-width: 270px;
    --header-height: 76px;
}

/* -------------------------------------------------------------------------
   2. RESET UNIVERSAL, TIPOGRAFIA & ÍCONES
   ------------------------------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

.icon-svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* -------------------------------------------------------------------------
   3. ESTRUTURA PRINCIPAL & MENU LATERAL (SIDEBAR)
   ------------------------------------------------------------------------- */
.app-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.sidebar-top {
    height: var(--header-height);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-badge-small {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-text h3 {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
}

.brand-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-close-sidebar {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-menu {
    flex: 1;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.menu-item.active {
    background: rgba(56, 189, 248, 0.12);
    color: var(--brand-blue);
    border-color: rgba(56, 189, 248, 0.25);
}

.btn-instalar-app-sidebar {
    color: var(--brand-blue) !important;
    background: rgba(56, 189, 248, 0.06);
    border: 1px dashed rgba(56, 189, 248, 0.3) !important;
}

.btn-instalar-app-sidebar:hover {
    background: rgba(56, 189, 248, 0.15) !important;
}

.badge-alerta-sidebar {
    background: var(--danger);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: auto;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.sidebar-bottom {
    padding: 1.25rem 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-muted);
    transition: all 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-logout:hover {
    background: rgba(244, 63, 94, 0.1);
    color: var(--accent-rose);
}

/* -------------------------------------------------------------------------
   4. ÁREA CENTRAL, CABEÇALHO & PERFIL DO ALUNO
   ------------------------------------------------------------------------- */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--bg-page);
}

.app-header {
    height: var(--header-height);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-toggle-menu {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.breadcrumb-trail {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.breadcrumb-trail .sep {
    color: var(--text-muted);
}

.breadcrumb-trail .current {
    color: var(--text-primary);
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.btn-instalar-header {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 20px;
    color: var(--brand-blue);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.btn-instalar-header:hover {
    background: rgba(56, 189, 248, 0.22);
    border-color: var(--brand-blue);
    color: #ffffff;
}

.btn-instalar-header .icon-svg {
    width: 15px;
    height: 15px;
}

/* Cartão do Perfil do Aluno */
.profile-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 14px 6px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 40px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.2s ease;
}

.profile-card:hover {
    border-color: var(--brand-blue);
}

.profile-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.profile-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.profile-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--brand-blue);
    background: rgba(56, 189, 248, 0.12);
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 3px;
    text-transform: uppercase;
}

.profile-avatar-wrap {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--brand-blue);
    background: var(--bg-page);
}

.status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 11px;
    height: 11px;
    background: var(--accent-emerald);
    border: 2px solid var(--bg-card);
    border-radius: 50%;
}

/* Menu Dropdown de Opções da Conta */
.dropdown-menu-perfil {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 195px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65);
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 1000;
    animation: fadeInDropdown 0.15s ease-out;
}

.dropdown-menu-perfil.open {
    display: flex;
}

@keyframes fadeInDropdown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s ease;
    text-align: left;
}

.dropdown-item:hover {
    background: rgba(56, 189, 248, 0.1);
    color: var(--brand-blue);
}

.dropdown-divisor {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.dropdown-item-sair:hover {
    background: rgba(244, 63, 94, 0.12);
    color: var(--accent-rose);
}

.badge-turma-dropdown {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--brand-blue);
    background: rgba(56, 189, 248, 0.12);
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
}

/* Área de Conteúdo Útil */
.app-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.content-welcome {
    margin-bottom: 2rem;
}

.content-welcome h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.4rem;
}

.content-welcome p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* -------------------------------------------------------------------------
   5. CENTRAL DE NOTIFICAÇÕES (SININHO DO TOPO & ATIVAÇÃO PUSH)
   ------------------------------------------------------------------------- */
.container-sininho-aluno {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.btn-sininho-aluno {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 8px;
    width: 38px;
    height: 38px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.btn-sininho-aluno:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.badge-contador-sininho-aluno {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent-amber);
    color: #0b0f19;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 14px;
    text-align: center;
    border: 2px solid #0b0f19;
    line-height: 1;
}

.dropdown-notificacoes-aluno {
    display: none;
    position: absolute;
    right: 0;
    top: 46px;
    width: 310px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    z-index: 1000;
    padding: 14px;
    box-sizing: border-box;
}

.dropdown-notificacoes-aluno.aberto,
.dropdown-notificacoes-aluno.open {
    display: block !important;
}

.dropdown-notificacoes-aluno-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 10px;
}

.dropdown-notificacoes-aluno-titulo {
    font-size: 0.85rem;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dropdown-notificacoes-aluno-qtd {
    font-size: 0.74rem;
    color: var(--text-secondary);
}

.dropdown-notificacoes-aluno-scroll {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.wrapper-btn-push {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    display: none;
}

.wrapper-btn-push.visivel {
    display: block;
}

.btn-ativar-push-dropdown {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 9px 14px;
    margin-bottom: 10px;
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 8px;
    color: var(--brand-blue);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-ativar-push-dropdown:hover {
    background: rgba(56, 189, 248, 0.16);
    border-color: var(--brand-blue);
    transform: translateY(-1px);
}

.btn-ativar-push-dropdown:active {
    transform: translateY(0);
}

.btn-ativar-push-dropdown svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.btn-ativar-push-dropdown.ativo {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.25);
    color: #34d399;
    cursor: default;
}

/* -------------------------------------------------------------------------
   6. COMPONENTES PRIMITIVOS DE FORMULÁRIO & MODAIS
   ------------------------------------------------------------------------- */
.input-padrao {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.input-padrao:focus {
    border-color: var(--brand-blue);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(5, 8, 15, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    box-sizing: border-box;
    z-index: 9999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay.open {
    display: flex;
}

.modal-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.7);
    box-sizing: border-box;
}

.modal-box-large {
    max-width: 680px;
}

.modal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.85rem;
    margin-bottom: 1rem;
    width: 100%;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.btn-cancel {
    padding: 10px 18px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s ease;
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn-confirm {
    padding: 10px 20px;
    background: var(--brand-blue);
    border: none;
    color: #0b0f19;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s ease;
}

.btn-confirm:hover {
    background: var(--brand-blue-hover);
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 6px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s ease;
}

.btn-close-modal:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Blindagem de Rolagem do Modal de Envio */
#modalEnvioCaderno .modal-box {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#formEnvioCaderno {
    flex: 1 1 auto;
    overflow-y: auto;
    padding-right: 6px;
}

#formEnvioCaderno::-webkit-scrollbar {
    width: 6px;
}

#formEnvioCaderno::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

/* Blindagem e Sanfona do Modal de Perfil */
#modalPerfilAluno .modal-box {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-perfil-corpo {
    display: flex;
    flex-direction: column;
    max-height: calc(85vh - 120px);
    overflow-y: auto;
    padding-right: 4px;
}

.modal-perfil-corpo::-webkit-scrollbar {
    width: 6px;
}

.modal-perfil-corpo::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

.bloco-drill-perfil {
    border: 1px solid #1e293b;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.4);
    overflow: hidden;
}

.btn-drill-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #1e293b;
    border: none;
    color: #e2e8f0;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-drill-toggle:hover {
    background: #273549;
}

.btn-drill-toggle.ativo {
    background: #1e293b;
    color: var(--brand-blue);
    border-bottom: 1px solid #334155;
}

.icon-svg-drill {
    width: 16px;
    height: 16px;
}

.seta-drill {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.conteudo-drill {
    padding: 10px;
}

/* -------------------------------------------------------------------------
   7. SELETOR UNIVERSAL DE AVATARES (AVATAR SERVICE)
   ------------------------------------------------------------------------- */
.avatars-scroll-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
    gap: 10px;
    max-height: 210px;
    overflow-y: auto;
    padding: 8px;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

.avatar-option-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    border-radius: 10px;
    border: 2px solid transparent;
    background: var(--bg-card);
    cursor: pointer;
    box-sizing: border-box;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.avatar-option-card:hover {
    border-color: rgba(56, 189, 248, 0.4);
    background: rgba(56, 189, 248, 0.08);
}

.avatar-option-card img {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0 auto 4px auto;
}

.avatar-option-card span {
    font-size: 0.68rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60px;
    text-align: center;
}

.avatar-option-card.selected,
.avatar-option-card.active {
    border-color: var(--brand-blue);
    background: rgba(56, 189, 248, 0.22);
    transform: scale(1.05);
}

.avatar-option-card.selected span,
.avatar-option-card.active span {
    color: var(--brand-blue);
    font-weight: 700;
}

/* -------------------------------------------------------------------------
   8. MODAL DE ZOOM DE IMAGENS (UI GLOBAL)
   ------------------------------------------------------------------------- */
.modal-zoom-imagem {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(11, 15, 25, 0.95);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 1rem;
    box-sizing: border-box;
}

.modal-zoom-imagem.aberto {
    opacity: 1;
    pointer-events: auto;
}

.modal-zoom-conteudo {
    position: relative;
    max-width: 92vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.btn-fechar-zoom {
    position: absolute;
    top: -45px;
    right: 0;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #f8fafc;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s ease;
    touch-action: manipulation;
}

.btn-fechar-zoom:hover {
    background: rgba(255, 255, 255, 0.25);
}

.img-zoom-display {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* -------------------------------------------------------------------------
   9. COMPONENTES DINÂMICOS DE LATEX & TABELAS
   ------------------------------------------------------------------------- */
.latex-img-wrap {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.latex-img-gabarito {
    cursor: zoom-in;
    max-height: 280px;
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.latex-tabela-wrap {
    overflow-x: auto;
    margin: 1.5rem 0;
    -webkit-overflow-scrolling: touch;
}

.latex-tabela {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-align: center;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.latex-th {
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    font-weight: 700;
}

.latex-td {
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.latex-lista-wrap {
    margin: 1.2rem 0;
    display: flex;
    flex-direction: column;
}

.latex-item-linha {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
    align-items: flex-start;
}

.latex-item-prefixo {
    color: var(--brand-blue);
    font-weight: 600;
    margin-top: 2px;
    min-width: 1.2rem;
}

.latex-item-corpo {
    flex: 1;
    line-height: 1.6;
}

.latex-box-responda {
    border-left: 4px solid var(--accent-amber);
    background: rgba(245, 158, 11, 0.05);
    padding: 10px 14px;
    margin: 15px 0;
    border-radius: 4px;
}

.latex-box-dica {
    background-color: rgba(56, 189, 248, 0.1);
    border-left: 4px solid var(--brand-blue);
    padding: 12px 14px;
    margin: 15px 0;
    border-radius: 4px;
    color: #93c5fd;
    font-size: 0.9rem;
}

.latex-box-explicacao {
    background-color: rgba(16, 185, 129, 0.05);
    border-left: 4px solid var(--accent-emerald);
    padding: 12px 14px;
    margin: 15px 0;
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* -------------------------------------------------------------------------
   10. SISTEMA DE TOASTS FLUTUANTES (SWIPE MOBILE) & BOTÕES DE ANEXO
   ------------------------------------------------------------------------- */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
    width: calc(100% - 40px);
    pointer-events: none;
}

.toast-item {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #0f172a;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 0 0 1px #1e293b;
    color: #f1f5f9;
    font-size: 0.82rem;
    line-height: 1.35;
    touch-action: pan-y;
    user-select: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
    animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast-item.sucesso { border-left: 4px solid var(--accent-emerald); }
.toast-item.erro    { border-left: 4px solid var(--accent-rose); }
.toast-item.aviso   { border-left: 4px solid var(--accent-amber); }

.toast-icone-svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toast-item.sucesso .toast-icone-svg { color: var(--accent-emerald); }
.toast-item.erro .toast-icone-svg    { color: var(--accent-rose); }
.toast-item.aviso .toast-icone-svg   { color: var(--accent-amber); }

.toast-mensagem {
    flex: 1;
    font-weight: 500;
}

.toast-btn-fechar {
    background: transparent;
    border: none;
    color: #64748b;
    padding: 2px 6px;
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.15s ease;
}

.toast-btn-fechar:hover {
    color: #f1f5f9;
}

.toast-item.saindo {
    opacity: 0;
    transform: translateX(100%);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Botão de Anexo sem sublinhado residual */
.btn-anexo-chat,
.btn-anexo-chat:hover,
.btn-anexo-chat:visited {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 12px;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 6px;
    color: var(--brand-blue);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-anexo-chat:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: var(--brand-blue);
    transform: translateY(-1px);
}

.btn-anexo-chat svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
}

/* -------------------------------------------------------------------------
   11. CLASSES AUXILIARES COMPARTILHADAS (UTILITY CLASSES)
   ------------------------------------------------------------------------- */
.w-100 { width: 100% !important; }
.d-none { display: none !important; }
.flex { display: flex !important; }
.block { display: block !important; }
.text-center { text-align: center !important; }
.font-xs { font-size: 0.75rem !important; }
.font-md { font-size: 0.95rem !important; }
.font-bold { font-weight: 700 !important; }
.font-weight-600 { font-weight: 600 !important; }
.font-weight-normal { font-weight: normal !important; }
.cursor-pointer { cursor: pointer !important; }
.opacity-50 { opacity: 0.5 !important; }
.m-0 { margin: 0 !important; }
.mt-3 { margin-top: 3px !important; }
.mt-8 { margin-top: 8px !important; }
.mt-10 { margin-top: 10px !important; }
.mt-15 { margin-top: 15px !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 2px !important; }
.mb-4 { margin-bottom: 4px !important; }
.p-10 { padding: 10px !important; }
.p-12 { padding: 12px !important; }
.p-20 { padding: 20px !important; }

.flex-gap-12 { display: flex; gap: 12px; }
.flex-col-gap-6 { display: flex; flex-direction: column; gap: 6px; }
.flex-col-gap-10 { display: flex; flex-direction: column; gap: 10px; }
.flex-col-gap-12 { display: flex; flex-direction: column; gap: 12px; }
.flex-wrap-gap-8 { display: flex; flex-wrap: wrap; gap: 8px; }
.flex-justify-between { display: flex; justify-content: space-between; }
.flex-align-center-gap-8 { display: flex; align-items: center; gap: 8px; }
.flex-align-center-gap-10 { display: flex; align-items: center; gap: 10px; }

.txt-blue { color: var(--brand-blue) !important; }
.txt-emerald { color: var(--accent-emerald) !important; }
.txt-amber { color: var(--accent-amber) !important; }
.txt-orange { color: #f97316 !important; }
.txt-violet { color: var(--accent-violet) !important; }
.txt-danger { color: var(--danger) !important; }
.txt-muted { color: var(--text-muted) !important; }
.txt-muted-sm { color: var(--text-secondary); font-size: 0.82rem; }
.txt-muted-xs { color: var(--text-secondary); font-size: 0.72rem; }
.txt-main-bold { color: var(--text-primary); font-weight: 700; }
.txt-carregando-centro { text-align: center; padding: 2.5rem; color: var(--brand-blue); }

.border-bottom-card { border-bottom: 1px solid var(--border-color); }
.form-label-sm { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; display: block; }

/* -------------------------------------------------------------------------
   12. RESPONSIVIDADE OFICIAL DA CASCA (BREAKPOINTS UNIFICADOS)
   ------------------------------------------------------------------------- */
.mobile-bottom-bar {
    display: none;
}

@media (max-width: 900px) {
    .app-content {
        padding: 1rem 0.85rem;
        padding-bottom: 84px !important;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        height: 100dvh;
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 16px 0 50px rgba(0, 0, 0, 0.85);
    }

    .btn-close-sidebar, 
    .btn-toggle-menu {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
    }

    .breadcrumb-trail {
        display: none;
    }

    .app-header {
        padding: 0 0.85rem;
        height: 66px;
    }

    .profile-card {
        padding: 4px 10px 4px 8px;
        gap: 8px;
    }

    .profile-card .profile-name {
        font-size: 0.82rem;
        max-width: 110px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .profile-card .profile-badge {
        display: none;
    }

    .profile-avatar-wrap {
        width: 34px;
        height: 34px;
    }

    #dropdownNotificacoesAluno {
        position: fixed;
        top: 68px;
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
        z-index: 10005;
    }

    .modal-overlay {
        padding: 0.75rem;
    }

    .modal-box,
    .modal-box-large {
        width: 100%;
        max-width: 100%;
        padding: 1.25rem 1rem;
        border-radius: 14px;
    }

    /* Barra de Navegação Inferior Móvel */
    .mobile-bottom-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: rgba(17, 24, 39, 0.96);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--border-color);
        z-index: 999;
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-sizing: border-box;
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        color: var(--text-muted);
        gap: 3px;
        padding: 6px 0;
        cursor: pointer;
        touch-action: manipulation;
        transition: color 0.15s ease;
    }

    .bottom-nav-item .icon-svg {
        width: 20px;
        height: 20px;
    }

    .bottom-nav-item span {
        font-size: 0.68rem;
        font-weight: 600;
        letter-spacing: 0.2px;
    }

    .bottom-nav-item.active {
        color: var(--brand-blue);
    }
}

@media (max-width: 480px) {
    .btn-instalar-header-txt {
        display: none;
    }

    .btn-instalar-header {
        padding: 6px;
        border-radius: 8px;
    }
}