/* 
 * CSS Mobile para Área do Aluno
 * Agrupa todas as regras responsivas para dispositivos móveis
 * 
 * Breakpoints:
 * - max-width: 576px (mobile small)
 * - max-width: 768px (mobile/tablet)
 * - max-width: 1024px (tablet)
 */

/* ============================================
   MOBILE GENÉRICO (até 768px)
   ============================================ */
@media (max-width: 768px) {
    /* Tipografia geral */
    body {
        font-size: 14px;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1.1rem;
    }

    h5 {
        font-size: 1rem;
    }

    /* Cards */
    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .card-body.p-4 {
        padding: 0.75rem !important;
    }

    .card-header {
        padding: 0.75rem 1rem;
    }

    /* Reduzir espaçamento entre cards de estatísticas */
    .row .col-6.mb-3 {
        margin-bottom: 0.5rem !important;
    }

    /* Cards de estatísticas mais compactos */
    .card-body.p-4.text-center {
        padding: 0.5rem !important;
    }

    .card-body.p-4.text-center h3 {
        font-size: 1.1rem !important;
        margin-bottom: 0.25rem !important;
    }

    .card-body.p-4.text-center p {
        font-size: 0.8rem !important;
        margin-bottom: 0 !important;
    }

    .card-body.p-4.text-center .fa-2x {
        font-size: 1.5em !important;
        margin-bottom: 0.25rem !important;
    }

    /* Botões */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .btn-lg {
        padding: 0.6rem 1.2rem;
        font-size: 1rem;
    }

    /* Badges */
    .badge {
        font-size: 0.75rem;
        padding: 0.35rem 0.65rem;
    }

    /* Tabelas */
    .table {
        font-size: 0.85rem;
    }

    .table-responsive {
        border-radius: 8px;
    }

    /* Ícones */
    .fa-2x {
        font-size: 1.5em !important;
    }

    .fa-3x {
        font-size: 2em !important;
    }

    .fa-4x {
        font-size: 2.5em !important;
    }

    .fa-5x {
        font-size: 3em !important;
    }

    /* Sidebar */
    .sidebar-header {
        padding: 1rem;
    }

    .sidebar-nav .nav-link {
        padding: 0.75rem 0.75rem !important;
        font-size: 0.9rem;
    }

    .sidebar-nav .nav-link i {
        font-size: 1rem;
    }

    /* Topbar */
    .topbar {
        padding: 0;
        height: auto;
        min-height: 50px;
        overflow: visible !important;
    }

    .topbar-content {
        padding: 0.5rem 0.75rem !important;
        display: flex !important;
        align-items: center !important;
    }

    .topbar-left {
        gap: 0.5rem;
    }

    .topbar-right {
        gap: 0.5rem;
    }

    .breadcrumb {
        font-size: 0.9rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 200px;
    }

    .user-menu {
        gap: 0.5rem;
        padding: 0.25rem !important;
        flex-shrink: 0;
    }

    .user-info {
        display: none !important; /* Esconde texto do usuário em mobile */
    }

    .dropdown {
        position: relative !important;
        z-index: 1050 !important;
    }

    .dropdown-toggle {
        pointer-events: auto !important;
        cursor: pointer !important;
    }

    .dropdown-menu {
        z-index: 1051 !important;
    }

    .dropdown-menu.show {
        display: block !important;
        z-index: 1051 !important;
    }

    .user-name {
        font-size: 0.85rem;
    }

    .user-role {
        font-size: 0.75rem;
    }

    /* Containers */
    .container-fluid {
        padding: 0.75rem;
    }

    /* Alertas */
    .alert {
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
    }

    /* Modais */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 0.75rem 1rem;
    }

    /* Formulários */
    .form-control {
        font-size: 16px; /* Previne zoom no iOS */
        padding: 0.75rem;
    }

    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    /* Grid system */
    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    .row > * {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    /* Espaçamentos */
    .mb-4 {
        margin-bottom: 1rem !important;
    }

    .mb-5 {
        margin-bottom: 1.5rem !important;
    }

    .pt-4 {
        padding-top: 1rem !important;
    }

    .pb-4 {
        padding-bottom: 1rem !important;
    }

    /* Jumbotron */
    .jumbotron {
        padding: 2rem 1rem;
    }

    .jumbotron h1 {
        font-size: 1.75rem;
    }
}

