/*
 * Ajustes da AME Academy sobre o Color Admin v6 (carregado depois do app.min.css).
 * Manter pequeno: só o que não existe como utility do template/Bootstrap.
 */

/* Logo nas telas de autenticação */
.auth-logo {
    max-width: 220px;
    width: 60%;
    height: auto;
}

/* Header: logo horizontal AME Academy (ame-academy-logo.png, 929x160, fundo transparente) */
.app-header .brand .brand-logo .ame-brand-img {
    height: 36px;
    width: auto;
    max-height: none;
    max-width: 100%;
}
/* O template esconde .brand-logo abaixo de 992px; na AME a marca aparece também no mobile */
@media (max-width: 991.98px) {
    /* no template o .brand não é flex: botão de menu e logo empilhariam */
    .app-header .brand {
        display: flex;
        align-items: center;
        padding-block: 0;
    }
    .app-header .brand .brand-logo {
        display: flex;
        width: auto;
        padding: 0 .5rem;
    }
    .app-header .brand .brand-logo .ame-brand-img {
        height: 30px;
    }
}

/* Busca do header no celular (dropdown aberto pela lupa) */
.ame-search-dropdown {
    width: min(92vw, 360px);
}

/* Avatar com a inicial do usuário (header e sidebar) */
.ame-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bs-app-theme);
    color: var(--bs-app-theme-color, #fff);
    font-weight: 700;
    font-size: .85rem;
    line-height: 1;
}
.ame-avatar-lg {
    width: 100%;
    height: 100%;
    font-size: 1.25rem;
}

/* Cards com capa (coleções / livros) */
.ame-cover {
    display: block;
    aspect-ratio: 3 / 4;
    background: var(--bs-tertiary-bg);
    overflow: hidden;
}
.ame-cover img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform .2s ease;
}
.ame-cover-card:hover .ame-cover img {
    transform: scale(1.03);
}
.ame-line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ame-modal-cover {
    max-height: 60vh;
    object-fit: contain;
}
.ame-book-action {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Botão da tutora Amy (cor laranja da marca) */
.ame-btn-amy {
    --bs-btn-color: #fff;
    --bs-btn-bg: #f78a4f;
    --bs-btn-border-color: #f78a4f;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #e67a3f;
    --bs-btn-hover-border-color: #e67a3f;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #d86d34;
    --bs-btn-active-border-color: #d86d34;
}

/* Utilitários */
.ame-flex-min {
    min-width: 0;
}
.ame-dropdown-scroll {
    max-height: 60vh;
    overflow-y: auto;
    min-width: 280px;
    max-width: min(92vw, 420px);
}

/* Leitor de livro (/book) */
.ame-reader #book_doc {
    display: block;
    width: 100%;
    height: calc(100vh - 250px);
    min-height: 480px;
    border: 0;
}
.ame-reader-current {
    flex: 1 1 auto;
    min-width: 0;
}
@media (max-width: 767.98px) {
    .ame-reader-current {
        order: 99;
        flex-basis: 100%;
    }
    .ame-reader #book_doc {
        height: calc(100vh - 280px);
        min-height: 420px;
    }
}
.ame-reader:fullscreen,
.ame-reader:-webkit-full-screen {
    display: flex;
    flex-direction: column;
    border-radius: 0;
}
.ame-reader:fullscreen .card-body,
.ame-reader:-webkit-full-screen .card-body {
    flex: 1 1 auto;
    min-height: 0;
}
.ame-reader:fullscreen #book_doc,
.ame-reader:-webkit-full-screen #book_doc {
    height: 100%;
    min-height: 0;
}

