/* Kody mobile layer. Desktop remains controlled by main/css/style.css. */

.kody-mobile-nav {
  display: none;
}

@media (max-width: 767px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
  }

  body {
    padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    background: #f8f9fa !important;
  }

  .preloader {
    z-index: 99999;
  }

  .topbar {
    min-height: 58px;
    z-index: 1040;
  }

  .topbar .top-navbar {
    min-height: 58px;
    padding: 0 12px !important;
  }

  .navbar-header {
    display: flex !important;
    width: auto !important;
    min-width: 0;
  }

  .navbar-brand img {
    max-height: 42px !important;
  }

  .topbar .navbar-collapse {
    min-width: 0;
  }

  .sucursal-badge {
    display: none;
  }

  .profile-pic {
    width: 36px;
    height: 36px;
  }

  .left-sidebar {
    position: fixed;
    top: 58px;
    left: -260px;
    width: 250px;
    height: calc(100dvh - 58px);
    z-index: 1035;
    transition: left 0.2s ease;
    overflow-y: auto;
  }

  .show-sidebar .left-sidebar {
    left: 0;
  }

  .mini-sidebar .page-wrapper,
  .page-wrapper {
    margin-left: 0 !important;
    padding-top: 68px !important;
  }

  .container-fluid {
    padding-left: 12px;
    padding-right: 12px;
  }

  .page-titles {
    margin: 0 -12px 16px;
    padding: 14px 12px;
  }

  .page-titles h3 {
    font-size: 1.15rem;
    line-height: 1.25;
  }

  .breadcrumb {
    white-space: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .card,
  .kody-card,
  .metric-card {
    border-radius: 8px !important;
    margin-bottom: 14px;
  }

  .card-body {
    padding: 16px !important;
  }

  .btn,
  button,
  .form-control,
  select.form-control {
    min-height: 44px;
  }

  .btn {
    white-space: normal;
  }

  .form-group {
    margin-bottom: 14px;
  }

  .form-control,
  .select2-container .select2-selection--single {
    font-size: 16px !important;
  }

  .select2-container {
    width: 100% !important;
  }

  .table-responsive {
    margin-left: -4px;
    margin-right: -4px;
    padding: 0 4px 8px;
    -webkit-overflow-scrolling: touch;
  }

  .table-responsive::after {
    content: "Desliza para ver mas";
    display: block;
    color: #8b95a1;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 6px 2px 0;
  }

  .table-responsive .kody-table,
  .table-responsive .table {
    min-width: 680px;
  }

  .dataTables_wrapper .row {
    margin-left: 0;
    margin-right: 0;
  }

  .dataTables_filter,
  .dataTables_length,
  .dataTables_info,
  .dataTables_paginate {
    width: 100%;
    text-align: left !important;
  }

  .dataTables_filter input {
    width: 100% !important;
    margin-left: 0 !important;
    margin-top: 6px;
  }

  .modal-dialog {
    margin: 10px;
  }

  .modal-dialog-centered {
    min-height: calc(100dvh - 20px);
  }

  .modal-content {
    border-radius: 8px !important;
  }

  .modal-body {
    max-height: calc(100dvh - 170px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .footer {
    display: none;
  }

  .kody-mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1042;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 2px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid rgba(102, 34, 207, 0.12);
    box-shadow: 0 -10px 28px rgba(0,0,0,0.08);
    backdrop-filter: blur(14px);
  }

  .kody-mobile-nav a {
    min-width: 0;
    min-height: 54px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #636e72;
    text-decoration: none !important;
    border-radius: 8px;
    font-size: 0.68rem;
    font-weight: 800;
  }

  .kody-mobile-nav a i {
    font-size: 1.2rem;
    line-height: 1;
  }

  .kody-mobile-nav a:active,
  .kody-mobile-nav a:hover {
    background: rgba(102, 34, 207, 0.08);
    color: #6622cf;
  }

  .kody-onboarding-float {
    bottom: calc(86px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .chat-footer {
    padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .kody-chat-container {
    height: calc(100dvh - 150px) !important;
    border-radius: 8px !important;
  }
}

@media (max-width: 420px) {
  .page-titles .col-4,
  .page-titles .col-8 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .page-titles .justify-content-end {
    justify-content: flex-start !important;
    margin-top: 10px;
  }

  .kody-mobile-nav a {
    font-size: 0.62rem;
  }
}
