/*
 * EduTeste — Pacote 16
 * Compatibilidade visual fina e revisão geral
 */

:root{
    --e16-blue:#1f4e8c;
    --e16-blue-hover:#173d70;
    --e16-primary:#2563eb;
    --e16-primary-hover:#1d4ed8;
    --e16-green:#15803d;
    --e16-red:#b91c1c;
    --e16-amber:#a16207;
    --e16-bg:#eef3f8;
    --e16-card:#ffffff;
    --e16-border:#d8e1eb;
    --e16-text:#1e293b;
    --e16-muted:#64748b;
    --e16-radius:10px;
}

html{
    max-width:100%;
    overflow-x:hidden;
}

body{
    max-width:100%;
    overflow-x:hidden;
    color:var(--e16-text);
    background:var(--e16-bg);
    -webkit-text-size-adjust:100%;
}

/* largura geral */

main,
.legacy-page,
.page-container,
.content-wrapper{
    max-width:1600px;
}

img{
    max-width:100%;
}

/* títulos */

h1,h2,h3{
    line-height:1.22;
}

h1{
    color:#183b67;
}

.page-title,
.legacy-page-title{
    margin-bottom:14px;
}

/* cards */

.card,
.panel,
.legacy-card,
.content-card{
    border-color:var(--e16-border);
}

.card,
.panel,
.legacy-card{
    border-radius:12px;
}

.card-header,
.panel-header,
.legacy-card-header{
    padding-top:12px;
    padding-bottom:12px;
}

/* botões */

button,
.btn,
.button,
.legacy-btn{
    min-height:38px;
    border-radius:8px;
    font-weight:700;
    line-height:1.15;
}

button:not(:disabled),
.btn:not(.disabled),
.button:not(.disabled),
.legacy-btn:not(.disabled){
    cursor:pointer;
}

button:disabled,
.btn.disabled,
.button.disabled{
    cursor:not-allowed;
    opacity:.58;
}

.btn-primary,
.button-primary,
.legacy-btn-primary{
    background:var(--e16-primary);
    border-color:var(--e16-primary);
}

.btn-primary:hover,
.button-primary:hover,
.legacy-btn-primary:hover{
    background:var(--e16-primary-hover);
    border-color:var(--e16-primary-hover);
}

.btn-danger,
.button-danger{
    background:#dc2626;
}

.btn-sm,
.button-sm{
    min-height:32px;
}

/* formulários */

input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=date],
input[type=datetime-local],
input[type=time],
input[type=search],
select,
textarea{
    border:1px solid #bdc9d8;
    border-radius:8px;
    min-height:40px;
}

textarea{
    line-height:1.45;
}

input:focus,
select:focus,
textarea:focus{
    border-color:#7aa2df;
    box-shadow:0 0 0 3px rgba(37,99,235,.10);
    outline:0;
}

label{
    color:#334155;
}

.form-help,
.help-text,
.text-muted{
    color:var(--e16-muted);
}

/* tabelas */

.table-responsive,
.table-wrapper,
.responsive-table{
    width:100%;
    overflow-x:auto;
    scrollbar-width:thin;
}

table{
    border-collapse:collapse;
}

table th{
    color:#334155;
}

table th,
table td{
    vertical-align:middle;
}

table tbody tr:last-child td{
    border-bottom:0;
}

/* abas */

.tabs,
.nav-tabs,
.legacy-tabs{
    overflow-x:auto;
    scrollbar-width:thin;
}

.tabs a,
.nav-tabs a,
.legacy-tabs a{
    white-space:nowrap;
}

/* dropdown */

.dropdown-menu,
.actions-menu,
.legacy-dropdown-menu{
    z-index:300;
    border:1px solid var(--e16-border);
    border-radius:9px;
    box-shadow:0 12px 30px rgba(15,23,42,.14);
}

.dropdown-menu a,
.dropdown-menu button,
.actions-menu a,
.actions-menu button{
    min-height:36px;
}

/* alertas */

