/* detail.css — drawer de detalhamento (slide-in desktop / bottom-sheet mobile) */

/* ── Overlay escuro ── */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,12,28,.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, visibility .3s;
}

body.detail-open .detail-overlay {
  opacity: 1;
  visibility: visible;
}

/* ── Drawer (desktop: painel lateral direito) ── */
.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 65vw;
  max-width: 1000px;
  height: 100vh;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  transition: transform .38s cubic-bezier(.22,1,.36,1);
  pointer-events: none;
}

.detail-drawer.open {
  transform: translateX(0);
  pointer-events: all;
}

/* ── Painel interno (glass) ── */
.detail-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface, rgba(255,255,255,.85));
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-left: 1px solid var(--lg-border, rgba(255,255,255,.7));
  box-shadow: -8px 0 48px rgba(0,0,0,.18);
  overflow: hidden;
}

/* Alça de arrasto (visível só no mobile) */
.detail-handle {
  display: none;
  width: 40px; height: 4px;
  background: rgba(0,0,0,.18);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

[data-theme="dark"] .detail-handle { background: rgba(255,255,255,.22); }

/* ── Banner colorido ── */
.detail-drawer .section-banner {
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 18px;
}

/* ── Tabs ── */
.detail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-dim);
  background: var(--surface2, rgba(248,249,252,.6));
  padding: 0 16px;
  flex-shrink: 0;
}

.detail-tab-btn {
  padding: 11px 18px;
  font-size: .83rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.detail-tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* ── Área de conteúdo (rolável) ── */
.detail-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.detail-content .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.detail-content .data-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* ── Fechar ── */
.detail-close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,.22);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  transition: background .15s;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.detail-close:hover { background: rgba(255,255,255,.38); }

/* ── Contador de registros ── */
.detail-count {
  font-size: .74rem;
  color: rgba(255,255,255,.78);
  white-space: nowrap;
  order: -1;
  width: 100%;
}

/* ── Vazio ── */
.detail-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
}

/* ════════════════════════════════════════
   MOBILE: bottom sheet
════════════════════════════════════════ */
@media (max-width: 900px) {
  .detail-drawer {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: 88vh;
    transform: translateY(105%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
  }

  .detail-drawer.open { transform: translateY(0); }

  .detail-panel {
    border-left: none;
    border-top: 1px solid var(--lg-border);
    box-shadow: 0 -8px 48px rgba(0,0,0,.18);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .detail-handle { display: block; }

  .detail-count { order: 0; width: auto; }
}

@media (max-width: 540px) {
  .detail-drawer { height: 92vh; }

  .detail-tab-btn { padding: 10px 12px; font-size: .79rem; }

  .detail-drawer .section-banner { padding: 12px 14px; }
  .detail-drawer .banner-actions { gap: 6px; }
  .detail-drawer .btn-export { height: 28px; padding: 0 10px; font-size: .72rem; }
  .detail-drawer .detail-close { width: 28px; height: 28px; font-size: 1rem; }
}