/* Videoaulas (/lesson) */
.ame-lesson-list {
    max-height: calc(100vh - 260px);
    overflow-y: auto;
}
@media (max-width: 1199.98px) {
    .ame-lesson-list {
        max-height: none;
    }
}
.ame-lesson-num {
    flex: 0 0 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    background: var(--bs-tertiary-bg);
}
/* item ativo na cor do tema (o padrão do Bootstrap é azul) */
.ame-lesson-list .list-group-item.active,
.ame-dropdown-scroll .dropdown-item.active,
.ame-dropdown-scroll .dropdown-item:active {
    background-color: var(--bs-app-theme);
    border-color: var(--bs-app-theme);
    color: var(--bs-app-theme-color, #fff);
}
.ame-dropdown-scroll .dropdown-item.active .text-body,
.ame-dropdown-scroll .dropdown-item.active .text-success {
    color: inherit !important;
}
.ame-lesson-list .list-group-item.active .ame-lesson-num {
    background: rgba(255, 255, 255, .25);
}

/* Player de áudio (podcast / audiobook) — IDs/classes usados por js/student/media-player.js */
.ame-range {
    accent-color: var(--bs-app-theme);
    cursor: pointer;
}
.ame-mp-cover {
    position: relative;
    aspect-ratio: 1 / 1;
    max-height: 360px;
    background: var(--bs-tertiary-bg);
    overflow: hidden;
}
.ame-mp-cover img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.ame-mp-cover-play {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 1.25rem;
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .25);
    opacity: .95;
}
.ame-mp-play {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    font-size: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ame-mp-volume {
    max-width: 180px;
}
.ame-mp-list {
    max-height: calc(100vh - 240px);
    overflow-y: auto;
}
@media (max-width: 991.98px) {
    .ame-mp-list {
        max-height: none;
    }
}
.ame-mp-thumb {
    width: 48px;
    height: 48px;
    border-radius: .5rem;
    object-fit: cover;
    flex: 0 0 48px;
    background: var(--bs-tertiary-bg);
}
.ame-mp-sub {
    opacity: .6;
}
.mp-track .ame-mp-done,
.mp-track .ame-mp-now {
    display: none;
}
.mp-track.mp-track-done:not(.mp-track-active) .ame-mp-done {
    display: inline-block;
}
.mp-track.mp-track-active {
    background-color: var(--bs-app-theme);
    border-color: var(--bs-app-theme);
    color: var(--bs-app-theme-color, #fff);
}
.mp-track.mp-track-active .ame-mp-now {
    display: inline-block;
}
.ame-mp.mp-playing .ame-mp-cover img {
    transform: scale(1.02);
    transition: transform .4s ease;
}

/* Audiobook: número da unidade no lugar da miniatura */
.ame-mp-thumb-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--bs-app-theme);
    background: rgba(var(--bs-app-theme-rgb), .12);
}
.mp-track.mp-track-active .ame-mp-thumb-num {
    color: #fff;
    background: rgba(255, 255, 255, .25);
}

