/* PanelWeb1 · Visual Refresh v1.1.30
   SOLO PRESENTACION. No altera rutas, datos, CheckUser, APK ni motores. */

:root {
  --vr-sidebar-width: 260px;
  --vr-mobile-sidebar: min(88vw, 330px);
  --vr-radius: 16px;
  --vr-gap: 14px;
  --vr-border: rgba(127, 127, 127, .22);
  --vr-shadow: 0 14px 34px rgba(0, 0, 0, .18);
}

html,
body {
  min-width: 0;
  max-width: 100%;
}

body.panel-page {
  overflow-x: hidden;
}

body.panel-page main.d-flex,
body.panel-page main.d-flex > .container-fluid,
body.panel-page .content,
body.panel-page .card,
body.panel-page .card-body {
  min-width: 0;
}

/* Desktop: un poco mas de aire, sin cambiar la identidad del Panel1. */
@media (min-width: 992px) {
  body.panel-page .content {
    padding: 14px 16px 16px;
  }

  body.panel-page .content > .card {
    border-radius: var(--vr-radius);
    box-shadow: var(--vr-shadow) !important;
  }

  body.panel-page .header {
    min-height: 58px;
    align-items: center;
    padding-inline: 10px;
  }

  body.panel-page .table-responsive,
  body.panel-page .table-responsive-md {
    border-radius: 12px;
  }
}

/* Botones/controles: misma logica, mejor tacto y alineacion. */
body.panel-page .btn,
body.panel-page .form-control,
body.panel-page .form-select,
body.panel-page .input-group-text {
  min-height: 42px;
}

body.panel-page .btn-sm {
  min-height: 34px;
}

body.panel-page .modal-content {
  border-radius: 16px;
  overflow: hidden;
}

body.panel-page .modal-body {
  overscroll-behavior: contain;
}

/* Sidebar movil real: flotante, sin empujar el contenido. */
@media (max-width: 991.98px) {
  body.panel-page main.d-flex {
    display: block !important;
    width: 100%;
  }

  body.panel-page main.d-flex > .container-fluid {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }

  body.panel-page .sidebar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    width: var(--vr-mobile-sidebar) !important;
    max-width: 330px !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    margin-left: 0 !important;
    padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)) !important;
    transform: translate3d(-105%, 0, 0);
    transition: transform .24s ease, box-shadow .24s ease !important;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
    z-index: 2050 !important;
    box-shadow: none;
  }

  body.panel-page .sidebar.active {
    transform: translate3d(0, 0, 0);
    box-shadow: 18px 0 50px rgba(0, 0, 0, .45);
  }

  body.panel-page .sidebar-nav {
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding-right: 3px;
  }

  body.panel-page .sidebar-header {
    flex: 0 0 auto;
    margin-bottom: 10px;
    padding-bottom: 14px;
  }

  body.panel-page .nav-link {
    min-height: 46px;
    padding: 10px 12px;
    border-radius: 10px;
  }

  body.panel-page .nav-item a > i {
    font-size: 1.15rem;
    flex: 0 0 26px;
    text-align: center;
  }

  body.panel-page .header {
    position: sticky;
    top: 0;
    z-index: 900;
    min-height: 62px;
    padding: 8px 10px;
    align-items: center;
    background: var(--bs-body-bg, #1f2225);
    border-bottom: 1px solid var(--vr-border);
  }

  body.panel-page .header button#openNav {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0;
  }

  body.panel-page .header a {
    min-height: 42px;
    margin: 0 0 0 5px;
    padding: 5px 8px;
  }

  body.panel-page .content {
    height: auto !important;
    min-height: calc(100dvh - 62px);
    padding: 12px !important;
    overflow: visible !important;
  }

  body.panel-page .content > .card {
    min-height: calc(100dvh - 86px);
    height: auto !important;
    overflow: visible !important;
    border-radius: 14px;
  }

  body.panel-page .content > .card > .card-body {
    padding: 14px !important;
  }

  body.panel-page h1.h3,
  body.panel-page .content h1 {
    font-size: clamp(1.35rem, 6vw, 1.75rem) !important;
    margin-bottom: 1rem !important;
  }

  body.panel-page .modal-dialog {
    margin: 8px auto !important;
    width: calc(100% - 16px) !important;
    max-width: 680px !important;
  }

  body.panel-page .modal-content {
    max-height: calc(100dvh - 16px);
  }

  body.panel-page .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.panel-page .row {
    --bs-gutter-x: .8rem;
  }
}

