/* ============================================
   MR Engenharia e Soluções Industriais
   Painel Administrativo
   Cor principal: Laranja #F14E1C
   Grafite: #1A1A1A | Branco: #FFFFFF
   Font: Barlow (igual à logo)
   ============================================ */

:root {
  --orange: #F14E1C;
  --orange-dark: #d43e12;
  --orange-light: #fde8e2;
  --dark: #1A1A1A;
  --dark-2: #2a2a2a;
  --dark-3: #333333;
  --sidebar-w: 230px;
  --topbar-h: 56px;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
  --green: #22c55e;
  --green-light: #dcfce7;
  --red: #ef4444;
  --red-light: #fee2e2;
  --blue: #3b82f6;
  --blue-light: #dbeafe;
  --yellow: #eab308;
  --yellow-light: #fef9c3;
  --radius: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,.08);
  --font: 'Barlow', sans-serif;
  --font-cond: 'Barlow Condensed', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: var(--font); background: var(--gray-50); color: var(--gray-800); line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 1rem; }
img { display: block; max-width: 100%; }

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--dark);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-logo {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo img {
  width: 140px;
  height: auto;
  display: block;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--gray-400);
  font-size: .9rem;
  font-weight: 500;
  transition: background .18s, color .18s;
}
.nav-item svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.07); color: var(--white); }
.nav-item.active { background: var(--orange); color: var(--white); }
.nav-item.active svg { fill: var(--white); }

/* Footer */
.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.logout-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--gray-400);
  font-size: .9rem; font-weight: 500;
  background: none;
  transition: background .18s, color .18s;
}
.logout-btn svg { width: 18px; height: 18px; fill: currentColor; }
.logout-btn:hover { background: rgba(239,68,68,.15); color: var(--red); }

/* ---- MAIN WRAP ---- */
.main-wrap {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- TOPBAR ---- */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.menu-toggle { display: none; background: none; padding: 4px; border-radius: 6px; }
.menu-toggle svg { width: 22px; height: 22px; fill: var(--gray-600); }
.page-title {
  font-family: var(--font-cond);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--dark);
  letter-spacing: .3px;
  flex: 1;
}
/* Linha laranja no topo */
.topbar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--orange);
}
.topbar-right { margin-left: auto; }
.user-info { font-size: .85rem; color: var(--gray-600); font-weight: 500; }

/* ---- MAIN CONTENT ---- */
.main-content { padding: 24px; flex: 1; }

/* ---- ALERTS ---- */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: .9rem; font-weight: 500; margin-bottom: 18px; }
.alert-success { background: var(--green-light); color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: var(--red-light);   color: #991b1b; border: 1px solid #fecaca; }

/* ---- CARDS DE STATS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  border-left: 4px solid var(--orange);
}
.stat-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.orange { background: var(--orange-light); }
.stat-icon.orange svg { fill: var(--orange); }
.stat-icon.green  { background: var(--green-light); }
.stat-icon.green svg { fill: #166534; }
.stat-icon.blue   { background: var(--blue-light); }
.stat-icon.blue svg { fill: #1d4ed8; }
.stat-icon.dark   { background: var(--gray-100); }
.stat-icon.dark svg { fill: var(--dark); }
.stat-label { font-size: .75rem; color: var(--gray-600); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 1.5rem; font-weight: 700; font-family: var(--font-cond); color: var(--dark); margin-top: 2px; }

/* ---- CARD GENÉRICO ---- */
.card { background: var(--white); border-radius: var(--radius); border: 1px solid var(--gray-200); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title { font-family: var(--font-cond); font-size: 1rem; font-weight: 700; color: var(--dark); letter-spacing: .3px; }
.card-body { padding: 20px; }

/* ---- TABELA ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead { background: var(--gray-50); }
th { padding: 10px 14px; text-align: left; font-weight: 600; color: var(--gray-600); font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid var(--orange); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--gray-100); color: var(--gray-800); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fff8f6; }

/* ---- BADGES ---- */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 99px; font-size: .75rem; font-weight: 600; }
.badge-green  { background: var(--green-light);  color: #166534; }
.badge-red    { background: var(--red-light);    color: #991b1b; }
.badge-yellow { background: var(--yellow-light); color: #713f12; }
.badge-blue   { background: var(--blue-light);   color: #1e40af; }
.badge-orange { background: var(--orange-light); color: #9a1f00; }
.badge-gray   { background: var(--gray-100);     color: var(--gray-600); }

/* ---- BOTÕES ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); font-size: .875rem; font-weight: 600; transition: all .18s; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; fill: currentColor; }
.btn-primary { background: var(--orange); color: var(--white); }
.btn-primary:hover { background: var(--orange-dark); }
.btn-dark { background: var(--dark); color: var(--white); }
.btn-dark:hover { background: var(--dark-2); }
.btn-outline { background: none; color: var(--gray-600); border: 1px solid var(--gray-200); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-danger { background: var(--red-light); color: #991b1b; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 5px 10px; font-size: .8rem; }

/* ---- FORMULÁRIOS ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: .83rem; font-weight: 600; color: var(--gray-600); }
.form-control {
  padding: 9px 12px; border: 1px solid var(--gray-200); border-radius: var(--radius);
  font-size: .9rem; color: var(--gray-800); background: var(--white);
  transition: border-color .18s, box-shadow .18s; width: 100%;
}
.form-control:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(241,78,28,.12); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }

/* ---- SEARCH BAR ---- */
.search-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-input-wrap { position: relative; flex: 1; min-width: 200px; }
.search-input-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; fill: var(--gray-400); pointer-events: none; }
.search-input-wrap input { width: 100%; padding: 9px 12px 9px 34px; border: 1px solid var(--gray-200); border-radius: var(--radius); font-size: .88rem; background: var(--white); }
.search-input-wrap input:focus { outline: none; border-color: var(--orange); }

/* ---- PAGINAÇÃO ---- */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 16px 0 0; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: var(--radius); font-size: .85rem; border: 1px solid var(--gray-200); color: var(--gray-600); transition: all .15s; }
.pagination a:hover { background: var(--gray-100); }
.pagination .active span { background: var(--orange); color: var(--white); border-color: var(--orange); font-weight: 700; }

/* ---- EMPTY STATE ---- */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state svg { width: 48px; height: 48px; fill: var(--gray-200); margin: 0 auto 12px; }
.empty-state p { color: var(--gray-400); font-size: .9rem; }

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100vh;
  background: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--orange);
}
.login-card {
  background: var(--white);
  border-radius: 12px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { width: 180px; margin: 0 auto 4px; }
.login-logo p { font-size: .8rem; color: var(--gray-400); }
.login-card .form-group { margin-bottom: 14px; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 1rem; margin-top: 6px; }

/* ---- RESPONSIVO ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.3); }
  .main-wrap { margin-left: 0; }
  .menu-toggle { display: flex; }
  .main-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* fix: SVG sem classe (ex: paginação padrão do Laravel) fica gigante sem isso */
svg { width: 20px; height: 20px; }
.pagination svg { width: 16px; height: 16px; fill: currentColor; vertical-align: middle; }