/* FlashCards — IDs/classes usados por js/flashcard-player.js */
.ame-fc-stage {
    position: relative;
    aspect-ratio: 4 / 3;
    max-height: 60vh;
    background: var(--bs-tertiary-bg);
    user-select: none;
}
.ame-fc-stage img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.ame-fc-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .15);
}
.ame-fc-nav-prev { left: .75rem; }
.ame-fc-nav-next { right: .75rem; }
.ame-fc-nav:disabled { opacity: .35; }
.ame-fc-text {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 700;
    line-height: 1.2;
}
.ame-fc-listen.fc-playing {
    animation: ame-pulse 1s ease-in-out infinite;
}
.ame-fc-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.fc-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--bs-border-color);
    cursor: pointer;
    transition: transform .15s ease, background .15s ease;
}
.fc-dot:hover { transform: scale(1.3); }
.fc-dot.fc-dot-active {
    background: var(--bs-app-theme);
    transform: scale(1.3);
}
.fc-list-item .ame-fc-done { display: none; }
.fc-list-item.fc-list-item-done:not(.fc-list-item-active) .ame-fc-done { display: inline-block; }
.fc-list-item.fc-list-item-active {
    background-color: var(--bs-app-theme);
    border-color: var(--bs-app-theme);
    color: var(--bs-app-theme-color, #fff);
}

/* Questionários (Practice 1 / 2) */
.ame-quiz-question.is-missing {
    border-left: 3px solid var(--bs-warning);
    padding-left: .75rem;
}
.ame-quiz-option {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    margin: 0;
    padding: .85rem 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    background: var(--bs-body-bg);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.ame-quiz-option .form-check-input {
    flex-shrink: 0;
    margin-top: .2rem;
}
.ame-quiz-option > span p:last-child { margin-bottom: 0; }
.ame-quiz-option:hover:not(.is-readonly) {
    border-color: rgba(var(--bs-app-theme-rgb), .6);
}
.ame-quiz-option.is-checked {
    border-color: var(--bs-app-theme);
    background: rgba(var(--bs-app-theme-rgb), .08);
}
.ame-quiz-option.is-readonly { cursor: default; }
.ame-quiz-option.is-correct {
    border-color: var(--bs-success);
    background: rgba(var(--bs-success-rgb), .1);
    font-weight: 600;
}
.ame-quiz-option.is-wrong {
    border-color: var(--bs-danger);
    background: rgba(var(--bs-danger-rgb), .08);
    font-weight: 600;
}

/* Practice 2: mídia da questão */
.ame-p2-media {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    border-radius: .5rem;
    background: var(--bs-tertiary-bg);
    overflow: hidden;
}
.ame-p2-media video,
.ame-p2-media img {
    display: block;
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    background: #000;
}
.ame-p2-media img { background: transparent; }
.ame-p2-media audio {
    width: calc(100% - 2rem);
    margin: 1rem;
}

/* Exercícios de fluência (vocab) */
.ame-vocab-phrase {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    line-height: 1.2;
}
.ame-rec-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bs-danger);
    margin-right: .25rem;
    animation: ame-pulse 1s ease-in-out infinite;
}
@keyframes ame-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .45; }
}

