/* ==========================================================================
   PUBLIC/ASSETS/CSS/PAGES/FORMS.CSS (COMPACTO + FIELDSETS + FORM-SLIM)
   ========================================================================== */

.form-page{
  display:block;
}

.form-box{
  background:#fff;
  border:1px solid rgba(0,0,0,.10);
  border-radius:12px;
  box-shadow:0 .10rem .20rem rgba(0,0,0,.05);
  padding:.75rem .90rem;
}

@media (min-width: 768px){
  .form-box{
    padding:.85rem 1rem;
  }
}

.form-titlebar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:.45rem;
  gap:.75rem;
  background-color:#3f6f97;
  color:#fff;
  opacity:.9;
  padding:.40rem .50rem;
  border-radius:10px;
}

.form-titlebar h4{
  margin:0;
  font-weight:700;
  font-size:calc(1.03rem + .3vw);
  color:#fff;
  flex:1 1 auto;
  min-width:0;
}

.form-titlebar a,
.form-titlebar button{
  color:#fff !important;
}

.form-titlebar i,
.form-titlebar svg{
  color:#fff !important;
  fill:currentColor;
}

.form-titlebar .btn,
.form-titlebar .btn-style-uniform,
.form-titlebar .btn-outline,
.form-titlebar .btn-link{
  color:#fff !important;
  border-color:rgba(255,255,255,.55) !important;
  background:rgba(255,255,255,.12) !important;
}

.form-titlebar .btn:hover,
.form-titlebar .btn-style-uniform:hover,
.form-titlebar .btn-outline:hover,
.form-titlebar .btn-link:hover{
  background:rgba(255,255,255,.22) !important;
  border-color:rgba(255,255,255,.75) !important;
  color:#fff !important;
}

.form-titlebar .btn:focus,
.form-titlebar .btn-style-uniform:focus{
  box-shadow:0 0 0 .15rem rgba(255,255,255,.25) !important;
}

.form-titlebar > *:last-child{
  flex:0 0 auto;
}

.form-actions{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.75rem;
  margin-top:.55rem;
  padding-top:.55rem;
  border-top:1px solid rgba(0,0,0,.08);
}

/* ==========================================================================
   FIELDSET + LEGEND
   ========================================================================== */

.form-fieldset{
  border:1px solid #bfc5cc;
  border-radius:10px;
  padding:.48rem .75rem .55rem .75rem;
  margin:0;
  min-inline-size:0;
}

.form-fieldset > legend{
  float:none !important;
  width:auto;
  display:inline-block;
  padding:0 .40rem;
  margin-left:.45rem;
  margin-bottom:0;
  font-weight:700;
  font-size:.98rem;
  line-height:1;
  color:#2c3e50;
  background:#fff;
  border-radius:6px;
}

.form-fieldset > .row{
  margin-top:-.05rem !important;
  padding-top:0 !important;
}

/* ==========================================================================
   LABELS
   ========================================================================== */

.form-page .form-label,
.form-fieldset .form-label{
  margin-bottom:.05rem;
  font-weight:600;
  font-size:.90rem;
  line-height:1.05;
}

.label-required::after{
  content:' *';
  color:red;
  margin-left:2px;
}

/* ==========================================================================
   CONTROLES
   ========================================================================== */

.form-page input[type="text"],
.form-page input[type="number"],
.form-page input[type="email"],
.form-page input[type="password"],
.form-page input[type="date"],
.form-page input[type="file"],
.form-page select,
.form-page textarea{
  border:1px solid #b0b0b0;
  border-radius:.40rem;
  padding:.26rem .48rem;
  width:100%;
  box-sizing:border-box;
  background-color:#fff;
  font-size:.92rem;
  line-height:1.12;
}

.form-page textarea{
  font-weight:500;
}

.form-page .form-control,
.form-page .form-select{
  box-shadow:none !important;
}

.form-page input[readonly],
.form-page textarea[readonly]{
  background-color:#f9f9f9;
  color:#666;
}

.form-page select:disabled,
.form-page input:disabled,
.form-page textarea:disabled{
  background-color:#f2f2f2;
  color:#666;
}

.form-page .form-text,
.form-page .field-inline-help{
  margin-top:.12rem;
}

/* ==========================================================================
   GRID
   ========================================================================== */

.form-page .row.g-3{
  --bs-gutter-y:.22rem;
  --bs-gutter-x:.70rem;
}

.form-page .row.g-2{
  --bs-gutter-y:.18rem;
  --bs-gutter-x:.70rem;
}

/* ==========================================================================
   FORM-SLIM
   ========================================================================== */