.alert,
.notice,
.flash-message{
    border-radius:9px;
}

.alert-success,
.notice-success{
    border-color:#bbf7d0;
}

.alert-danger,
.alert-error,
.notice-error{
    border-color:#fecaca;
}

.alert-warning{
    border-color:#fde68a;
}

/* modais */

dialog,
.modal-content,
.legacy-modal-content{
    border-radius:12px;
}

dialog{
    border:0;
    max-height:92vh;
}

dialog::backdrop{
    background:rgba(15,23,42,.54);
}

.modal-body,
.dialog-body,
.legacy-modal-body{
    overflow:auto;
    max-height:calc(92vh - 130px);
}

.modal-header,
.dialog-header,
.modal-footer,
.dialog-footer{
    flex-shrink:0;
}

/* paginação */

.pagination{
    display:flex;
    flex-wrap:wrap;
    gap:4px;
}

.pagination a,
.pagination span{
    min-width:34px;
    min-height:34px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:7px;
}

/* badges */

.badge,
.chip,
.status-pill{
    line-height:1.15;
}

/* estados vazios */

.empty-state,
.legacy-empty-state{
    padding:34px 20px;
    text-align:center;
    color:var(--e16-muted);
}

/* foco */

:focus-visible{
    outline:3px solid rgba(37,99,235,.26);
    outline-offset:2px;
}

/* editores e conteúdo de questões */

.question-content,
.editor-content,
.rich-content{
    overflow-wrap:anywhere;
}

.question-content img,
.editor-content img,
.rich-content img{
    max-width:100% !important;
    height:auto !important;
}

.question-content table,
.editor-content table,
.rich-content table{
    max-width:100%;
}

/* evita largura quebrada por textos longos */

.card,
.panel,
.modal-content,
dialog,
td,
th{
    min-width:0;
}

a,
button,
td,
p,
span{
    overflow-wrap:break-word;
}

/* impressão */

@media print{
    body{
        background:#fff !important;
    }

    header,
    nav,
    .sidebar,
    .no-print,
    .dropdown-menu,
    .actions-menu{
        display:none !important;
    }

    main{
        width:100% !important;
        max-width:none !important;
        margin:0 !important;
        padding:0 !important;
    }

    .card,
    .panel{
        box-shadow:none !important;
    }
}

/* tablet */

@media(max-width:1000px){
    main,
    .legacy-page,
    .page-container{
        width:100%;
    }

    .toolbar,
    .page-toolbar{
        flex-wrap:wrap;
    }
}

/* celular */

@media(max-width:700px){
    body{
        font-size:14px;
    }

    main,
    .legacy-page,
    .page-container,
    .content-wrapper{
        padding-left:9px !important;
        padding-right:9px !important;
    }

    h1{
        font-size:23px;
    }

    h2{
        font-size:19px;
    }

    .card,
    .panel,
    .legacy-card{
        border-radius:10px;
    }

    .card-body,
    .panel-body,
    .legacy-card-body{
        padding:12px;
    }

    .toolbar,
    .page-toolbar,
    .legacy-toolbar{
        display:flex;
        flex-direction:column;
        align-items:stretch !important;
        gap:8px;
    }

    .toolbar > *,
    .page-toolbar > *,
    .legacy-toolbar > *{
        width:100%;
    }

    button,
    .btn,
    .button,
    .legacy-btn{
        min-height:42px;
    }

    .modal-content,
    dialog{
        width:calc(100vw - 16px) !important;
        max-width:calc(100vw - 16px) !important;
        margin-left:auto;
        margin-right:auto;
    }

    .modal-body,
    .dialog-body,
    .legacy-modal-body{
        max-height:calc(100vh - 160px);
    }

    .modal-footer,
    .dialog-footer{
        display:flex;
        flex-direction:column-reverse;
        gap:7px;
    }

    .modal-footer button,
    .modal-footer .btn,
    .dialog-footer button,
    .dialog-footer .btn{
        width:100%;
    }

    .pagination{
        justify-content:center;
    }
}
