/* style_fresh_v4_8.css - ManuSystems v4.8 Master Visual */

:root {
  --fresh-rose-bg: #fdf2f0;
  --fresh-green-bg: #ebf5ee;
  --fresh-green-active: #8fbc8f;
  --fresh-green-subtle: #d8e6dc;
  --gold-accent: #c5a059;
  --text-serif: #3c362a;
  --text-data: #5d5443;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(197, 160, 89, 0.2);
  --ferrari-red: #ff2800;
  --erro: #e84040;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  padding: 0;
  display: flex;
  min-height: 100vh;
  background: radial-gradient(circle at center, var(--fresh-rose-bg), var(--fresh-green-bg));
  background-attachment: fixed;
  color: var(--text-data);
  overflow-x: hidden;
  font-family: 'DM Sans', 'Inter', sans-serif;
}

/* Tipografia */
.serif-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  color: var(--text-serif);
}
.sans-data {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  color: var(--text-data);
}
.gold-text {
  color: var(--gold-accent) !important;
}
.sub-fresh {
  color: #8c8270;
}
.text-center {
  text-align: center;
}
.hidden {
  display: none !important;
}
.uppercase {
  text-transform: uppercase;
}
.fresh-green-text {
  color: var(--fresh-green-active);
}
.mt-3 {
  margin-top: 12px;
}
.mt-4 {
  margin-top: 16px;
}
.mt-5 {
  margin-top: 24px;
}
.w-100 {
  width: 100%;
}

/* Cards */
.glass-card {
  background: var(--glass-bg);
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  /* backdrop-filter PROIBIDO — performance mobile */
  box-shadow: 0 8px 32px rgba(143, 188, 143, 0.05);
  padding: 25px;
  transition: 0.3s ease-in-out;
}

.gold-border {
  border: 1px solid rgba(197, 160, 89, 0.3);
}

/* Botão padrão */
.btn-fresh-green {
  background-color: var(--fresh-green-active);
  color: white !important;
  border: none;
  padding: 15px 30px;
  border-radius: 15px;
  font-size: 16px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(143, 188, 143, 0.3);
  transition: 0.3s;
  text-transform: uppercase;
}
.btn-fresh-green:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(143, 188, 143, 0.4);
}
.btn-fresh-green:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Botão Voltar — SEMPRE canto superior DIREITO */
.btn-back {
  position: absolute;
  top: 16px;
  right: 16px;
  background-color: var(--fresh-green-active);
  color: white;
  padding: 8px 20px;
  border-radius: 999px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s;
  z-index: 10;
}
.btn-back:hover {
  transform: translateY(-2px);
}

/* Inputs */
.input-fresh,
.select-fresh {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--text-data);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  transition: border-color 0.2s;
}
.input-fresh:focus,
.select-fresh:focus {
  outline: none;
  border-color: var(--fresh-green-active);
  background: #fff;
}

/* Sidebar */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--glass-bg);
  border-right: 1px solid var(--glass-border);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  flex-shrink: 0;
}
.logo-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.main-logo {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
}
.system-name {
  font-size: 20px;
  letter-spacing: 1px;
}
.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nav-links li {
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-data);
  transition: 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-links li:hover,
.nav-links li.active {
  background: var(--fresh-green-subtle);
  color: var(--text-serif);
  font-weight: 500;
}
.icon-green {
  color: var(--fresh-green-active);
}

/* Conteúdo principal */
.content {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
}

/* Header */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  position: relative;
}
.main-header h1 {
  font-size: 28px;
}
.profile-area {
  display: flex;
  align-items: center;
  gap: 12px;
}
.profile-pic {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold-accent);
}
.status-fresh {
  font-size: 12px;
  color: var(--fresh-green-active);
  font-weight: 600;
}

/* KPIs */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}
.card-kpi {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kpi-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.kpi-value {
  font-size: 42px;
  line-height: 1;
}
.kpi-sub {
  font-size: 12px;
}

/* Seção */
.section-title {
  font-size: 18px;
}
.quick-actions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Loader */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px 20px;
  gap: 20px;
}
.loader-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--glass-border);
  border-top-color: var(--fresh-green-active);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loader-texto {
  font-size: 15px;
  color: var(--text-data);
  font-style: italic;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  z-index: 998;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.toast.hidden {
  display: none;
}
.toast.success {
  background: var(--fresh-green-active);
  color: white;
}
.toast.error {
  background: #e8a090;
  color: white;
}
.toast.warning {
  background: #c07820;
  color: white;
}

/* ─── MODAL DE BLOQUEIO CRÍTICO (Regra 7.2.1) ───────────────────
   NUNCA iniciar com class "active" no HTML.
   Ativar via JS: document.getElementById('corteQuimicoModal').classList.add('active')
   ─────────────────────────────────────────────────────────────── */
.critical-blocking-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}
.critical-blocking-modal.active {
  visibility: visible;
  opacity: 1;
}
.modal-content-alert {
  background-color: var(--ferrari-red);
  padding: 60px;
  border-radius: 20px;
  text-align: center;
  border: 3px solid var(--gold-accent);
  box-shadow: 0 0 50px rgba(255, 40, 0, 0.5);
  max-width: 80%;
}
.modal-content-alert .alert-title {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 36px;
  color: white;
  text-transform: uppercase;
  margin: 0 0 30px 0;
  letter-spacing: 2px;
}
.modal-content-alert .alert-text {
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 30px;
}
.btn-stop-proceeding {
  background-color: white;
  color: var(--ferrari-red);
  border: none;
  padding: 20px 50px;
  border-radius: 15px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  transition: 0.3s;
}
.btn-stop-proceeding:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  .sidebar {
    display: none;
  }
  .content {
    padding: 20px 16px 80px;
  }
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .glass-card {
    padding: 16px;
    border-radius: 16px;
  }
  .main-header h1 {
    font-size: 22px;
  }
}

/* =========================================================
   OFFLINE BANNER — BF-206 / F190 / F191
   Faixa amarela discreta fixa no topo quando operando offline
   ========================================================= */

#offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 10px 16px;
  background: #fef3c7;
  border-bottom: 2px solid #f59e0b;
  color: #78350f;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  z-index: 9000;
  letter-spacing: 0.02em;
  animation: offline-slide-down 0.3s ease-out;
}

@keyframes offline-slide-down {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Desativar elementos que exigem conexao */
.is-offline [data-requires-online] {
  opacity: 0.4;
  pointer-events: none;
  user-select: none;
}