.form-slim .form-fieldset{
  padding:.38rem .70rem .45rem .70rem;
}

.form-slim .fieldset-slim-1.form-fieldset{
  padding-top:.30rem;
  padding-bottom:.38rem;
}

.form-slim .fieldset-slim-2.form-fieldset{
  padding-top:.34rem;
  padding-bottom:.45rem;
}

.form-slim .form-fieldset > legend{
  font-size:.95rem;
  padding:0 .38rem;
  margin-bottom:0;
  line-height:1;
}

.form-slim .form-titlebar{
  margin-bottom:.34rem;
}

.form-slim .form-label{
  margin-bottom:.04rem;
  font-size:.88rem;
  line-height:1;
}

.form-slim .form-control,
.form-slim .form-select{
  padding:.24rem .46rem;
  font-size:.90rem;
  line-height:1.08;
  min-height:30px;
}


/* =========================================================
   DUAL LIST - COMPACTO DE VERDADE
   ========================================================= */
.form-slim .dual-box {
    padding: 2px 4px;  /*  reduz altura de cada item */
    font-size: .88rem;
    line-height: 1.1;

    height: 100px !important;
    min-height: 100px !important;
    max-height: 100px !important;

    overflow-y: auto;
}

/* variações de altura */
.form-slim .dual-box-sm {
    height: 100px !important;
    min-height: 100px !important;
    max-height: 100px !important;
}

.form-slim .dual-box-md {
    height: 150px !important;
    min-height: 150px !important;
    max-height: 150px !important;
}

.form-slim .dual-box-lg {
    height: 200px !important;
    min-height: 200px !important;
    max-height: 200px !important;
}

.form-slim .dual-box-xl {
    height: 260px !important;
    min-height: 260px !important;
    max-height: 260px !important;
}

.form-slim .dual-box-xxl {
    height: 360px !important;
    min-height: 360px !important;
    max-height: 360px !important;
}

/* ==========================================================================
   FORM-COMPACTO
   ========================================================================== */
/* FIELDSET bem compacto */
.form-fieldset.fieldset-tight {
  padding: .26rem .65rem .42rem .65rem;
}

.form-fieldset.fieldset-tight > legend {
  margin-bottom: -.05rem;
  line-height: .95;
}

/* fundo azul claro para blocos informativos */
.form-fieldset.fieldset-info {
  background-color: #eef7ff;
}

/* texto com quebras de linha coladas */
.text-pre-line-tight {
  white-space: pre-line;
  line-height: 1.28;
  margin: 0;
}

/* borda lateral dinâmica via CSS variable */
.form-fieldset.fieldset-accent-left {
  border-left-width: 5px !important;
  border-left-style: solid !important;
  border-left-color: var(--fieldset-accent-color, #6c757d) !important;
}


/* ==========================================================================
   UTILITÁRIOS DE LARGURA
   ========================================================================== */

.w-220 { width:220px !important; }
.w-260 { width:260px !important; }
.w-280 { width:280px !important; }
.w-320 { width:320px !important; }
.w-360 { width:360px !important; }
.w-420 { width:420px !important; }
.w-520 { width:520px !important; }
.w-640 { width:640px !important; }
.w-760 { width:760px !important; }
.w-900 { width:900px !important; }

@media (max-width: 992px){
  .w-220,.w-260,.w-280,.w-320,.w-360,.w-420,.w-520,.w-640,.w-760,.w-900{
    width:100% !important;
  }
}

.mw-220 { max-width:220px; }
.mw-260 { max-width:260px; }
.mw-280 { max-width:280px; }
.mw-320 { max-width:320px; }
.mw-360 { max-width:360px; }
.mw-420 { max-width:420px; }
.mw-520 { max-width:520px; }
.mw-640 { max-width:640px; }
.mw-760 { max-width:760px; }
.mw-900 { max-width:900px; }

/* ==========================================================================
   QUILL
   ========================================================================== */

#editor-container{ width:100%; }

#editor-container .ql-editor{
  min-height:280px;
  resize:vertical;
  overflow-y:auto;
}

.ql-toolbar.ql-snow,
.ql-container.ql-snow{
  border-color:#ced4da !important;
  border-radius:.45rem;
}

/* ==========================================================================
   FORM-VERTICAL
   ========================================================================== */

.form-page .table{
  margin-bottom:.35rem;
}

.form-page .table > :not(caption) > * > *{
  padding:.30rem .55rem;
  vertical-align:middle;
}

.form-page .table th{
  font-size:.93rem;
  line-height:1.05;
}