/* ============================================
   MOBILE PEQUENO (até 576px)
   ============================================ */
@media (max-width: 576px) {
    /* Tipografia ainda menor */
    body {
        font-size: 13px;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    h4 {
        font-size: 1rem;
    }

    h5 {
        font-size: 0.95rem;
    }

    /* Cards mais compactos */
    .card-body {
        padding: 0.75rem;
    }

    /* Cards de estatísticas ainda mais compactos */
    .card-body.p-4.text-center {
        padding: 0.4rem !important;
    }

    .card-body.p-4.text-center h3 {
        font-size: 1rem !important;
        margin-bottom: 0.2rem !important;
    }

    .card-body.p-4.text-center p {
        font-size: 0.75rem !important;
        margin-bottom: 0 !important;
    }

    .card-body.p-4.text-center .fa-2x {
        font-size: 1.3em !important;
        margin-bottom: 0.2rem !important;
    }

    /* Reduzir ainda mais o espaçamento entre cards */
    .row .col-6.mb-3 {
        margin-bottom: 0.4rem !important;
    }

    /* Botões menores */
    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    /* Badges menores */
    .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }

    /* Tabelas */
    .table {
        font-size: 0.8rem;
    }

    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
    }

    /* Ícones menores */
    .fa-2x {
        font-size: 1.3em !important;
    }

    .fa-3x {
        font-size: 1.8em !important;
    }

    .fa-4x {
        font-size: 2.2em !important;
    }

    /* Sidebar */
    .sidebar {
        width: 100%;
    }

    .sidebar-header {
        padding: 0.75rem;
    }

    .brand-logo {
        font-size: 2rem;
    }

    .logo-img {
        max-width: 120px;
        max-height: 120px;
    }

    /* Topbar - Duplicado removido, já está no @media (max-width: 768px) */
    .topbar {
        min-height: 45px;
    }

    .topbar-content {
        padding: 0.25rem 0.5rem !important;
        display: flex !important;
        align-items: center !important;
    }

    .breadcrumb {
        font-size: 0.85rem;
    }

    .user-avatar {
        width: 28px;
        height: 28px;
    }

    .user-avatar img {
        width: 28px !important;
        height: 28px !important;
    }

    /* Containers */
    .container-fluid {
        padding: 0.5rem;
    }

    /* Modais */
    .modal-dialog {
        margin: 0.25rem;
    }

    .modal-header {
        padding: 0.75rem;
    }

    .modal-body {
        padding: 0.75rem;
    }

    .modal-title {
        font-size: 1.1rem;
    }

    /* Grid columns */
    .col-lg-8,
    .col-lg-4,
    .col-md-6,
    .col-md-4 {
        margin-bottom: 1rem;
    }

    /* Espaçamentos menores */
    .mb-4 {
        margin-bottom: 0.75rem !important;
    }

    .mb-5 {
        margin-bottom: 1rem !important;
    }

    .p-4 {
        padding: 0.75rem !important;
    }

    .p-5 {
        padding: 1.5rem !important;
    }
}

/* ============================================
   COMPONENTES ESPECÍFICOS - CRONOGRAMA
   ============================================ */
@media (max-width: 768px) {
    .calendar-day {
        min-height: 100px !important;
        padding: 8px 4px !important;
    }

    .day-number {
        font-size: 14px !important;
    }

    .discipline-name {
        font-size: 9px !important;
    }

    .simulado-badge,
    .questoes-badge,
    .revisao-badge {
        font-size: 9px !important;
        padding: 3px 5px !important;
    }

    .discipline-item {
        padding: 4px 6px !important;
        font-size: 10px !important;
    }
}

@media (max-width: 576px) {
    .calendar-day {
        min-height: 80px !important;
        padding: 6px 2px !important;
    }

    .day-number {
        font-size: 12px !important;
    }

    .discipline-name {
        font-size: 8px !important;
    }

    .day-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .day-actions {
        align-self: flex-end;
    }

    .calendar-header .col {
        font-size: 0.8rem !important;
        padding: 8px 4px !important;
    }
}

/* ============================================
   COMPONENTES ESPECÍFICOS - PERFIL PÚBLICO
   ============================================ */
