/*
 * Compatibility for templates still written for AdminLTE 2 / Bootstrap 3.
 * Maps their classes onto the new tokens so they render quietly until each page is rebuilt.
 * Delete rules here as pages move to the new components.
 */

/* AdminLTE page frame */
.content-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
}
.content-header h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 650;
    letter-spacing: -0.015em;
}
.content-header h1 small,
.content-header .breadcrumb {
    display: none;
}

/* Boxes and panels become flat bordered sections (no colored top stripe) */
.box,
.panel {
    margin-bottom: var(--space-lg);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--line);
}
.box-title {
    margin: 0;
    font-size: var(--text-md);
    font-weight: 600;
}
.box-tools {
    display: none;
}
.box-body,
.panel-body {
    padding: var(--space-md);
}
.box-body > .table-responsive {
    margin: calc(var(--space-md) * -1);
}
.box-footer {
    padding-top: var(--space-md);
}

/* Info boxes: neutral, readable numbers (color carries no meaning here) */
.info-box {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    min-height: 4.5rem;
    margin-bottom: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    color: var(--ink);
    background: var(--surface) !important;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.info-box-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 2.5rem;
    height: 2.5rem;
    font-size: var(--text-lg);
    color: var(--ink-2);
    background: var(--surface-sunken) !important;
    border-radius: var(--radius);
}
.info-box-text {
    display: block;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--ink-3);
}
.info-box-number {
    display: block;
    font-size: var(--text-lg);
    font-weight: 700;
}
.info-box .progress,
.info-box .progress-description {
    display: none;
}

/* Labels → status pills */
.label {
    display: inline-block;
    padding: 0.0625rem 0.5rem;
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.5;
    color: var(--ink-2);
    background: var(--surface-sunken);
    border-radius: var(--radius-sm);
}
.label-success { color: var(--ok-ink); background: var(--ok-bg); }
.label-danger { color: var(--bad-ink); background: var(--bad-bg); }
.label-warning { color: var(--warn-ink); background: var(--warn-bg); }
.label-info,
.label-primary { color: var(--accent-ink); background: var(--accent-soft); }

/* Bootstrap 3 utilities */
.pull-right { float: right; }
.pull-left { float: left; }
.hidden { display: none !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
@media (max-width: 575.98px) {
    .col-xs-12 { flex: 0 0 auto; width: 100%; }
}
.btn-xs {
    --bs-btn-padding-y: 0.125rem;
    --bs-btn-padding-x: 0.375rem;
    --bs-btn-font-size: var(--text-xs);
}
.btn-default {
    --bs-btn-color: var(--ink-2);
    --bs-btn-bg: var(--surface);
    --bs-btn-border-color: var(--line-strong);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-bg: var(--surface-hover);
    --bs-btn-hover-border-color: var(--line-strong);
}
.btn-success,
.btn-info {
    --bs-btn-color: var(--surface);
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-color: var(--surface);
    --bs-btn-hover-bg: var(--accent-hover);
    --bs-btn-hover-border-color: var(--accent-hover);
}
/* Baked forms pass class "btn-success" without "btn": give the save button the primary look */
.btn-success:not(.btn),
.btn-info:not(.btn) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.4375rem 1rem;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--surface);
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
}
.btn-success:not(.btn):hover,
.btn-info:not(.btn):hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}
/* Per-row delete buttons in baked lists: destructive meaning stays (red icon), without a wall of red blocks */
.actions .btn-danger {
    --bs-btn-color: var(--bad-ink);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--bad-ink);
    --bs-btn-hover-bg: var(--bad-bg);
    --bs-btn-hover-border-color: transparent;
}
.form-group { margin-bottom: var(--space-md); }
.control-label { margin-bottom: var(--space-2xs); font-weight: 500; }
.help-block { display: block; margin-top: var(--space-2xs); font-size: var(--text-xs); color: var(--bad-ink); }
.has-error .form-control { border-color: var(--bad-ink); }
select.form-control {
    appearance: auto;
}

