/* Мелкие твики поверх AdminLTE 3. */

/* чтобы плитки small-box не были слишком высокими */
.small-box > .inner h3 {
  font-size: 1.75rem;
}

/* таблицы — чуть плотнее */
.table td, .table th {
  padding: 0.5rem 0.75rem;
  vertical-align: middle;
}

/* бейдж версии */
.badge.badge-success, .badge.badge-warning, .badge.badge-info, .badge.badge-dark, .badge.badge-danger {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25em 0.55em;
}

/* ───────────────────────────────────────────────────────────────────────
   Мобилка: таблица .table-mobile-cards превращается в карточки на <768px.
   На каждой <td> ставим data-label="..." — оно становится подписью слева.
   Десктоп не трогаем — все правила внутри @media.
   ─────────────────────────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .table-mobile-cards thead { display: none; }
  .table-mobile-cards,
  .table-mobile-cards tbody,
  .table-mobile-cards tr { display: block; width: 100%; }

  .table-mobile-cards tbody tr {
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    margin: 0 0 0.5rem;
    padding: 0.25rem 0.75rem;
    background: #fff;
  }
  /* table-striped не работает на display:block — эмулируем */
  .table-mobile-cards.table-striped tbody tr:nth-of-type(even) {
    background: #f8f9fa;
  }

  .table-mobile-cards td {
    display: block;
    position: relative;
    padding: 0.5rem 0 0.5rem 42%;
    border: none;
    border-bottom: 1px solid #f1f3f5;
    text-align: right;
    min-height: 36px;
    line-height: 1.3;
  }
  .table-mobile-cards td:last-child { border-bottom: none; }

  .table-mobile-cards td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    top: 0.5rem;
    width: 40%;
    text-align: left;
    color: #6c757d;
    font-size: 0.8125rem;
    font-weight: 500;
  }
  /* td без data-label (колонка действий / пустое состояние colspan) — full-width, центр */
  .table-mobile-cards td:not([data-label]) { padding-left: 0; text-align: center; }
  .table-mobile-cards td:not([data-label])::before { content: ''; }

  /* Тач-таргет ≥44px для action-кнопок в карточке */
  .table-mobile-cards .btn-sm { min-width: 44px; min-height: 44px; padding: 0.5rem; }
}

/* ───────────────────────────────────────────────────────────────────────
   Кастомная мобильная карточка для ads (13 колонок — generic не подходит).
   Десктоп: показываем .ads-table-desktop, скрываем .ads-mobile-list.
   Мобилка: наоборот. Парный блок рендерится в partials/tables/ads.ejs
   и partials/profile/ads.ejs.
   ─────────────────────────────────────────────────────────────────────── */