@media (max-width: 768px) {
    /* Header do perfil */
    .perfil-header img,
    .perfil-header .avatar-placeholder {
        width: 80px !important;
        height: 80px !important;
    }

    /* Estatísticas */
    .perfil-stats h3 {
        font-size: 1.5rem;
    }

    .perfil-stats h4 {
        font-size: 1.25rem;
    }

    .perfil-stats .fa-3x {
        font-size: 2em !important;
    }

    /* Tabela de ranking */
    .table thead th {
        font-size: 0.8rem !important;
        padding: 0.5rem 0.25rem !important;
    }

    .table tbody td {
        font-size: 0.85rem !important;
        padding: 0.5rem 0.25rem !important;
    }

    .posicao-ranking .fa-lg {
        font-size: 1.2em !important;
    }

    /* Avatar nos rankings */
    .avatar-placeholder-small {
        width: 30px !important;
        height: 30px !important;
    }

    .avatar-placeholder-small img {
        width: 30px !important;
        height: 30px !important;
    }
}

@media (max-width: 576px) {
    /* Header do perfil */
    .perfil-header img,
    .perfil-header .avatar-placeholder {
        width: 60px !important;
        height: 60px !important;
    }

    /* Estatísticas */
    .perfil-stats h3 {
        font-size: 1.25rem;
    }

    .perfil-stats h4 {
        font-size: 1rem;
    }

    .perfil-stats .fa-3x {
        font-size: 1.8em !important;
    }

    .perfil-stats .fa-2x {
        font-size: 1.3em !important;
    }

    /* Colunas em stack */
    .col-lg-8,
    .col-lg-4 {
        width: 100%;
    }

    /* Tabela de ranking ainda mais compacta */
    .table thead th {
        font-size: 0.75rem !important;
        padding: 0.4rem 0.2rem !important;
    }

    .table tbody td {
        font-size: 0.8rem !important;
        padding: 0.4rem 0.2rem !important;
    }
}

/* ============================================
   COMPONENTES ESPECÍFICOS - DASHBOARD
   ============================================ */
@media (max-width: 768px) {
    /* Info boxes */
    .info-box-icon {
        width: 50px !important;
        height: 50px !important;
        font-size: 20px !important;
    }

    .info-box-text {
        font-size: 0.85rem !important;
    }

    .info-box-number {
        font-size: 1.25rem !important;
    }

    /* Cards de resumo */
    .stat-box {
        padding: 1rem !important;
    }

    .stat-box .fa-2x {
        font-size: 1.5em !important;
    }

    /* Tabelas de cronograma semanal */
    .dia-clickable td {
        padding: 0.75rem 0.5rem !important;
    }
}

@media (max-width: 576px) {
    /* Info boxes */
    .info-box-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 18px !important;
    }

    .info-box-text {
        font-size: 0.8rem !important;
    }

    .info-box-number {
        font-size: 1.1rem !important;
    }

    /* Cards de resumo */
    .stat-box {
        padding: 0.75rem !important;
    }

    .stat-box h4 {
        font-size: 1.25rem !important;
    }

    /* Tabelas ocultar algumas colunas */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ============================================
   COMPONENTES ESPECÍFICOS - QUESTÕES
   ============================================ */