/* CONFIGURACIONES: en celular la tabla se convierte en tarjetas legibles. */
@media (max-width: 767.98px) {
  body.page-configs .card-body > .d-md-flex.justify-content-between {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  body.page-configs .card-body > .d-md-flex.justify-content-between > * {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  body.page-configs .card-body > .d-md-flex.justify-content-between .d-flex {
    min-width: 0 !important;
  }

  body.page-configs .config-status {
    width: 122px !important;
    min-width: 122px;
  }

  body.page-configs .search-config {
    flex: 1 1 auto;
    min-width: 0;
  }

  body.page-configs .card-body > .d-md-flex.justify-content-between > .d-flex.flex-column:last-child > .d-flex {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-width: 0 !important;
    margin: 0 0 8px !important;
  }

  body.page-configs .card-body > .d-md-flex.justify-content-between > .d-flex.flex-column:last-child .btn {
    width: 100% !important;
    margin: 0 !important;
    min-width: 0;
    padding-inline: 8px;
  }

  body.page-configs #root .table-responsive-md,
  body.page-configs #root .table-responsive {
    overflow: visible !important;
    height: auto !important;
  }

  body.page-configs #root table {
    display: block;
    width: 100%;
    margin: 0;
  }

  body.page-configs #root thead {
    display: none;
  }

  body.page-configs #root tbody {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  body.page-configs #root tbody tr {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 12px;
    padding: 14px 12px 12px 44px;
    border: 1px solid var(--vr-border);
    border-radius: 14px;
    background: rgba(127, 127, 127, .055);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
  }

  body.page-configs #root tbody td {
    display: block !important;
    width: auto !important;
    min-width: 0;
    padding: 2px 0 !important;
    border: 0 !important;
    white-space: normal !important;
    text-align: left !important;
  }

  body.page-configs #root tbody td::before {
    display: block;
    margin-bottom: 3px;
    font-size: .68rem;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    opacity: .58;
  }

  body.page-configs #root tbody td:nth-child(1) {
    position: absolute;
    left: 14px;
    top: 16px;
  }
  body.page-configs #root tbody td:nth-child(1)::before { content: none; }
  body.page-configs #root tbody td:nth-child(2)::before { content: "ID"; }
  body.page-configs #root tbody td:nth-child(3) {
    grid-column: 1 / -1;
    font-size: 1rem;
    font-weight: 700;
  }
  body.page-configs #root tbody td:nth-child(3)::before { content: "Nombre"; }
  body.page-configs #root tbody td:nth-child(4)::before { content: "Categoría"; }
  body.page-configs #root tbody td:nth-child(5)::before { content: "Orden"; }
  body.page-configs #root tbody td:nth-child(6)::before { content: "Modo"; }
  body.page-configs #root tbody td:nth-child(7)::before { content: "Estado"; }
  body.page-configs #root tbody td:nth-child(8) {
    grid-column: 1 / -1;
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding-top: 7px !important;
    border-top: 1px solid var(--vr-border) !important;
  }
  body.page-configs #root tbody td:nth-child(8)::before { content: "Acciones"; margin-right: auto; }
  body.page-configs #root tbody td:nth-child(8) .btn {
    width: 42px;
    min-width: 42px;
    height: 40px;
    margin: 0 !important;
  }

  body.page-configs #root tbody td:nth-child(5) > div,
  body.page-configs #root tbody td:nth-child(7) > div {
    justify-content: flex-start !important;
  }

  body.page-configs .config-not-found h4 {
    white-space: normal !important;
    text-align: center;
  }
}

/* MI APLICACION: preview centrado y acciones compactas. */
@media (max-width: 767.98px) {
  body.page-application .card-body > .d-md-flex.justify-content-between {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  body.page-application .card-body > .d-md-flex.justify-content-between > * {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  body.page-application .card-body > .d-md-flex.justify-content-between > .d-flex.flex-column > .d-flex {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-width: 0 !important;
    margin: 0 0 8px !important;
  }

  body.page-application .card-body > .d-md-flex.justify-content-between .btn {
    width: 100% !important;
    margin: 0 !important;
    white-space: normal;
    line-height: 1.15;
  }

  body.page-application #app.center-column {
    width: 100%;
    max-width: 430px;
    margin: 8px auto 24px !important;
    padding: 0;
    align-items: center !important;
  }

  body.page-application #app.center-column > * {
    max-width: 100%;
  }

  body.page-application .app-modal-content {
    max-width: calc(100vw - 28px) !important;
  }
}

/* Paginas administrativas nuevas: evitar cortes en telefono. */
@media (max-width: 767.98px) {
  body.page-admin-clients .clients-excel-toolbar,
  body.page-admin-maintenance .maintenance-toolbar {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }
}
@media (max-width: 991.98px) {
  body.panel-page .sidebar.active {
    box-shadow: 14px 0 42px rgba(0,0,0,.45), 0 0 0 100vmax rgba(0,0,0,.38) !important;
  }
}
