/* ===================================================
   MÓDULO CONSIGNADO
   =================================================== */

/* Tab nav */
.cs-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}

.cs-tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cs-tab:hover {
  color: var(--text-primary);
}

.cs-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

/* Panel */
.cs-panel { display: none; }
.cs-panel.active { display: block; }

/* Ponto list item */
.cs-ponto-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 0.5px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  transition: all 0.2s;
  background: var(--bg-primary);
}

.cs-ponto-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-secondary);
}

/* Item de produto na entrega */
.cs-produto-row {
  display: grid;
  grid-template-columns: 1fr 120px 120px 36px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

/* Tabela de acerto */
.cs-acerto-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cs-acerto-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.cs-acerto-table td {
  padding: 10px 12px;
  border-bottom: 0.5px solid var(--border);
  color: var(--text-primary);
}

.cs-acerto-table tr:last-child td {
  border-bottom: none;
}

.cs-acerto-table input[type="number"] {
  width: 90px;
  height: 34px;
  text-align: center;
}

/* Total destaque */
.cs-total-box {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cs-total-label {
  font-size: 14px;
  font-weight: 500;
  opacity: 0.9;
}

.cs-total-value {
  font-size: 28px;
  font-weight: 700;
}

/* Sugestão de reposição */
.cs-sugestao {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 16px;
  font-size: 13px;
}

.cs-sugestao-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cs-sugestao-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--blue-light);
  color: var(--blue-text);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  margin: 3px;
}

/* Histórico */
.cs-hist-card {
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  background: var(--bg-primary);
  transition: border-color 0.2s;
}

.cs-hist-card:hover {
  border-color: var(--border-hover);
}

.cs-hist-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.cs-hist-total {
  font-size: 20px;
  font-weight: 700;
  color: var(--blue);
}

/* Status badges consignado */
.cs-badge-aberto {
  background: #FFF9C4;
  color: #F57F17;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.cs-badge-acertado {
  background: #DCEDC8;
  color: #33691E;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 20px;
  font-weight: 600;
}

/* Modal box wider para Consignado */
.modal-box {
  width: 95vw;
  max-width: 800px;
  max-height: 90vh;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-y: auto; /* Single scroll */
  scrollbar-width: thin;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 10;
}

.modal-body {
  padding: 24px;
  flex: 1 1 auto;
}

.modal-box::-webkit-scrollbar {
  width: 6px;
}

.modal-box::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

/* STEPPER STYLES */
.step-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.step-content.active {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.stepper-indicator {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 10px 0;
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.3s;
  color: var(--text-tertiary);
}

.step-dot.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 0 15px rgba(59,130,246,0.4);
}

.step-dot.completed {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

/* Consignado Tela 2 — botões de ação */
@media (max-width: 600px) {
  .cs-tela2-actions {
    flex-direction: column;
  }
}

/* ==========================================================
   FIX GLOBAL: .search-box como campo de input em modais
   Afeta: Clientes, Equipamentos, Insumos, Financeiro, etc.
   ========================================================== */

/* Dá borda e fundo visível ao container */
.modal-form .search-box,
.modal-body .search-box {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
  height: 42px;
  display: flex;
  align-items: center;
  min-width: unset;
  overflow: hidden;
  transition: border-color 0.2s;
}

/* Estado de foco */
.modal-form .search-box:focus-within,
.modal-body .search-box:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* Inputs e selects dentro do container transparentes (borda está no pai) */
.modal-form .search-box input,
.modal-form .search-box select,
.modal-body .search-box input,
.modal-body .search-box select {
  border: none !important;
  background: transparent !important;
  height: 100%;
  width: 100%;
  color: var(--text) !important;
  font-size: 14px;
  outline: none;
  flex: 1;
}

/* Selects precisam de cursor pointer */
.modal-form .search-box select,
.modal-body .search-box select {
  cursor: pointer;
  padding-left: 8px;
  padding-right: 8px;
}

/* Textarea com altura auto dentro do container */
.modal-form .search-box textarea,
.modal-body .search-box textarea {
  border: none !important;
  background: transparent !important;
  color: var(--text) !important;
  font-size: 14px;
  outline: none;
  resize: vertical;
  width: 100%;
}

/* search-box com padding:0 (usado em forms) — corrige altura para auto */
.modal-form .search-box[style*="padding:0"],
.modal-form .search-box[style*="padding: 0"] {
  height: 42px;
}

/* search-box com flex-direction:column e align-items:flex-start (textarea wrapper) */
.modal-form .search-box[style*="flex-direction:column"],
.modal-form .search-box[style*="align-items:flex-start"] {
  height: auto;
  padding: 4px 0;
  align-items: flex-start;
}

/* =========================================
   CROPPER MODAL (Cortador de Imagens)
========================================= */
.cropper-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 99999; /* Max priority to be over any other modal */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cropper-modal-box {
  background: var(--bg-primary);
  width: 100%;
  max-width: 500px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cropper-modal-box .modal-header {
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cropper-modal-box .modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.cropper-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cropper-container-wrapper {
  width: 100%;
  height: 350px;
  background: #111;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.cropper-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* ADMIN AUTH OVERLAY */
.admin-auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a0a;
    overflow: hidden;
}

.admin-auth-box {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 2;
    text-align: center;
}

.auth-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #fff;
}

.auth-header p {
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 30px;
}

.auth-form {
    text-align: left;
}

.auth-form .form-group label {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.auth-form input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}

.auth-form input:focus {
    border-color: var(--blue);
    background: rgba(0, 0, 0, 0.3);
}

.auth-error-msg {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 20px;
    text-align: center;
}

.auth-bg-blobs {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.blob {
    position: absolute;
    width: 500px;
    height: 500px;
    background: var(--blue);
    filter: blur(80px);
    opacity: 0.15;
    border-radius: 50%;
    animation: blobFloat 20s infinite alternate;
}

.blob:nth-child(1) { top: -10%; left: -10%; background: var(--blue); }
.blob:nth-child(2) { bottom: -10%; right: -10%; background: var(--purple); animation-delay: -5s; }
.blob:nth-child(3) { top: 40%; left: 30%; background: var(--orange); animation-delay: -10s; }

@keyframes blobFloat {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(100px, 50px) scale(1.1); }
}

.w-100 { width: 100%; }

.btn-logout {
    margin-top: 12px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: var(--red);
    color: #fff;
}

.sidebar.collapsed .btn-logout span {
    display: none;
}
