/* ============================================================
   mobile.css — Responsiviidade global · Capacitar CODEMAR
   Importar em TODOS os <head> após os demais CSS
   ============================================================ */

/* ──────────────────────────────────────────────────────────
   1. VARIÁVEIS DE BREAKPOINT
────────────────────────────────────────────────────────── */
/* xs: <480px  |  sm: 480–767px  |  md: 768–1023px */

/* ──────────────────────────────────────────────────────────
   2. NAVBAR MOBILE
────────────────────────────────────────────────────────── */

/* Hidden globally by default - only show when active in mobile */
.mobile-search-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 9999;
    background: white;
    padding: 12px 16px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.2);
    align-items: center;
    gap: 12px;
}

/* Hidden globally by default - only show when active in mobile */
.mobile-search-btn {
    display: none;
}

/* Ensure Icons use Font Awesome, not Inter */
i.fa-solid, i.fas, i.fa-brands, i.fa-regular {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands", sans-serif !important;
    font-weight: 900 !important;
}

@media (max-width: 768px) {

    /* Esconde nome/cargo no avatar — mantém só a foto */
    .user-profile .dropdown-toggle > div:first-child {
        display: none !important;
    }

    /* Search bar some da navbar — será ativada por botão */
    .navbar .search-bar {
        display: none !important;
    }

    /* Botão de busca mobile (injetado via JS) */
    .mobile-search-btn {
        display: block; /* Show on mobile */
        background: none;
        border: none;
        color: var(--text-main, #1e293b);
        font-size: 1.1rem;
        cursor: pointer;
        padding: 8px;
        border-radius: 10px;
        transition: background 0.2s;
    }

    .mobile-search-btn:hover,
    .mobile-search-btn:active {
        background: rgba(0,0,0,0.06);
    }

    .mobile-search-overlay.active {
        display: flex;
    }

    .mobile-search-overlay input {
        flex: 1;
        border: none !important;
        border-radius: 12px;
        padding: 10px 16px;
        font-size: 1rem;
        background: #f1f5f9;
        color: #1e293b;
        outline: none;
        box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
    }

    .mobile-search-overlay .close-search {
        background: #f1f5f9;
        border: none !important;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        cursor: pointer;
        color: #334155;
    }

    /* Navbar compacta */
    .navbar {
        padding: 0 14px !important;
        height: 60px !important;
        min-height: 60px !important;
    }

    .navbar-logo img,
    .tdb-logo-img {
        max-height: 40px !important;
    }

    /* Tema toggle menor */
    .theme-toggle-btn {
        margin-right: 6px !important;
        font-size: 0.9rem !important;
    }
}

/* ──────────────────────────────────────────────────────────
   3. HERO / PAGE HERO HEADER
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    .hero-section .hero-slide,
    .hero-slide {
        min-height: 260px !important;
        padding: 2rem 1.25rem !important;
    }

    .hero-content h2 {
        font-size: 1.6rem !important;
        line-height: 1.2 !important;
        white-space: normal !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        max-width: 100% !important;
    }

    .hero-content p {
        font-size: 0.9rem !important;
        white-space: normal !important;
        word-wrap: break-word !important;
    }

    .btn-hero {
        padding: 10px 20px !important;
        font-size: 0.85rem !important;
    }

    /* Page hero (catálogo, gestão etc.) */
    .page-hero-header {
        padding: 2.5rem 1.25rem 1.75rem !important;
        background-size: cover !important;
    }

    .page-hero-header h1 {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }

    .page-hero-header p {
        font-size: 0.88rem !important;
    }

    .page-hero-content {
        max-width: 100% !important;
    }
}

/* ──────────────────────────────────────────────────────────
   4. DASHBOARD / LAYOUT GERAL
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    .dashboard {
        padding: 1rem !important;
        padding-top: 0.75rem !important;
    }

    /* Category selector: scroll horizontal sem wrap */
    .cat-selector {
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px !important;
        scrollbar-width: none;
        gap: 10px !important;
    }

    .cat-selector::-webkit-scrollbar { display: none; }

    .cat-item {
        flex-shrink: 0 !important;
        min-width: 72px !important;
    }

    /* KPI cards: 2 colunas */
    .kpi-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.8rem !important;
    }

    .kpi-card {
        padding: 1rem !important;
    }

    .kpi-value {
        font-size: 1.6rem !important;
    }

    /* Section dividers menos espaço */
    .section-divider {
        margin: 1.5rem 0 !important;
    }

    /* Smart dashboard */
    .smart-dashboard {
        padding: 0 !important;
    }
}