/* Chat com a Amy (/chats) — IDs/classes usados por js/student/chat.js */
.ame-chat {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 230px);
    min-height: 460px;
}
.ame-chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.ame-chat-avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 50%;
    object-fit: cover;
}
.ame-chat-row {
    display: flex;
    align-items: flex-end;
    gap: .6rem;
    max-width: 85%;
}
.ame-chat-row.is-student {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.ame-chat-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.ame-chat-row.is-student .ame-chat-col { align-items: flex-end; }
.ame-chat-bubble {
    padding: .6rem .9rem;
    border-radius: 1rem;
    background: var(--bs-tertiary-bg);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.ame-chat-row.is-amy .ame-chat-bubble { border-bottom-left-radius: .25rem; }
.ame-chat-row.is-student .ame-chat-bubble {
    background: var(--bs-app-theme);
    color: var(--bs-app-theme-color, #fff);
    border-bottom-right-radius: .25rem;
}
.ame-chat-name {
    font-size: .75rem;
    font-weight: 700;
    margin-bottom: .15rem;
    opacity: .8;
}
.ame-chat-time {
    font-weight: 400;
    opacity: .7;
    margin-left: .25rem;
}
.ame-chat-translation {
    margin-top: .35rem;
    padding-top: .35rem;
    border-top: 1px dashed var(--bs-border-color);
    font-size: .85rem;
    opacity: .75;
}
.ame-chat-actions {
    display: flex;
    gap: .15rem;
    opacity: .7;
}
.ame-chat-empty {
    margin: auto;
    text-align: center;
    color: rgba(var(--bs-body-color-rgb), .5);
}
.ame-recording {
    animation: ame-pulse 1s ease-in-out infinite;
}
.ame-chat:fullscreen,
.ame-chat.chat-is-fullscreen {
    height: 100vh;
    border-radius: 0;
}
@media (max-width: 767.98px) {
    .ame-chat { height: calc(100vh - 170px); }
    .ame-chat-row { max-width: 95%; }
}
@media (max-width: 575.98px) {
    /* botões do cabeçalho do chat numa linha própria */
    .ame-chat > .card-header > .btn-group {
        width: 100%;
    }
    .ame-chat > .card-header > .btn-group > .btn {
        flex: 1 1 0;
    }
}

/* Meu perfil */
.ame-profile-cover {
    height: 80px;
    background: linear-gradient(135deg, var(--bs-app-theme), rgba(var(--bs-app-theme-rgb), .55));
}
.ame-profile-avatar {
    width: 84px;
    height: 84px;
    font-size: 2rem;
    margin-top: -42px;
    border: 4px solid var(--bs-body-bg);
}

/* Jogos — trilha de atividades (/game/{livro}) */
.ame-trail-step {
    display: flex;
    gap: .75rem;
    position: relative;
}
.ame-trail-step::before {
    content: "";
    position: absolute;
    left: 17px;
    top: 40px;
    bottom: 0;
    width: 2px;
    background: var(--bs-border-color);
}
.ame-trail-step:last-child::before { display: none; }
.ame-trail-marker {
    flex: 0 0 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    background: var(--bs-body-bg);
    border: 2px solid var(--bs-app-theme);
    color: var(--bs-app-theme);
    z-index: 1;
}
.ame-trail-step.is-complete .ame-trail-marker {
    background: var(--bs-success);
    border-color: var(--bs-success);
    color: #fff;
}
.ame-activity-locked { opacity: .6; }

/* Jogos — área do motor (CSS isolado em games-web/styles.scoped.css) */
#content .ame-game-scope {
    min-height: 0;
    border-radius: 0;
}
/* ícone MDI usado pela tela de conclusão do ametech-runtime.js (MDI não é carregado no layout novo) */
.completion-overlay .mdi.mdi-check::before {
    font-family: "Font Awesome 7 Free", "Font Awesome 6 Free", sans-serif;
    font-weight: 900;
    font-style: normal;
    content: "\f00c";
}

/* Momento Tech */
.ame-line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ame-mt-card {
    border-top: 4px solid var(--bs-app-theme);
    transition: transform .15s ease, box-shadow .15s ease;
}
.ame-mt-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 .75rem 1.5rem rgba(0, 0, 0, .08);
}
.ame-mt-accent-1 { border-top-color: var(--bs-orange); }
.ame-mt-accent-2 { border-top-color: var(--bs-purple); }
.ame-mt-accent-3 { border-top-color: var(--bs-green); }
.ame-mt-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #f59e0b;
    background: rgba(245, 158, 11, .15);
}
.ame-mt-hero-img {
    width: 150px;
    max-width: 40%;
    height: auto;
}
.ame-mt-speech {
    position: relative;
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    background: #fffaf0;
    border: 1px solid #fed7aa;
    color: #1f2937;
}
.ame-mt-details {
    white-space: normal;
    line-height: 1.7;
}
/* editor Blockly (CSS isolado em momento-tech/style.scoped.css)
   #content eleva a especificidade: o style.scoped.css é carregado depois deste arquivo */
#content .ame-mt-scope.play-page {
    min-height: 0;
    border-radius: .75rem;
    overflow: hidden;
    padding: .5rem;
}
#content .ame-mt-scope.play-page .layout {
    height: calc(100vh - 190px);
    min-height: 560px;
    padding: 0;
}
/* barra do palco: botões quebram linha em telas estreitas (antes ultrapassavam a borda) */
#content .ame-mt-scope.play-page .stage-toolbar,
#content .ame-mt-scope.play-page .stage-toolbar-left,
#content .ame-mt-scope.play-page .stage-toolbar-right {
    flex-wrap: wrap;
}
@media (max-width: 991.98px) {
    #content .ame-mt-scope.play-page .layout {
        height: auto;
    }
    #content .ame-mt-scope.play-page #blocklyDiv {
        min-height: 60vh;
    }
}

/* DataTables: página atual na cor do tema (o padrão do Bootstrap é azul) */
.dt-container .pagination .page-item.active .page-link,
.dt-container .dt-paging .dt-paging-button.current {
    background-color: var(--bs-app-theme);
    border-color: var(--bs-app-theme);
    color: var(--bs-app-theme-color, #fff);
}

/* Configurações: cards da visão geral (/config) */
.ame-config-card {
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.ame-config-card:hover {
    transform: translateY(-2px);
    border-color: var(--bs-app-theme);
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .06);
}
.ame-config-icon {
    flex: 0 0 42px;
    height: 42px;
    border-radius: .6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--bs-app-theme);
    background: rgba(var(--bs-app-theme-rgb), .12);
}