@media (max-width: 768px) {
    /* Enunciado da questão */
    .questao-enunciado {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    /* Alternativas */
    .alternativa-item {
        padding: 1rem !important;
        margin-bottom: 0.75rem !important;
    }

    .alternativa-letra {
        width: 32px !important;
        height: 32px !important;
        font-size: 1rem !important;
    }

    /* Barra de progresso */
    .progress-bar {
        height: 24px !important;
    }

    /* Botões de ação */
    .btn-group .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    /* Enunciado da questão */
    .questao-enunciado {
        font-size: 0.95rem;
    }

    /* Alternativas */
    .alternativa-item {
        padding: 0.75rem !important;
        margin-bottom: 0.5rem !important;
    }

    .alternativa-letra {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.9rem !important;
    }

    /* Botões */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* ============================================
   COMPONENTES ESPECÍFICOS - RANKING
   ============================================ */
@media (max-width: 768px) {
    .posicao-badge,
    .posicao-badge-semanal {
        padding: 10px !important;
        border-radius: 12px !important;
    }

    .posicao-badge h2,
    .posicao-badge-semanal h2 {
        font-size: 1.75rem !important;
    }

    /* Ranking table */
    .table th {
        font-size: 0.85rem !important;
    }

    .table td {
        font-size: 0.9rem !important;
    }

    /* Crown icons */
    .fa-crown.fa-lg {
        font-size: 1.3em !important;
    }
}

@media (max-width: 576px) {
    .posicao-badge,
    .posicao-badge-semanal {
        padding: 8px !important;
    }

    .posicao-badge h2,
    .posicao-badge-semanal h2 {
        font-size: 1.5rem !important;
    }

    .posicao-badge h4,
    .posicao-badge-semanal h4 {
        font-size: 0.9rem !important;
    }

    /* Ranking table menor */
    .table th {
        font-size: 0.75rem !important;
    }

    .table td {
        font-size: 0.8rem !important;
    }

    .fa-crown.fa-lg {
        font-size: 1.1em !important;
    }
}

/* ============================================
   COMPONENTES ESPECÍFICOS - CONQUISTAS
   ============================================ */
@media (max-width: 768px) {
    .conquista-icon {
        margin-bottom: 1rem !important;
    }

    .conquista-icon .fa-4x {
        font-size: 2.5em !important;
    }

    .conquista-card {
        margin-bottom: 1rem !important;
    }
}

@media (max-width: 576px) {
    .conquista-icon .fa-4x {
        font-size: 2em !important;
    }

    .conquista-card .card-title {
        font-size: 1rem;
    }

    .conquista-card .card-text {
        font-size: 0.85rem;
    }
}

/* ============================================
   COMPONENTES ESPECÍFICOS - FORMULÁRIOS
   ============================================ */
@media (max-width: 768px) {
    .form-check {
        margin-bottom: 1rem;
        padding: 0.75rem;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        background-color: #fff;
    }

    .form-check:hover {
        background-color: #f8f9fa;
        border-color: var(--primary-color);
    }

    .form-check-input {
        width: 1.5em;
        height: 1.5em;
        margin-right: 1rem;
        margin-top: 0.125em;
    }

    .form-check-label {
        font-size: 0.95rem;
    }
}

@media (max-width: 576px) {
    .form-check {
        padding: 0.5rem;
    }

    .form-check-label {
        font-size: 0.9rem;
    }

    .form-control {
        font-size: 16px; /* Previne zoom no iOS */
    }
}

/* ============================================
   COMPONENTES ESPECÍFICOS - POMODORO
   ============================================ */
@media (max-width: 768px) {
    .pomodoro-timer h1 {
        font-size: 3rem !important;
    }

    .pomodoro-controls .btn {
        padding: 0.75rem 1.5rem;
    }
}

@media (max-width: 576px) {
    .pomodoro-timer h1 {
        font-size: 2.5rem !important;
    }

    .pomodoro-controls .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .pomodoro-controls .btn-group {
        flex-direction: column;
    }
}

/* ============================================
   UTILITÁRIOS GERAL
   ============================================ */
@media (max-width: 768px) {
    /* Esconder elementos opcionais */
    .d-md-none {
        display: none !important;
    }

    /* Ajustar exibição */
    .d-sm-block {
        display: block !important;
    }

    /* Textos menores */
    .small {
        font-size: 0.8rem !important;
    }

    .lead {
        font-size: 1rem !important;
    }

    /* Espaçamentos reduzidos */
    .gap-3 {
        gap: 0.75rem !important;
    }

    .gap-4 {
        gap: 1rem !important;
    }
}

@media (max-width: 576px) {
    /* Esconder ainda mais */
    .d-sm-none {
        display: none !important;
    }

    /* Espaçamentos mínimos */
    .gap-3 {
        gap: 0.5rem !important;
    }

    .gap-4 {
        gap: 0.75rem !important;
    }

    /* Padding mínimo */
    .px-3 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .py-3 {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
}

/* ============================================
   TABLET (769px - 1024px)
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Ajustes moderados para tablets */
    body {
        font-size: 15px;
    }

    .card-body {
        padding: 1.25rem;
    }

    .btn {
        padding: 0.6rem 1.2rem;
    }

    .fa-3x {
        font-size: 2.2em !important;
    }

    .fa-4x {
        font-size: 2.8em !important;
    }
}

/* ============================================
   CORREÇÕES ESPECÍFICAS
   ============================================ */

/* Prevenir zoom em inputs no iOS */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Ajustar scroll horizontal em tabelas */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        white-space: nowrap;
    }
}

/* Fix para sidebar mobile */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar:not(.show) {
        transform: translateX(-100%);
    }
}

