/* Custom Styles */
body {
    background-color: #f3f4f6;
    color: #1f2937;
}

/* Brand Logo Styles */
.brand-icon {
    width: 40px;
    height: 40px;
    background: #0d6efd;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    box-shadow: 0 4px 6px -1px rgba(13, 110, 253, 0.2);
    transition: transform 0.2s;
}

.navbar-brand:hover .brand-icon {
    transform: rotate(-5deg) scale(1.05);
}

.brand-text-main {
    font-weight: 800;
    font-size: 1.1rem;
    line-height: 1.1;
    color: #1f2937;
    letter-spacing: -0.02em;
}

.brand-text-sub {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}

/* Custom Button Colors */
.btn-purple {
    color: #fff;
    background-color: #6f42c1;
    border-color: #6f42c1;
}
.btn-purple:hover {
    color: #fff;
    background-color: #59359a;
    border-color: #59359a;
}
.btn-outline-purple {
    color: #6f42c1;
    border-color: #6f42c1;
}
.btn-outline-purple:hover,
.btn-outline-purple.active {
    color: #fff;
    background-color: #6f42c1;
    border-color: #6f42c1;
}
.btn-blue {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}
.btn-blue:hover {
    color: #fff;
    background-color: #0b5ed7;
    border-color: #0a58ca;
}
.btn-outline-blue {
    color: #0d6efd;
    border-color: #0d6efd;
}
.btn-outline-blue:hover {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* Form Styles */
.form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* Card Styles */
.card {
    border: none;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Modal Styles */
.modal-content {
    border: none;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Utility Classes */
.text-primary {
    color: #4f46e5 !important;
}

.bg-primary {
    background-color: #4f46e5 !important;
}

.hero-section {
    position: -webkit-sticky;
    position: sticky;
    top: 60px;
    z-index: 1060;
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: #fff;
    padding: 2rem 0;
    margin-bottom: 2rem;
    border-radius: 0 0 1.5rem 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.hero-title {
    font-weight: 800;
    letter-spacing: -0.025em;
    font-size: 2rem;
}

.filter-card label,
.filter-card .form-check-label,
.filter-card .form-check-input {
    font-size: 14px !important;
}

.filter-card {
    border-radius: 1rem;
    overflow: hidden;
}

@media (min-width: 992px) {
    .sticky-sidebar {
        position: -webkit-sticky;
        position: sticky;
        top: 280px;
        z-index: 1005;
        height: fit-content;
        max-height: calc(100vh - 300px);
        overflow-y: auto;
        margin-top: -115px;
    }
}

/* Comment Thread Styles */
.comment-thread p {
    font-size: 0.85rem !important;
}

.replies span.small.text-primary {
    font-weight: normal !important;
}

/* Alternativas Styles - Simulado */
.alternativa-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    background-color: #fff;
    position: relative;
}

.alternativa-card:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.alternativa-card.selected {
    border-color: #0d6efd;
    background-color: #e7f1ff;
    box-shadow: 0 0 0 1px #0d6efd;
}

.alternativa-card.eliminated, 
.alternativa-card.discarded {
    opacity: 0.6;
    background-color: #f3f4f6;
    color: #9ca3af;
}

.alternativa-card.discarded .flex-grow-1 {
    text-decoration: line-through;
}

.alternativa-card.correct {
    border-color: #10b981;
    background-color: #ecfdf5;
}

.alternativa-card.incorrect {
    border-color: #ef4444;
    background-color: #fef2f2;
}

.alternativa-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #f3f4f6;
    color: #4b5563;
    font-weight: 600;
    margin-right: 12px;
    font-size: 0.9rem;
    transition: all 0.2s;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.alternativa-card:hover .alternativa-indicator {
    background-color: #e5e7eb;
    border-color: #d1d5db;
}

.alternativa-card.selected .alternativa-indicator {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

.alternativa-card.correct .alternativa-indicator {
    background-color: #10b981;
    color: white;
    border-color: #10b981;
}

.alternativa-card.incorrect .alternativa-indicator {
    background-color: #ef4444;
    color: white;
    border-color: #ef4444;
}

.btn-discard {
    background: none;
    border: none;
    color: #9ca3af;
    padding: 6px;
    margin-right: 8px;
    transition: all 0.2s;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-discard:hover {
    color: #ef4444;
    background-color: #fee2e2;
}

.alternativa-card.discarded .btn-discard {
    color: #ef4444;
}

.ia-popup {
    border-radius: 14px;
    overflow: hidden;
}

.ia-popup .card-header {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%) !important;
    color: #fff !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
}

.ia-popup .card-header .text-dark {
    color: #fff !important;
}

.ia-popup .card-header .text-primary {
    color: rgba(255, 255, 255, 0.9) !important;
}

.ia-popup .btn-close {
    filter: invert(1);
    opacity: 0.9;
}

.ia-popup .ia-chat-body {
    background: #f8fafc !important;
}

.ia-chat-mensagens {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ia-msg {
    display: flex;
}

.ia-msg .ia-bolha {
    max-width: 88%;
    padding: 2px 8px; /* Compact padding */
    display: inline-block;
    line-height: 1; /* Tighter line height for collapsed mode */
    min-height: 0;
    border-radius: 14px;
    font-size: 0.92rem;
    white-space: pre-wrap;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.ia-msg-user {
    justify-content: flex-end;
}

.ia-msg-user .ia-bolha {
    background: #e0e7ff; /* Roxo muito suave (Indigo-100) */
    color: #3730a3;     /* Texto roxo escuro para contraste */
    border: 1px solid #c7d2fe;
    border-bottom-right-radius: 6px;
}

.ia-msg-assistant {
    justify-content: flex-start;
    flex-direction: column;
    align-items: flex-start;
}

.ia-topic {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 4px;
}

.ia-topic-number {
    min-width: 24px;
    height: 24px;
    border-radius: 999px;
    background-color: #e0e7ff;
    color: #3730a3;
    font-weight: 600;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ia-topic-text {
    font-weight: 600;
}

.ia-msg-assistant .ia-bolha {
    background: #fff;
    color: #111827;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 6px;
    /* Reset padding/line-height for assistant bubbles as they are not collapsed */
    padding: 10px 12px;
    line-height: 1.35;
}

.ia-msg-sistema {
    justify-content: center;
}

.ia-msg-sistema .ia-bolha {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
    border-radius: 999px;
    font-size: 0.85rem;
    padding: 8px 12px;
    max-width: 95%;
    text-align: center;
    line-height: 1.35;
}

.ia-popup .card-footer {
    background: #f8fafc !important;
}

.ia-popup .ia-chat-input {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px 0 0 10px;
    font-size: 0.92rem;
}

.ia-popup .btn-ia-enviar {
    border-radius: 0 10px 10px 0;
}

/* Fix for Responsive Images in Questions */
.questao-container img, 
.card-body img,
.alternativa-card img,
.alternativas-area img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 10px 0;
    border-radius: 4px;
}

/* Mobile Sidebar Toggle (Hidden on Desktop) */
@media (max-width: 768px) {
    #sidebar-wrapper {
        margin-left: -250px; /* Hide sidebar by default on mobile */
    }
    #page-content-wrapper {
        margin-left: 0;
        width: 100%;
    }
    #wrapper.toggled #sidebar-wrapper {
        margin-left: 0;
    }
}

@media (max-width: 576px) {
    html {
        font-size: 15px;
    }

    body {
        font-size: 1rem;
    }

    h1.display-5 {
        font-size: 1.65rem !important;
        line-height: 1.2;
    }

    p.lead {
        font-size: 1rem !important;
        line-height: 1.35;
    }

    .mt-5 {
        margin-top: 1.75rem !important;
    }

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

    .btn {
        font-size: 0.95rem;
    }

    .btn-lg,
    .form-control-lg,
    .input-group-lg > .form-control,
    .input-group-lg > .input-group-text,
    .input-group-lg > .btn {
        padding-top: 0.65rem;
        padding-bottom: 0.65rem;
        font-size: 1rem;
    }

    .card {
        border-radius: 14px;
    }

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

    .card-body {
        padding: 1rem;
    }

    .container,
    .container-fluid {
        padding-left: 0.85rem !important;
        padding-right: 0.85rem !important;
    }

    .dropdown-menu {
        max-width: 100vw;
    }

    .dropdown-menu-filter {
        max-height: 70vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    nav.navbar.sticky-top {
        height: auto !important;
        padding-left: 0.85rem !important;
        padding-right: 0.85rem !important;
        padding-top: 0.6rem !important;
        padding-bottom: 0.6rem !important;
    }

    nav.navbar.sticky-top h4 {
        font-size: 1.05rem;
        line-height: 1.15;
    }

    #header-cart-dropdown {
        width: calc(100vw - 1.7rem) !important;
        left: 0.85rem !important;
        right: 0.85rem !important;
    }

    #app-main-container > .p-4.pb-0 {
        padding: 1rem !important;
        padding-bottom: 0 !important;
    }

    #app-main-container > .p-4.pb-0 .container {
        margin-top: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    #app-main-container h1.display-5 {
        font-size: 1.6rem;
        line-height: 1.2;
        margin-bottom: 0.75rem !important;
    }

    #app-main-container h1.display-5 .badge {
        font-size: 0.85rem !important;
    }

    #app-main-container .lead {
        font-size: 1rem;
        margin-bottom: 1rem !important;
    }

    #questions-scroll-area {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    #questions-scroll-area .container {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .questao-container .card-header,
    .questao-container .card-body {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .questao-container .badge {
        font-size: 0.75rem;
    }

    .alternativa-card {
        align-items: flex-start !important;
    }

    .alternativa-card label,
    .alternativa-card .form-check-label {
        line-height: 1.35;
    }

    .simulado-config-card .card-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .simulado-config-card .card-header h4 {
        font-size: 1.1rem;
        line-height: 1.2;
    }

    .simulado-config-card .card-header .badge {
        font-size: 0.85rem;
    }

    .simulado-config-card .btn-group {
        width: 100%;
    }

    .simulado-config-card .btn-group .btn {
        flex: 1;
        white-space: normal;
    }

    .simulado-config-card .form-check {
        display: flex;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 0.35rem !important;
    }

    .simulado-config-card .form-check-input {
        margin-top: 0.25rem;
    }

    .simulado-config-card .form-check-label {
        line-height: 1.35 !important;
        padding: 4px 0 !important;
    }

    .simulado-config-card .form-check-label .text-nowrap {
        white-space: normal !important;
    }

    .flashcards-index-page .d-flex.justify-content-between.align-items-center.mb-4 {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem;
    }

    .flashcards-index-page .d-flex.justify-content-between.align-items-center.mb-4 > div {
        width: 100%;
        display: grid;
        gap: 0.5rem;
    }

    .flashcards-index-page .d-flex.justify-content-between.align-items-center.mb-4 > div > .btn {
        width: 100%;
        margin: 0 !important;
    }

    .flashcards-index-page .card.border-0.shadow-sm.mb-4 .card-body form.d-flex.gap-2 {
        flex-direction: column;
    }

    .flashcards-index-page .card.border-0.shadow-sm.mb-4 .card-body form.d-flex.gap-2 > .input-group {
        width: 100%;
    }

    .flashcards-index-page .card.border-0.shadow-sm.mb-4 .card-body form.d-flex.gap-2 > .btn,
    .flashcards-index-page .card.border-0.shadow-sm.mb-4 .card-body form.d-flex.gap-2 > a.btn {
        width: 100%;
    }

    .flashcards-index-page h3 {
        font-size: 1.05rem;
        line-height: 1.2;
    }

    .flashcards-index-page .card-deck .card-body {
        padding: 1rem !important;
    }

    .flashcards-index-page .card-deck .card-title {
        font-size: 1.05rem;
    }

    .flashcards-index-page .card-deck .d-flex.justify-content-between.align-items-center.mb-3.p-2.bg-light.rounded {
        flex-direction: column;
        gap: 0.5rem;
    }

    .flashcards-index-page .card-deck .d-flex.justify-content-between.align-items-center.mb-3.p-2.bg-light.rounded > div {
        width: 100% !important;
        border: 0 !important;
        padding: 0 !important;
    }

    .flashcards-index-page .card-deck .d-flex.justify-content-between.align-items-center.mb-3.p-2.bg-light.rounded small {
        font-size: 0.7rem !important;
    }

    .flashcards-pacotes-page .row.justify-content-center.mb-5 .col-md-8 {
        max-width: 100%;
    }

    .flashcards-pacotes-page form.input-group.shadow-sm {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .flashcards-pacotes-page form.input-group.shadow-sm > * {
        flex: 1 0 100%;
        width: 100%;
        max-width: none !important;
    }

    .flashcards-pacotes-page .list-group-item.p-4 {
        padding: 1rem !important;
    }

    .flashcards-pacotes-page .list-group-item .row.align-items-center {
        gap: 0.75rem;
    }

    .flashcards-pacotes-page .list-group-item .col-md-4 .d-flex.align-items-center.justify-content-md-end.gap-3 {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.5rem !important;
    }

    .flashcards-pacotes-page .list-group-item .col-md-4 .text-end {
        text-align: left !important;
    }

    .flashcards-pacotes-page .list-group-item .col-md-4 div[style*="min-width: 140px"] {
        min-width: 0 !important;
        width: 100% !important;
    }

    .notificacoes-page .d-flex.flex-column.flex-md-row.justify-content-between.align-items-md-center.mb-5.mt-4 {
        margin-top: 0.5rem !important;
        margin-bottom: 1.25rem !important;
    }

    .notificacoes-page .card.border-0.shadow-sm.mb-4 .card-body.p-3 {
        padding: 1rem !important;
    }

    .notificacoes-page .card.border-0.shadow-sm.mb-4 form.d-flex.gap-2.flex-grow-1 {
        flex-wrap: wrap;
    }

    .notificacoes-page .card.border-0.shadow-sm.mb-4 form.d-flex.gap-2.flex-grow-1 > input.form-control {
        flex: 1 0 100%;
    }

    .notificacoes-page .card.border-0.shadow-sm.mb-4 form.d-flex.gap-2.flex-grow-1 > select.form-select {
        flex: 1 0 100%;
        width: 100% !important;
    }

    .notificacoes-page .card.border-0.shadow-sm.mb-4 form.d-flex.gap-2.flex-grow-1 > button.btn {
        flex: 1 0 100%;
        width: 100%;
    }

    .notificacoes-page .notification-card .card-body.p-4 {
        padding: 1rem !important;
    }

    .notificacoes-page .notification-card h5 {
        font-size: 1rem;
        line-height: 1.2;
    }

    .notificacoes-page .notification-card p {
        margin-bottom: 0.75rem !important;
    }

    .suporte-page .d-flex.flex-column.flex-md-row.justify-content-between.align-items-md-center.mb-4.gap-3 {
        align-items: stretch !important;
    }

    .suporte-page .d-flex.flex-column.flex-md-row.justify-content-between.align-items-md-center.mb-4.gap-3 form.d-flex.gap-2.flex-grow-1 {
        flex-wrap: wrap;
        max-width: 100% !important;
    }

    .suporte-page .d-flex.flex-column.flex-md-row.justify-content-between.align-items-md-center.mb-4.gap-3 form.d-flex.gap-2.flex-grow-1 > input.form-control {
        flex: 1 0 100%;
    }

    .suporte-page .d-flex.flex-column.flex-md-row.justify-content-between.align-items-md-center.mb-4.gap-3 form.d-flex.gap-2.flex-grow-1 > select.form-select {
        flex: 1 0 100%;
        width: 100% !important;
    }

    .suporte-page .d-flex.flex-column.flex-md-row.justify-content-between.align-items-md-center.mb-4.gap-3 form.d-flex.gap-2.flex-grow-1 > button.btn {
        flex: 0 0 auto;
    }

    .suporte-page .d-flex.flex-column.flex-md-row.justify-content-between.align-items-md-center.mb-4.gap-3 > button.btn.btn-primary.fw-bold {
        width: 100%;
    }

    .suporte-page .accordion-button .d-flex.flex-column.flex-md-row.w-100.align-items-md-center.gap-2.pe-3 {
        padding-right: 0 !important;
    }

    .suporte-page .accordion-body .p-4 {
        padding: 1rem !important;
    }

    .suporte-page .suporte-msg-card {
        max-width: 92% !important;
    }

    .aluno-dashboard-page .card-body.p-4 {
        padding: 1rem !important;
    }

    .aluno-dashboard-page .bg-custom-blue.p-3.rounded-circle {
        width: 48px !important;
        height: 48px !important;
        padding: 0 !important;
        font-size: 1.05rem !important;
    }

    .aluno-dashboard-page h4.fw-bold.mb-2.text-dark {
        font-size: 1.05rem;
        line-height: 1.2;
        margin-bottom: 0.5rem !important;
    }

    .aluno-dashboard-page .badge.fs-6 {
        font-size: 0.9rem !important;
        padding: 0.45rem 0.75rem !important;
    }

    .aluno-dashboard-page .row.g-3.mb-4 h2 {
        font-size: 1.6rem;
    }

    .aluno-dashboard-page .row.g-3.mb-4 h3 {
        font-size: 1.25rem;
    }

    .aluno-dashboard-page .nav-tabs.card-header-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .aluno-dashboard-page .nav-tabs-custom .nav-link {
        padding: 10px 14px !important;
        white-space: nowrap;
    }
}
