/* ============================================================
   Sistema Pesca — Admin CSS
   Tema: Azul Marinho / Verde Água
   ============================================================ */

:root {
  --primary:       #1a6b9a;
  --primary-dark:  #0d4f75;
  --primary-light: #4fa3d1;
  --accent:        #2ecc71;
  --accent-dark:   #27ae60;
  --success:       #22c55e;
  --danger:        #ef4444;
  --warning:       #f59e0b;
  --info:          #3b82f6;
  --purple:        #8b5cf6;
  --bg:            #f0f4f8;
  --white:         #ffffff;
  --text:          #1e2330;
  --muted:         #6b7280;
  --border:        #e2e8f0;
  --radius:        8px;
  --sb-w:          240px;
  --sb-w-col:      60px;
  --top-h:         60px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sb-w);
  height: 100vh;
  background: var(--primary-dark);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width .25s ease;
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sb-w-col); }

.sb-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  min-height: var(--top-h);
  white-space: nowrap;
  overflow: hidden;
}

.sb-brand .brand-logo {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
  color: white;
}

.sb-brand .brand-text { overflow: hidden; }
.sb-brand .brand-name { font-weight: 700; font-size: .95rem; color: white; display: block; line-height: 1.2; }
.sb-brand .brand-sub  { font-size: .72rem; color: rgba(255,255,255,.55); }

.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: .5rem 0; }
.sb-nav::-webkit-scrollbar { width: 4px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }

.sb-section-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  padding: .75rem 1.1rem .3rem;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .sb-section-label { opacity: 0; }

.sb-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem 1.1rem;
  color: rgba(255,255,255,.75);
  font-size: .85rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}

.sb-link:hover {
  background: rgba(255,255,255,.08);
  color: white;
}

.sb-link.active {
  background: rgba(255,255,255,.12);
  color: white;
  border-left-color: var(--accent);
}

.sb-link i {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: .9rem;
  opacity: .85;
}

.sb-link .link-text { overflow: hidden; transition: opacity .2s; }
.sidebar.collapsed .sb-link .link-text { opacity: 0; width: 0; }

.sb-footer {
  padding: .75rem 1rem;
  border-top: 1px solid rgba(255,255,255,.1);
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sb-w);
  right: 0;
  height: var(--top-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  z-index: 100;
  transition: left .25s ease;
  box-shadow: var(--shadow);
}

.sidebar.collapsed ~ .topbar,
body.sb-collapsed .topbar { left: var(--sb-w-col); }