/* DataTables: miniatura (capa/imagem) montada pelo servidor */
.ame-dt-thumb { width: 64px; }
.ame-dt-thumb img {
    width: 48px !important;
    max-height: 64px;
    object-fit: cover;
    border-radius: .35rem;
}

/* Política de privacidade: leitura confortável */
.policy-text p {
    text-align: justify;
    hyphens: auto;
    line-height: 1.7;
}
.policy-text h3 {
    scroll-margin-top: 1rem;
}

/* DataTables: player de áudio montado pelo servidor (podcast/audiobook) */
.ame-dt-audio audio { width: 220px; max-width: 100%; height: 36px; display: block; }

/* DataTables: mídia variada (áudio/vídeo/imagem) montada pelo servidor */
.ame-dt-media img { width: 64px !important; max-height: 64px; object-fit: cover; border-radius: .35rem; padding: 0 !important; }
.ame-dt-media video { width: 200px; max-width: 100% !important; max-height: 120px !important; border-radius: .35rem; display: block; }
.ame-dt-media audio { width: 220px; max-width: 100%; height: 36px; display: block; }

/* Summernote lite dentro de modal do Color Admin */
.modal .note-editor.note-frame { border-color: var(--bs-border-color); border-radius: .375rem; }
.modal .note-editor .note-toolbar { background: var(--bs-light); border-radius: .375rem .375rem 0 0; }

/* Fórum de dúvidas (/forum/{livro}) — conversa no widget-chat do kit */
.ame-forum-topics { max-height: calc(100vh - 300px); min-height: 200px; overflow-y: auto; }
.ame-forum-messages { max-height: calc(100vh - 360px); min-height: 280px; overflow-y: auto; }
.ame-forum-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--bs-gray-500); color: #fff; font-weight: 700;
}
.ame-forum-avatar.is-teacher { background: var(--bs-app-theme); }
.widget-chat-message.ame-forum-teacher { box-shadow: inset 3px 0 0 var(--bs-app-theme); }
.ame-forum-topics .list-group-item.active { background: var(--bs-app-theme); border-color: var(--bs-app-theme); color: #fff; }
@media (max-width: 991.98px) {
    .ame-forum-topics { max-height: 260px; }
    .ame-forum-messages { max-height: 60vh; }
}

/* /config/phpinfo — saída do phpinfo() (tabelas .e/.v/.h do PHP) no padrão do tema */
.ame-phpinfo { overflow-x: auto; }
.ame-phpinfo .center { text-align: left; }
.ame-phpinfo h1 { font-size: 1.25rem; font-weight: 700; margin: 0; }
.ame-phpinfo h2 { font-size: 1rem; font-weight: 700; margin: 1.5rem 0 .5rem; color: var(--bs-app-theme); }
.ame-phpinfo h2 a { color: inherit; text-decoration: none; }
.ame-phpinfo table { width: 100%; max-width: 100%; margin-bottom: 1rem; border-collapse: collapse; table-layout: fixed; font-size: .8125rem; }
.ame-phpinfo td, .ame-phpinfo th { padding: .4rem .6rem; border: 1px solid var(--bs-border-color); vertical-align: top; overflow-wrap: anywhere; }
.ame-phpinfo .e { width: 32%; font-weight: 600; background: var(--bs-light); }
.ame-phpinfo .h, .ame-phpinfo .h th { background: var(--bs-gray-800); color: #fff; }
.ame-phpinfo .h td { border-color: var(--bs-gray-800); }
.ame-phpinfo .h img { float: right; max-height: 48px; }
.ame-phpinfo .v i { color: var(--bs-gray-500); }
.ame-phpinfo hr { display: none; }
@media (max-width: 575.98px) {
    .ame-phpinfo .e { width: 42%; }
}