/* Baked "view" pages */
.subheader {
    margin: var(--space-md) 0 var(--space-2xs);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--ink-3);
}
.subheader:first-child { margin-top: 0; }
.nav-stacked { flex-direction: column; }
.nav-pills > li > a {
    display: block;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius);
    text-decoration: none;
}
.nav-pills > li.active > a {
    color: var(--accent-ink);
    background: var(--accent-soft);
}
.table { --bs-table-bg: var(--surface); font-size: var(--text-sm); }
.table > thead th { font-size: var(--text-xs); font-weight: 600; color: var(--ink-3); }

/* Bootstrap 3 pagination markup (<li><a>) */
.pagination > li > a,
.pagination > li > span {
    display: block;
    padding: 0.375rem 0.75rem;
    margin-left: -1px;
    color: var(--ink-2);
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--line-strong);
}
.pagination > li:first-child > a { border-radius: var(--radius) 0 0 var(--radius); }
.pagination > li:last-child > a { border-radius: 0 var(--radius) var(--radius) 0; }
.pagination > li.active > a { color: var(--surface); background: var(--accent); border-color: var(--accent); }
.pagination > li.disabled > a { color: var(--ink-3); pointer-events: none; }

/* Glyphicons and Font Awesome 4 names still used in templates → Bootstrap Icons */
.glyphicon,
.fa {
    display: inline-block;
    font-family: "bootstrap-icons" !important;
    font-style: normal;
    font-weight: normal !important;
    line-height: 1;
    vertical-align: -0.125em;
    -webkit-font-smoothing: antialiased;
}
.glyphicon-trash::before { content: "\f5de"; }
.glyphicon-zoom-in::before { content: "\f62c"; }
.glyphicon-pencil::before { content: "\f4cb"; }
.glyphicon-print::before { content: "\f501"; }
.glyphicon-play-circle::before { content: "\f4f3"; }
.glyphicon-lock::before { content: "\f47b"; }
.glyphicon-thumbs-down::before { content: "\f405"; }
.glyphicon-heart::before { content: "\f417"; }
.fa-calendar::before { content: "\f214"; }
.fa-times::before { content: "\f659"; }
.fa-minus::before { content: "\f63b"; }
.fa-dashboard::before { content: "\f580"; }
.fa-video-camera::before { content: "\f21f"; }
.fa-users::before { content: "\f4d0"; }
.fa-space-shuttle::before { content: "\f846"; }
.fa-magic::before { content: "\f675"; }
.fa-heart::before { content: "\f417"; }
.fa-film::before { content: "\f3c3"; }
.fa-book::before { content: "\f194"; }

/* Baked record pages: long values (names, URLs) wrap instead of widening the page on phones */
.panel-body p,
.panel-body td,
.box-body td {
    overflow-wrap: anywhere;
}

/* Baked edit forms: readable line length and clear sections */
.app-main form:has(fieldset) {
    max-width: 48rem;
}
.app-main form fieldset {
    margin-top: var(--space-xl);
}
.app-main form legend {
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-xs);
    font-size: var(--text-md);
    font-weight: 600;
    border-bottom: 1px solid var(--line);
}

/* Baked lists: give the table the same frame as the rebuilt data panels */
.app-main .table-responsive:has(> .table) {
    margin-bottom: var(--space-md);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.app-main .table-responsive > .table {
    margin-bottom: 0;
}
.app-main .table-responsive > .table > :not(caption) > * > * {
    padding: var(--space-sm) var(--space-md);
    vertical-align: middle;
}
.app-main .table-responsive > .table tr:last-child > td {
    border-bottom: 0;
}
/* A single page needs no pager or "Página 1 de 1" */
.paginator:not(:has(a[href])) {
    display: none;
}

/* Baked pages put the title straight above their panels: give it the same gap as .page-head */
.page-title:not(.page-head .page-title, .page-title-row .page-title, .film-head .page-title, .login-panel .page-title):not(:has(+ .page-meta)) {
    margin-bottom: var(--space-lg);
}
