/*
 * MAXIMUS SOLUTIONS — Responsive CSS
 * Arquivo: portal/assets/css/responsive.css
 * Complementa o app.css sem alterá-lo.
 */

/* ═══════════════════════════════════════════════════════════
   TABLET (≤ 1024px)
═══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {

  .kpi-grid { grid-template-columns: repeat(2,1fr) !important; }
  .row2 { grid-template-columns: 1fr !important; }
  .list-toolbar { flex-wrap: wrap !important; gap: 8px !important; }
  .mfg { grid-template-columns: 1fr !important; }

  .modal-overlay .modal,
  .modal-overlay > div[style*="max-width"] {
    max-width: 95vw !important;
    width: 95vw !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE (≤ 768px)
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── LOGIN ─────────────────────────────────────────── */
  .screen-login { align-items: flex-start !important; }

  .login-split {
    flex-direction: column !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    min-height: 100vh;
    box-shadow: none !important;
  }

  .login-left {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 1rem 1.25rem !important;
    gap: 12px !important;
    min-height: auto !important;
  }

  .ll-icon {
    width: 40px !important; height: 40px !important;
    flex-shrink: 0;
  }
  .ll-icon span { font-size: 20px !important; }
  .ll-brand .nm { font-size: 16px !important; }
  .ll-brand .sb { font-size: 9px !important; }
  .ll-tag, .ll-dots { display: none !important; }

  .login-right {
    padding: 1.5rem !important;
    flex: 1;
  }

  /* ── HEADER ────────────────────────────────────────── */
  .app-hdr {
    padding: 0 10px !important;
    gap: 8px !important;
  }

  /* Esconde texto MAXIMUS / SOLUTIONS no header */
  .hdr-logo .tx,
  .hdr-logo .ss { display: none !important; }

  /* Esconde nome e cargo do usuário */
  .hdr-usr .un,
  .hdr-usr .ur { display: none !important; }

  /* Botão sair: só ícone */
  .btn-out { padding: 6px 8px !important; font-size: 0 !important; }
  .btn-out i { font-size: 18px !important; }

  /* ── SIDEBAR — MODO SOMENTE ÍCONES ────────────────── */
  .sidebar {
    width: 56px !important;
    min-width: 56px !important;
    padding: 0.5rem 0 !important;
    overflow: visible !important;
  }

  /* Seções: sem padding lateral */
  .sidebar .sb-sec {
    padding: 0 6px !important;
    margin-bottom: 0 !important;
  }

  /* Label de seção: oculta */
  .sidebar .sb-lbl { display: none !important; }

  /* Item de menu: centraliza, esconde texto via font-size:0 */
  .sidebar .ni {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 11px 0 !important;
    gap: 0 !important;
    font-size: 0 !important;       /* oculta text nodes */
    color: rgba(255,255,255,.65) !important;
    border-radius: 8px !important;
    position: relative !important;
    margin-bottom: 2px !important;
  }

  /* Restaura tamanho do ícone */
  .sidebar .ni i {
    font-size: 20px !important;
    min-width: auto !important;
  }

  /* Badge: reposiciona */
  .sidebar .ni .bdg {
    position: absolute !important;
    top: 4px !important; right: 4px !important;
    margin-left: 0 !important;
    font-size: 9px !important;
    padding: 1px 4px !important;
    min-width: 15px !important;
  }

  /* Tooltip ao tocar: mostra nome do item */
  .sidebar .ni::after {
    content: attr(data-tip);
    position: absolute;
    left: 62px;
    top: 50%;
    transform: translateY(-50%);
    background: #0F2870;
    color: #fff;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px !important;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
    transition: opacity 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
  }
  .sidebar .ni:hover::after,
  .sidebar .ni:active::after { opacity: 1; }

  /* Rodapé sidebar */
  .sidebar .sb-foot {
    padding: 0 6px 0.5rem !important;
  }

  /* ── CONTEÚDO ──────────────────────────────────────── */
  .content {
    padding: 10px !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  /* Cabeçalho de página */
  .pg-top {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
    margin-bottom: 12px !important;
  }
  .pg-top h1 { font-size: 17px !important; }
  .pg-top > div:last-child {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .btn-novo { width: 100% !important; justify-content: center !important; }

  /* ── KPI GRID ──────────────────────────────────────── */
  .kpi-grid {
    grid-template-columns: repeat(2,1fr) !important;
    gap: 8px !important;
  }
  .kv { font-size: 20px !important; }

  /* ── TOOLBARS ──────────────────────────────────────── */
  .list-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  .list-search { width: 100% !important; }
  .list-filter { width: 100% !important; }

  /* ── TABELAS ───────────────────────────────────────── */
  .list-panel { overflow-x: auto !important; }
  .list-table { min-width: 560px !important; }
  .list-table th,
  .list-table td {
    padding: 7px 8px !important;
    font-size: 12px !important;
  }

  /* ── MODAIS ────────────────────────────────────────── */
  .modal-overlay {
    padding: 0 !important;
    align-items: flex-end !important;
  }
  .modal-overlay .modal,
  .modal-overlay > div[style*="max-width"] {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
    max-height: 92vh !important;
  }
  .del-overlay { padding: 12px !important; }
  .del-modal { width: 100% !important; max-width: 100% !important; }

  .modal-body {
    padding: 12px !important;
    max-height: calc(92vh - 110px) !important;
    overflow-y: auto !important;
  }
  .mfg { grid-template-columns: 1fr !important; gap: 10px !important; }
  .modal-ftr {
    padding: 10px 12px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .modal-ftr button {
    flex: 1 !important;
    justify-content: center !important;
  }

  /* ── CARDS DE TOTAIS (despesas) ────────────────────── */
  #desp-totais-grid {
    grid-template-columns: repeat(2,1fr) !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE PEQUENO (≤ 480px)
═══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

  .kpi-grid { grid-template-columns: 1fr !important; }
  #desp-totais-grid { grid-template-columns: 1fr !important; }
  .content { padding: 8px !important; }
  .modal-overlay .modal { max-height: 96vh !important; }
  .list-table th,
  .list-table td { font-size: 11px !important; padding: 5px 6px !important; }
}

/* ═══════════════════════════════════════════════════════════
   TOUCH — aumenta área clicável
═══════════════════════════════════════════════════════════ */
@media (hover: none) and (pointer: coarse) {

  .sidebar .ni { min-height: 44px !important; }

  .btn-edit, .btn-del, .btn-novo,
  .btn-save2, .btn-cancel2, .lf-btn {
    min-height: 42px !important;
  }

  /* font-size 16px evita zoom automático no iOS */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="date"],
  input[type="tel"],
  select,
  textarea {
    font-size: 16px !important;
  }
}
