/* =========================================================
   Estoque IC • app.css (SaaS Dashboard)
   - Sidebar fixa (desktop) / drawer (mobile)
   - Topbar + conteúdo
   - Cards, badges, tabelas, responsivo
   ========================================================= */

:root{
  --bg: #0b1220;            /* fundo lateral/top */
  --bg2:#0f1b33;
  --panel:#ffffff;          /* cards */
  --muted:#6b7280;
  --text:#0f172a;

  --blue:#2563eb;
  --blue2:#1d4ed8;
  --line: rgba(15,23,42,.08);

  --radius: 16px;

  --shadow: 0 12px 30px rgba(2,6,23,.08);
}

/* Reset leve */
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background:#f5f7fb;
  color:var(--text);
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,Arial;
}

/* ---------------------------------------------------------
   Layout principal
   --------------------------------------------------------- */

.app-wrap{
  display:flex;
  min-height:100vh;
}

/* Overlay usado no mobile para fechar sidebar */
.overlay{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.35);
  opacity:0;
  pointer-events:none;
  transition:.2s;
  z-index: 1040; /* abaixo da sidebar */
}
.overlay.show{
  opacity:1;
  pointer-events:auto;
}

/* Sidebar */
.sidebar{
  width: 280px;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  color:#e5e7eb;
  padding: 18px 14px;
  position: sticky;
  top:0;
  height:100vh;
  overflow:auto;
  border-right: 1px solid rgba(255,255,255,.08);
  z-index:1045;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  padding: 10px 10px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 12px;
}
.brand-badge{
  width:44px;
  height:44px;
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  display:flex;
  align-items:center;
  justify-content:center;
}

/* ✅ NOVO: garante que o logo.svg se ajuste corretamente */
.brand-badge img,
.brand-badge svg{
  width: 100%;
  height: 100%;
  object-fit: contain;
  display:block;
}

.brand-title{
  font-weight: 800;
  letter-spacing:.2px;
  font-size: 15px;
  line-height: 1.2;
}
.brand-sub{
  font-size: 12px;
  color: rgba(255,255,255,.7);
}

.side-nav{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding: 10px 6px;
}

/* Links do menu (shell.js deve montar usando <a>) */
.side-nav a{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: rgba(255,255,255,.85);
  text-decoration:none;
  transition: .15s;
}
.side-nav a:hover{
  background: rgba(255,255,255,.08);
  color:#fff;
}
.side-nav a.active{
  background: rgba(37,99,235,.25);
  outline: 1px solid rgba(37,99,235,.35);
  color:#fff;
}
.side-nav a i{
  width:20px;
  text-align:center;
  opacity:.95;
}

/* Área principal */
.main{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
}

/* Topbar */
.topbar{
  position: sticky;
  top:0;
  z-index: 1030;
  background: rgba(245,247,251,.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 16px 18px;
}

.page-title{
  margin:0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing:.2px;
}
.page-sub{
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.content{
  padding: 18px;
}

/* ---------------------------------------------------------
   Componentes
   --------------------------------------------------------- */

.card-soft{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.badge-soft{
  background: rgba(2,6,23,.04);
  border: 1px solid rgba(2,6,23,.06);
  color: #0f172a;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 999px;
}

.btn-sidemenu{
  border-radius: 12px !important;
}

/* Tabelas */
.table{
  margin-bottom:0;
}
.table thead th{
  font-size: 12px;
  text-transform: none;
  letter-spacing:.2px;
  color: #334155;
  border-bottom: 1px solid rgba(15,23,42,.08) !important;
}
.table td{
  vertical-align: middle;
}
.table-striped>tbody>tr:nth-of-type(odd)>*{
  background-color: rgba(2,6,23,.02);
}

/* Inputs */
.form-control, .form-select{
  border-radius: 12px;
}
.form-control:focus, .form-select:focus{
  border-color: rgba(37,99,235,.55);
  box-shadow: 0 0 0 .2rem rgba(37,99,235,.15);
}

/* Alert */
.alert{
  border-radius: 14px;
}

/* ---------------------------------------------------------
   Itens como cards (Entradas/Saídas)
   --------------------------------------------------------- */

.item-card{
  border:1px solid rgba(0,0,0,.08);
  border-radius:14px;
  padding:12px;
  background:#fff;
}
.item-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:10px;
}
.item-prod-name{
  font-weight:800;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.item-meta{
  font-size:.85rem;
  color:#6c757d;
}
.item-grid{
  display:grid;
  gap:10px;
}

/* Melhor espaçamento nos cards */
.item-card .btn{
  border-radius: 12px;
}
.item-card .form-control{
  border-radius: 12px;
}

/* ---------------------------------------------------------
   Modal (picker)
   --------------------------------------------------------- */
.modal-content{
  border-radius: 16px;
  border: 1px solid rgba(15,23,42,.08);
}
.modal-header{
  border-bottom: 1px solid rgba(15,23,42,.06);
}
.modal-footer{
  border-top: 1px solid rgba(15,23,42,.06);
}
.list-group-item{
  border-color: rgba(15,23,42,.06);
}

/* ---------------------------------------------------------
   Responsivo (mobile)
   --------------------------------------------------------- */

@media (min-width: 768px){
  .item-grid{
    grid-template-columns: 2fr 1fr 1fr;
    align-items:end;
  }
}

@media (max-width: 992px){
  .topbar-inner{
    flex-wrap:wrap;
    gap:.75rem;
  }
  .page-title{ font-size: 18px; }
  .content{ padding: 12px; }
  .card-soft{ border-radius: 14px; box-shadow: 0 10px 22px rgba(2,6,23,.07); }

  /* sidebar vira drawer */
  .sidebar{
    position: fixed;
    left: -290px;
    top: 0;
    height: 100vh;
    transition: .2s;
    box-shadow: 0 16px 40px rgba(0,0,0,.25);
  }
  .sidebar.open{
    left: 0;
  }
}

/* Pequenas melhorias em telas bem pequenas */
@media (max-width: 420px){
  .badge-soft{ display:none; }
  .topbar-inner{ padding: 12px; }
  .content{ padding: 10px; }
  .brand-title{ font-size: 14px; }
}

/* ---------------------------------------------------------
   Utilitários
   --------------------------------------------------------- */
.text-secondary{ color: var(--muted) !important; }
.fw-semibold{ font-weight: 700; }