/* Fix para modais em mobile */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal-content {
        border-radius: 12px;
    }
}

/* Ajustar avatares em mobile */
@media (max-width: 768px) {
    img.rounded-circle {
        max-width: 100px !important;
        max-height: 100px !important;
    }

    .avatar-placeholder {
        width: 60px !important;
        height: 60px !important;
    }

    .avatar-placeholder .fa-3x {
        font-size: 1.8em !important;
    }
}

@media (max-width: 576px) {
    img.rounded-circle {
        max-width: 60px !important;
        max-height: 60px !important;
    }

    .avatar-placeholder {
        width: 50px !important;
        height: 50px !important;
    }
}

/* Ajustar badges de estatísticas */
@media (max-width: 768px) {
    .badge-lg {
        font-size: 0.85rem !important;
        padding: 0.4rem 0.75rem !important;
    }
}

/* Correção para botões de ação rápida */
@media (max-width: 576px) {
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Ajustar textos de navegação */
@media (max-width: 768px) {
    .nav-link {
        font-size: 0.9rem;
    }

    .nav-link i {
        width: 20px;
        text-align: center;
    }
}

/* Cabeçalhos de páginas */
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .page-header p {
        font-size: 0.9rem;
    }
}

/* Cards de informação */
@media (max-width: 576px) {
    .info-card {
        padding: 1rem !important;
    }

    .info-card-title {
        font-size: 1.1rem !important;
    }

    .info-card-value {
        font-size: 1.5rem !important;
    }
}

/* Ajustar larguras de colunas em mobile */
@media (max-width: 576px) {
    [class*="col-"] {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        margin-bottom: 1rem;
    }
}

/* Fix para elementos flex em mobile */
@media (max-width: 768px) {
    .d-flex {
        flex-wrap: wrap;
    }

    .flex-column-mobile {
        flex-direction: column !important;
    }
}

/* Ajustar espaçamentos gerais */
@media (max-width: 768px) {
    .m-3 {
        margin: 0.75rem !important;
    }

    .p-3 {
        padding: 0.5rem !important;
    }

    .m-4 {
        margin: 1rem !important;
    }

    .p-4 {
        padding: 0.75rem !important;
    }
}

/* ============================================
   ANIMAÇÕES E TRANSIÇÕES MAIS LEVES NO MOBILE
   ============================================ */
@media (max-width: 768px) {
    * {
        transition-duration: 0.15s !important;
    }

    /* Reduzir animações pesadas */
    @keyframes pulse {
        0%, 100% {
            opacity: 1;
        }
        50% {
            opacity: 0.8;
        }
    }
}

/* ============================================
   FIXES PARA MODAIS ESPECÍFICOS
   ============================================ */
@media (max-width: 768px) {
    #modalConfirmarConclusao .modal-content,
    #modalConfirmarRevisao .modal-content,
    #modalConfirmarQuestoes .modal-content,
    #modalConfirmarRefazer .modal-content {
        border-radius: 16px;
    }

    #modalConfirmarConclusao .modal-body,
    #modalConfirmarRevisao .modal-body,
    #modalConfirmarQuestoes .modal-body,
    #modalConfirmarRefazer .modal-body {
        padding: 1.5rem 1rem;
    }

    .modal-title {
        font-size: 1.15rem;
    }
}

@media (max-width: 576px) {
    #modalConfirmarConclusao .modal-body,
    #modalConfirmarRevisao .modal-body,
    #modalConfirmarQuestoes .modal-body,
    #modalConfirmarRefazer .modal-body {
        padding: 1rem;
    }

    .modal-title {
        font-size: 1rem;
    }
}

/* ============================================
   AJUSTES PARA TABELAS DE DADOS
   ============================================ */
@media (max-width: 768px) {
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive > .table {
        margin-bottom: 0;
    }

    /* Esconder colunas secundárias em mobile */
    .table .mobile-hide {
        display: none !important;
    }
}

/* ============================================
   MELHORIAS DE TOUCH
   ============================================ */
@media (max-width: 768px) {
    /* Áreas de toque maiores */
    button,
    .btn,
    a {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Exceção para sidebar links - manter alinhados à esquerda */
    .sidebar-nav .nav-link {
        justify-content: flex-start !important;
    }

    /* Remover hover em elementos móveis */
    .no-hover-mobile:hover {
        background-color: initial !important;
        transform: none !important;
    }
}