.ads-mobile-list { display: none; }
@media (max-width: 767.98px) {
  .ads-table-desktop { display: none !important; }
  .ads-mobile-list { display: block; }

  .ads-mobile-list .ads-card {
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
    background: #fff;
    overflow: hidden;
  }
  .ads-mobile-list .ads-card.is-running   { border-left: 3px solid #28a745; }
  .ads-mobile-list .ads-card.is-highlight { border-left: 3px solid #ffc107; background: #fffbeb; }

  .ads-mobile-list .ads-card-head {
    display: flex;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    align-items: flex-start;
    border-bottom: 1px solid #f1f3f5;
  }
  .ads-mobile-list .ads-card-head .photo,
  .ads-mobile-list .ads-card-head .no-photo {
    flex: 0 0 50px;
    width: 50px; height: 66px;
    object-fit: cover;
    border-radius: 0.2rem;
  }
  .ads-mobile-list .ads-card-head .no-photo {
    background: #f5f5f5; color: #dc3545;
    display: flex; align-items: center; justify-content: center;
  }
  .ads-mobile-list .ads-card-head .head-info { flex: 1 1 auto; min-width: 0; }
  .ads-mobile-list .ads-card-head .head-id {
    display: flex; justify-content: space-between; align-items: center;
    gap: 0.4rem; margin-bottom: 0.2rem;
    font-weight: 600; font-size: 1rem;
  }
  .ads-mobile-list .ads-card-head .head-meta {
    font-size: 0.82rem; color: #6c757d; line-height: 1.4;
  }
  .ads-mobile-list .ads-card-head .head-meta > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .ads-mobile-list .ads-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid #f1f3f5;
  }
  .ads-mobile-list .ads-card-stats > div { padding: 0.5rem 0.25rem; text-align: center; }
  .ads-mobile-list .ads-card-stats > div + div { border-left: 1px solid #f1f3f5; }
  .ads-mobile-list .ads-card-stats .stat-label {
    font-size: 0.7rem; color: #6c757d;
    text-transform: uppercase; letter-spacing: 0.4px;
    margin-bottom: 0.1rem;
  }
  .ads-mobile-list .ads-card-stats .stat-value { font-weight: 600; font-size: 0.95rem; }

  .ads-mobile-list .ads-card-foot {
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem; color: #6c757d; line-height: 1.5;
  }
  .ads-mobile-list .ads-card-foot .foot-row {
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.4rem;
  }
}

/* ───────────────────────────────────────────────────────────────────────
   Мобильные карточки для /users и /profiles (та же идея что у .ads-card).
   Парный блок (desktop table + mobile cards), CSS переключает по ширине.
   Класс .entity-card используется обоими — стили общие.
   ─────────────────────────────────────────────────────────────────────── */
.users-mobile-list, .profiles-mobile-list { display: none; }
@media (max-width: 767.98px) {
  .users-table-desktop, .profiles-table-desktop { display: none !important; }
  .users-mobile-list, .profiles-mobile-list { display: block; }

  .entity-card {
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
    background: #fff;
    overflow: hidden;
  }
  .entity-card.is-running   { border-left: 3px solid #28a745; }
  .entity-card.is-warning   { border-left: 3px solid #ffc107; }
  .entity-card.is-archived  { border-left: 3px solid #adb5bd; opacity: .85; }
  .entity-card.is-danger    { border-left: 3px solid #dc3545; }

  .entity-card .ec-head {
    display: flex; gap: 0.6rem; padding: 0.6rem 0.75rem; align-items: flex-start;
  }
  .entity-card .ec-head + .ec-stats,
  .entity-card .ec-head + .ec-foot { border-top: 1px solid #f1f3f5; }
  .entity-card .ec-head .photo,
  .entity-card .ec-head .no-photo {
    flex: 0 0 50px; width: 50px; height: 66px; object-fit: cover; border-radius: 0.2rem;
  }
  .entity-card .ec-head .no-photo {
    background: #f5f5f5; color: #dc3545;
    display: flex; align-items: center; justify-content: center;
  }
  .entity-card .ec-head .head-info { flex: 1 1 auto; min-width: 0; }
  .entity-card .ec-head .head-id {
    display: flex; justify-content: space-between; align-items: center;
    gap: 0.4rem; margin-bottom: 0.2rem;
    font-weight: 600; font-size: 0.95rem;
  }
  .entity-card .ec-head .head-id .id-main {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0;
  }
  .entity-card .ec-head .head-meta {
    font-size: 0.82rem; color: #6c757d; line-height: 1.5;
  }
  .entity-card .ec-head .head-meta > div {
    display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center;
  }

  .entity-card .ec-stats {
    display: grid; grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid #f1f3f5;
  }
  .entity-card .ec-stats > div { padding: 0.5rem 0.25rem; text-align: center; }
  .entity-card .ec-stats > div + div { border-left: 1px solid #f1f3f5; }
  .entity-card .ec-stats .stat-label {
    font-size: 0.7rem; color: #6c757d;
    text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 0.1rem;
  }
  .entity-card .ec-stats .stat-value { font-weight: 600; font-size: 0.95rem; }

  .entity-card .ec-foot {
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem; color: #6c757d; line-height: 1.5;
    display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  }
  .entity-card .ec-foot .foot-actions { display: flex; gap: 0.25rem; flex: 0 0 auto; }
  .entity-card .ec-foot .foot-actions .btn { min-width: 38px; min-height: 38px; padding: 0.35rem 0.5rem; }
}