/* ──────────────────────────────────────────────────────────
   5. TRILHAS DE CONHECIMENTO
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    .trilhas-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.6rem !important;
    }

    .trilha-card {
        height: 100px !important;
    }

    .trilha-card span {
        font-size: 0.72rem !important;
        padding: 4px 6px !important;
    }

    .trilhas-section {
        padding: 1.5rem 0 !important;
    }

    .trilhas-section h2 {
        font-size: 1.3rem !important;
    }
}

/* ──────────────────────────────────────────────────────────
   6. CARROSSEL DE CURSOS (Trending / Recomendados)
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    .trending-section {
        padding: 1.5rem 1rem !important;
        border-radius: 16px !important;
        margin-top: 1.5rem !important;
    }

    .trending-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }

    .trending-header h2 {
        font-size: 1.2rem !important;
    }

    .trending-stats {
        font-size: 0.8rem !important;
    }

    .trending-card {
        min-width: 240px !important;
        max-width: 260px !important;
    }

    .trending-carousel {
        gap: 12px !important;
        padding-bottom: 8px !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Nav buttons: menores */
    .nav-btn {
        width: 34px !important;
        height: 34px !important;
        font-size: 0.8rem !important;
    }
}

/* ──────────────────────────────────────────────────────────
   7. PARCEIROS
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    .partners-section {
        padding: 1.5rem 1rem !important;
        border-radius: 16px !important;
    }

    .partners-title {
        font-size: 1.2rem !important;
    }

    .partners-title br { display: none; }

    .partner-card {
        min-width: 150px !important;
    }
}

/* ──────────────────────────────────────────────────────────
   8. TABELAS (Gestão / Admin)
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    /* Wrapper com scroll horizontal */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
    }

    .management-table,
    table {
        min-width: 580px; /* Força scroll antes de quebrar */
        font-size: 0.8rem !important;
    }

    .management-table th,
    .management-table td {
        padding: 0.7rem 0.8rem !important;
        white-space: nowrap;
    }

    /* Esconde colunas menos críticas em telas muito pequenas */
    @media (max-width: 480px) {
        .management-table th:nth-child(4),
        .management-table td:nth-child(4) {
            display: none;
        }
    }

    /* Botões de ação menores */
    .management-table button {
        padding: 4px 8px !important;
        font-size: 0.7rem !important;
    }

    /* Performance section */
    .performance-section {
        padding: 1.25rem !important;
        border-radius: 16px !important;
    }

    /* Filtros de gestão */
    .management-controls {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .management-select {
        width: 100% !important;
    }
}

/* ──────────────────────────────────────────────────────────
   9. CATÁLOGO
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    .catalog-container {
        padding: 0.75rem !important;
    }

    /* Category grid: 2 colunas */
    .category-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.6rem !important;
    }

    .category-card {
        padding: 0.9rem 0.75rem !important;
    }

    .category-card span {
        font-size: 0.8rem !important;
    }

    /* Course grid: 2 colunas em sm, 1 em xs */
    .course-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    @media (max-width: 480px) {
        .course-grid {
            grid-template-columns: 1fr !important;
        }
    }

    /* Sidebar de filtros: menos invasiva e mais contrastada */
    .catalog-sidebar {
        width: 270px !important;
        background: rgba(10, 18, 35, 0.98) !important; /* Mais opaco para leitura */
        box-shadow: 10px 0 30px rgba(0,0,0,0.5) !important;
        padding: 24px 20px !important;
    }

    .sidebar-title {
        color: #fff !important;
        font-size: 1.1rem !important;
        margin-bottom: 2rem !important;
    }

    .filter-label {
        color: rgba(255,255,255,0.9) !important;
        font-size: 0.85rem !important;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .filter-option label {
        color: #cbd5e1 !important;
        font-size: 0.9rem !important;
    }

    .filter-option:hover {
        background: rgba(255,255,255,0.1) !important;
    }

    .sidebar-overlay {
        background: rgba(0,0,0,0.7) !important;
    }

    .course-card {
        border-radius: 14px !important;
    }

    .course-thumbnail {
        height: 110px !important;
    }
}

/* ──────────────────────────────────────────────────────────
   10. BANCO DE TALENTOS
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    .talent-profile-header {
        flex-direction: column !important;
        text-align: center !important;
        gap: 1rem !important;
    }

    .talent-stats-grid,
    .talent-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.75rem !important;
    }

    @media (max-width: 480px) {
        .talent-grid {
            grid-template-columns: 1fr !important;
        }
    }

    /* Sidebar de filtros de talentos */
    .talent-sidebar {
        width: 100% !important;
        position: static !important;
    }
}

/* ──────────────────────────────────────────────────────────
   11. MEUS CURSOS / STUDENT DASHBOARD
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    .my-courses-grid,
    .courses-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    .progress-container-table {
        min-width: 80px;
    }

    .student-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ──────────────────────────────────────────────────────────
   12. FOOTER
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    .footer-container {
        flex-direction: column !important;
        gap: 1.5rem !important;
        padding: 1.5rem 1.25rem !important;
    }

    .footer-column {
        width: 100% !important;
    }

    .footer-logos {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    .assinatura {
        max-width: 200px !important;
    }

    .footer-bottom {
        flex-direction: column !important;
        gap: 8px !important;
        text-align: center !important;
        padding: 1rem !important;
    }

    .footer-qrcode {
        display: none !important; /* Esconde QR code em mobile */
    }
}