.form-page .table td{
  font-size:.95rem;
  line-height:1.10;
}

.form-page .form-control-plaintext{
  padding:0 !important;
  margin:0 !important;
  line-height:1.10;
}

.form-page .table td img{
  display:inline-block;
  vertical-align:middle;
}

.form-page .table td .form-text{
  margin-top:.12rem;
  line-height:1.10;
}

/* ==========================================================================
   GOVERNANÇA/INDEX COM FIELDSETS
   ========================================================================== */

.datagrid-wrapper.form-slim .form-fieldset .form-actions{
  margin-top:0 !important;
  padding-top:0 !important;
  border-top:0 !important;
}

.datagrid-wrapper.form-slim .form-vertical-slim.table{
  margin-bottom:.25rem;
}

.datagrid-wrapper.form-slim .form-vertical-slim.table > :not(caption) > * > *{
  padding:.28rem .50rem !important;
  vertical-align:middle;
}

.datagrid-wrapper.form-slim .form-vertical-slim.table th{
  font-size:.93rem;
  line-height:1.05;
}

.datagrid-wrapper.form-slim .form-vertical-slim.table td{
  font-size:.95rem;
  line-height:1.10;
}

.datagrid-wrapper.form-slim .form-control-plaintext{
  padding:0 !important;
  margin:0 !important;
  line-height:1.10;
}

.datagrid-wrapper.form-slim .table-tasks{
  margin-top:.45rem !important;
}

.datagrid-wrapper.form-slim .table-tasks th,
.datagrid-wrapper.form-slim .table-tasks td{
  padding:.35rem .55rem !important;
  font-size:.93rem;
  line-height:1.15;
}

.datagrid-wrapper.form-slim .table-tasks td .small{
  line-height:1.05;
}

/* ==========================================================================
   BADGES/PILLS DE STATUS EM FORMS
   ========================================================================== */

.form-page .badge-softdeleted,
.form-page .badge-active-soft {
  display:inline-flex;
  align-items:center;
  gap:.28rem;
  font-size:.68rem;
  font-weight:600;
  padding:.12rem .38rem;
  border-radius:6px;
  line-height:1;
  white-space:nowrap;
}

.form-page .badge-softdeleted {
  color:#842029;
  background:rgba(220,53,69,0.10);
  border:1px solid rgba(220,53,69,0.22);
}

.form-page .badge-active-soft {
  color:#0f5132;
  background:rgba(25,135,84,0.08);
  border:1px solid rgba(25,135,84,0.20);
}

.form-page .badge-softdeleted i,
.form-page .badge-active-soft i {
  font-size:.60rem;
  opacity:.85;
}

/*========================================================= */
/* COMPONENTE: IDLE TIMEOUT / AVISO DE INATIVIDADE          */
/*========================================================= */

.idle-timeout-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.94);

    width: 380px;
    max-width: calc(100vw - 32px);

    background: #ffffff;
    padding: 28px 26px;

    border-radius: 18px;
    border: 4px solid #3f6f97;
    box-shadow: 0 14px 45px rgba(0,0,0,0.35);

    text-align: center;
    z-index: 9999;

    display: none;
    opacity: 0;

    transition:
        transform .25s ease-out,
        opacity .20s ease-out;
}

.idle-timeout-box.is-visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.idle-timeout-icon {
    width: 78px;
    height: 78px;
    border-radius: 50%;

    background: rgba(220,53,69,0.12);
    border: 2px solid rgba(220,53,69,0.25);

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 0 auto 14px;

    font-size: 2.6rem;
    color: #dc3545;
}

.idle-timeout-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: #234a69;
    margin-bottom: 6px;
}

.idle-timeout-subtitle {
    font-size: 1rem;
    color: #4b4b4b;
    margin-bottom: 18px;
}

.idle-timeout-progress-wrap {
    background: rgba(0,0,0,0.08);
    height: 12px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 18px;
}

.idle-timeout-progress-bar {
    height: 12px;
    width: 100%;
    background: #ff6b6b;
    border-radius: 8px;
    transition: width .8s ease-out;
    transform-origin: left center;
}

.idle-timeout-info {
    margin-top: 10px;
    font-size: .92rem;
    color: #234a69;
    opacity: .85;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

@media (max-width: 576px) {
    .idle-timeout-box {
        width: calc(100vw - 28px);
        padding: 24px 20px;
    }

    .idle-timeout-title {
        font-size: 1.25rem;
    }

    .idle-timeout-subtitle,
    .idle-timeout-info {
        font-size: .88rem;
    }
}