.topbar-title {
  flex: 1;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.topbar-title i { color: var(--primary); }

.btn-toggle-sb {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.1rem;
  padding: .3rem .4rem;
  border-radius: var(--radius);
  transition: background .15s, color .15s;
}

.btn-toggle-sb:hover { background: var(--bg); color: var(--text); }

/* ── Main content ────────────────────────────────────────── */
.main-content {
  margin-left: var(--sb-w);
  margin-top: var(--top-h);
  padding: 1.5rem;
  min-height: calc(100vh - var(--top-h));
  transition: margin-left .25s ease;
}

body.sb-collapsed .main-content { margin-left: var(--sb-w-col); }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header {
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}

.card-header h5 {
  margin: 0;
  font-size: .92rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .45rem;
}

.card-header h5 i { color: var(--primary); }

.card-body { padding: 1.25rem; }

/* ── Stat cards ──────────────────────────────────────────── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--bg-color, #e8f4fd);
  color: var(--cor, var(--primary));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.stat-val { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .75rem; color: var(--muted); margin-top: .2rem; }

/* ── Tabelas ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}

.admin-table thead tr {
  background: #f8fafc;
  border-bottom: 2px solid var(--border);
}

.admin-table th {
  padding: .65rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  white-space: nowrap;
}

.admin-table td {
  padding: .7rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.admin-table tbody tr:hover { background: #fafcff; }
.admin-table tbody tr:last-child td { border-bottom: none; }

/* ── Botões ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem 1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: .84rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, transform .1s;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }

.btn-primary   { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; }

.btn-success   { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; color: white; }

.btn-danger    { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; color: white; }

.btn-warning   { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; color: white; }

.btn-info      { background: var(--info); color: white; }
.btn-info:hover { background: #2563eb; color: white; }

.btn-light     { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); }
.btn-light:hover { background: #e2e8f0; color: var(--text); }

.btn-sm { padding: .3rem .7rem; font-size: .78rem; }
.btn-xs { padding: .2rem .5rem; font-size: .72rem; }

.btn-icon {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-size: .82rem;
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success  { background: #dcfce7; color: #166534; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-warning  { background: #fef3c7; color: #92400e; }
.badge-info     { background: #dbeafe; color: #1e40af; }
.badge-purple   { background: #ede9fe; color: #5b21b6; }
.badge-primary  { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #f1f5f9; color: var(--muted); }
.badge-muted    { background: #f1f5f9; color: var(--muted); }

/* ── Formulários ─────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: .35rem;
}

.form-control, .form-select {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  color: var(--text);
  background: white;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(26, 107, 154, .12);
}

.form-control.is-invalid { border-color: var(--danger); }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint { font-size: .75rem; color: var(--muted); margin-top: .25rem; }

/* ── Alertas ─────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .85rem;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  margin-bottom: 1rem;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Busca ───────────────────────────────────────────────── */
.search-box {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .35rem .75rem;
  font-size: .84rem;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: .84rem;
  color: var(--text);
  width: 200px;
}

.search-box i { color: var(--muted); font-size: .8rem; }

/* ── Paginação ───────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: .25rem;
  align-items: center;
  flex-wrap: wrap;
}

.page-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .8rem;
  cursor: pointer;
  background: white;
  color: var(--text);
  transition: background .15s, color .15s;
}

.page-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}

.modal-box {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.modal-header h5 {
  margin: 0;
  font-size: .9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .45rem;
}

.modal-header h5 i { color: var(--primary); }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 1.1rem; padding: .2rem;
  border-radius: 4px;
}

.modal-close:hover { background: #fee2e2; color: var(--danger); }
.modal-body { padding: 1.25rem; overflow-y: auto; }
.modal-footer { padding: .85rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .5rem; }

/* ── Produto thumbnail ───────────────────────────────────── */
.product-thumb {
  width: 44px; height: 44px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.product-thumb-placeholder {
  width: 44px; height: 44px;
  border-radius: 6px;
  background: #f1f5f9;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  font-size: .9rem;
  border: 1px solid var(--border);
}

/* ── Login page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: white;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo .logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.75rem;
  color: white;
  margin-bottom: .75rem;
}

.login-logo h1 { font-size: 1.4rem; font-weight: 700; color: var(--primary-dark); margin: 0 0 .2rem; }
.login-logo p  { font-size: .82rem; color: var(--muted); margin: 0; }

/* ── Estoque badge ───────────────────────────────────────── */
.estoque-ok    { color: var(--success); font-weight: 600; }
.estoque-baixo { color: var(--warning); font-weight: 600; }
.estoque-zero  { color: var(--danger);  font-weight: 600; }

/* ── Status pedido ───────────────────────────────────────── */
.status-pendente   { background: #fef3c7; color: #92400e; }
.status-confirmado { background: #dbeafe; color: #1e40af; }
.status-separando  { background: #ede9fe; color: #5b21b6; }
.status-enviado    { background: #ccfbf1; color: #065f46; }
.status-entregue   { background: #dcfce7; color: #166534; }
.status-cancelado  { background: #fee2e2; color: #991b1b; }

/* ── Divider ─────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* ── Grid helpers ────────────────────────────────────────── */
.row { display: flex; flex-wrap: wrap; gap: 1rem; }
.col { flex: 1; min-width: 0; }
.col-auto { flex: 0 0 auto; }
.col-2 { flex: 0 0 calc(50% - .5rem); }
.col-3 { flex: 0 0 calc(33.333% - .667rem); }

/* ── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.breadcrumb a { color: var(--primary); }
.breadcrumb i { font-size: .65rem; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sb-w) !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .topbar { left: 0 !important; }
  .main-content { margin-left: 0 !important; }

  .col-2, .col-3 { flex: 0 0 100%; }

  .desktop-hide { display: none; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 769px) {
  .mobile-only { display: none; }
}