/* ──────────────────────────────────────────────────────────
   13. NPDC / ACERVO
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    .npdc-grid,
    .article-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    .npdc-card,
    .article-card {
        border-radius: 14px !important;
    }
}

/* ──────────────────────────────────────────────────────────
   14. MATERIAIS
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    .materiais-layout,
    .materials-layout {
        flex-direction: column !important;
    }

    .materiais-sidebar,
    .materials-sidebar {
        width: 100% !important;
        position: static !important;
        border-radius: 12px !important;
    }

    .materiais-content,
    .materials-content {
        padding: 0 !important;
    }
}

/* ──────────────────────────────────────────────────────────
   15. MODAIS
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    .premium-modal-container,
    .modal-container {
        width: 95vw !important;
        max-width: 95vw !important;
        margin: 1rem !important;
        padding: 1.25rem !important;
        max-height: 85vh !important;
        overflow-y: auto !important;
        border-radius: 20px !important;
    }

    .partner-summary-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ──────────────────────────────────────────────────────────
   16. NPDC HUB (homepage)
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    .npdc-hub-section {
        padding: 1.5rem 1rem !important;
        margin-top: 1.5rem !important;
    }

    .npdc-hub-section h2 {
        font-size: 1.3rem !important;
    }
}

/* ──────────────────────────────────────────────────────────
   17. MELHORIAS GERAIS DE TOQUE
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    /* Todos os botões têm mínimo de área de toque (48px) */
    button,
    .btn-hero,
    .btn-all-courses,
    .btn-acervo,
    .nav-btn,
    .carousel-arrow {
        min-height: 44px;
        touch-action: manipulation;
    }

    /* Links de menu e cards clicáveis */
    a, .cat-item, .trilha-card, .partner-card, .course-card {
        -webkit-tap-highlight-color: transparent;
    }

    /* Evita zoom acidental em inputs */
    input, select, textarea {
        font-size: 16px !important; /* iOS zoom prevention */
    }

    /* Scroll suave nativo */
    * {
        -webkit-overflow-scrolling: touch;
    }
}

/* ──────────────────────────────────────────────────────────
   18. BACK TO TOP — REPOSICIONADO EM MOBILE
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .back-to-top-wrapper {
        bottom: 16px !important;
        right: 16px !important;
    }
}

/* ──────────────────────────────────────────────────────────
   19. ADMIN PAGES
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    /* Admin analytics / reports */
    .admin-grid,
    .analytics-grid,
    .report-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    /* Charts container */
    canvas {
        max-width: 100% !important;
        height: auto !important;
    }

    .chart-container {
        overflow-x: auto !important;
    }

    /* Admin cards */
    .admin-card {
        padding: 1rem !important;
        border-radius: 14px !important;
    }

    /* Approval cards */
    .approval-card {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    /* User cards */
    .user-cell {
        gap: 8px !important;
    }

    .user-cell img {
        width: 32px !important;
        height: 32px !important;
    }
}

/* ──────────────────────────────────────────────────────────
   20. PERFIL / TALENTS USER VIEW
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    .profile-header,
    .talent-profile-card {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        padding: 1.25rem !important;
    }

    .profile-avatar-large,
    .talent-avatar {
        width: 80px !important;
        height: 80px !important;
    }

    .skills-radar-container {
        max-width: 280px !important;
        margin: 0 auto !important;
    }

    /* Command Center (dropdown) */
    .command-center-overlay.manual-show {
        width: 92vw !important;
        max-width: 360px !important;
        right: 4vw !important;
        left: auto !important;
    }
}

/* ──────────────────────────────────────────────────────────
   21. LOGIN / AUTH PAGES
────────────────────────────────────────────────────────── */
@media (max-width: 480px) {

    .auth-card,
    .login-card,
    .register-card {
        padding: 1.5rem 1.25rem !important;
        margin: 0.75rem !important;
        border-radius: 20px !important;
    }

    .auth-logo {
        max-height: 50px !important;
    }
}

/* ──────────────────────────────────────────────────────────
   22. MOTIVATIONAL BANNER
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    .motivational-banner {
        flex-direction: column !important;
        text-align: center !important;
        padding: 1.25rem !important;
        gap: 0.75rem !important;
    }

    .motivational-banner .banner-icon {
        font-size: 2rem !important;
    }
}

/* ──────────────────────────────────────────────────────────
   23. CURSO MATERIAL / DETALHES
────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    .course-detail-layout,
    .curso-layout {
        flex-direction: column !important;
    }

    .course-sidebar,
    .curso-sidebar {
        width: 100% !important;
        position: static !important;
        order: -1; /* Volta para o topo em mobile */
    }

    .course-content-main {
        padding: 0 !important;
    }

    .video-container iframe,
    .video-embed {
        height: 200px !important;
    }
}
