/* =============================================================
   app.css — Hidroquímica Relatórios
   Estrutura:
     1. Custom Properties (tokens compartilhados)
     2. Reset / Base
     3. Utilitários compartilhados
     4. Página de Autenticação  (.page-auth)
     5. Painel Interno           (.page-panel)
     6. Scrollbars
     7. Media Queries
   ============================================================= */


/* ─────────────────────────────────────────────────────────────
   1. CUSTOM PROPERTIES
   ───────────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --color-brand:        #0cd564;
  --color-brand-hover:  #10af55;
  --color-brand-shadow: rgba(12, 213, 100, 0.35);
  --color-brand-ring:   rgba(12, 213, 100, 0.3);

  /* Feedback */
  --color-danger:       #b91c1c;
  --color-danger-bg:    #dc3545;
  --color-success:      #15803d;
  --color-info:         #1d4ed8;
  --color-warning:      #f5b74f;

  /* Auth surface */
  --auth-bg:            #1f262f;
  --auth-surface:       rgba(255, 255, 255, 0.13);
  --auth-border:        rgba(255, 255, 255, 0.1);
  --auth-shadow:        rgba(8, 7, 16, 0.6);

  /* Panel surface */
  --panel-bg:           #e6e8ed;
  --panel-surface:      #ffffff;
  --panel-border:       #e2e8f0;
  --panel-shadow-sm:    0 2px 8px rgba(0, 0, 0, 0.07);
  --panel-sidebar-bg:   #21232d;
  --panel-sidebar-fg:   #9799ab;

  /* Text */
  --text-body:          #666666;
  --text-dark:          #20384f;
  --text-muted:         #64748b;
  --text-label:         #374151;
  --text-heading:       #344054;

  /* Borders / radius */
  --radius-sm:  6px;
  --radius-md:  8px;
  --radius-lg:  12px;

  /* Bootstrap overrides */
  --bs-primary:          #0cd564;
  --bs-primary-rgb:      12, 213, 100;
  --bs-danger:           #b91c1c;
  --bs-danger-rgb:       185, 28, 28;
  --bs-success:          #15803d;
  --bs-success-rgb:      21, 128, 61;
  --bs-info:             #1d4ed8;
  --bs-info-rgb:         29, 78, 216;
}


/* ─────────────────────────────────────────────────────────────
   2. RESET / BASE
   ───────────────────────────────────────────────────────────── */
.invalid-feedback {
  margin-top: 3px;
  color:      red;
  font-size:  12px;
}


/* ─────────────────────────────────────────────────────────────
   3. UTILITÁRIOS COMPARTILHADOS
   ───────────────────────────────────────────────────────────── */
.font-weight-bold { font-weight: 600; }

.text-blue   { color: #246dec; }
.text-red    { color: #cc3c43; }
.text-green  { color: #367952; }
.text-orange { color: #f5b74f; }

.app-toast-visible {
  position:   fixed;
  right:      20px;
  top:        20px;
  z-index:    9999;
  min-width:  260px;
  max-width:  420px;
  padding:    12px 14px;
  border-radius: var(--radius-md);
  color:      #fff;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
  animation:  toast-in 0.2s ease-out;
}
.app-toast-visible.toast-success { background-color: var(--color-success); }
.app-toast-visible.toast-error   { background-color: var(--color-danger);  }
.app-toast-visible.toast-info    { background-color: var(--color-info);    }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0);    }
}


/* ─────────────────────────────────────────────────────────────
   4. PÁGINA DE AUTENTICAÇÃO  (body.page-auth)
   ───────────────────────────────────────────────────────────── */
body.page-auth {
  background-color: var(--auth-bg);
  display:          flex;
  flex-direction:   column;
  justify-content:  center;
  align-items:      center;
  min-height:       100vh;
  --bs-secondary:     #1f262f;
  --bs-secondary-rgb: 31, 38, 47;
  --bs-body-bg:       #1f262f;
}

/* Todos os filhos de <form> herdam a fonte/cor padrão da auth */
body.page-auth form * {
  font-family:    'Poppins', sans-serif;
  color:          #ffffff;
  letter-spacing: 0.5px;
  outline:        none;
  border:         none;
}

body.page-auth form h3 {
  font-size:   32px;
  font-weight: 500;
  line-height: 42px;
  text-align:  center;
}

body.page-auth header {
  height:         100px;
  width:          100%;
  border-radius:  10px 10px 0 0;
  position:       relative;
  z-index:        1;
  font-family:    'Poppins', sans-serif;
  color:          var(--color-brand);
  letter-spacing: 0.5px;
  display:        flex;
  align-items:    center;
  justify-content: flex-start;
}

body.page-auth header h1 {
  font-size:       32px;
  font-weight:     500;
  line-height:     42px;
  text-align:      center;
  margin-left:     30px;
  text-decoration: none;
}

body.page-auth form {
  height:           auto;
  width:            400px;
  background-color: var(--auth-surface);
  position:         absolute;
  transform:        translate(-50%, -50%);
  top:              50%;
  left:             50%;
  border-radius:    10px;
  border:           2px solid var(--auth-border);
  box-shadow:       0 0 40px var(--auth-shadow);
  padding:          50px 35px;
}

body.page-auth label {
  display:     block;
  margin-top:  30px;
  font-size:   16px;
  font-weight: 500;
}

body.page-auth input {
  display:          block;
  height:           50px;
  width:            100%;
  background-color: rgba(255, 255, 255, 0.07);
  border-radius:    var(--radius-md);
  padding:          0 14px;
  margin-top:       8px;
  font-size:        14px;
  font-weight:      300;
  transition:       background-color 0.2s ease, box-shadow 0.2s ease;
}

body.page-auth input:focus {
  background-color: rgba(255, 255, 255, 0.12);
  box-shadow:       0 0 0 3px var(--color-brand-ring);
}

body.page-auth ::placeholder { color: #e5e5e5; }

body.page-auth .button {
  margin-top:     24px;
  width:          100%;
  background-color: var(--color-brand);
  color:          #080710;
  padding:        14px 0;
  font-size:      16px;
  font-weight:    700;
  border-radius:  var(--radius-md);
  cursor:         pointer;
  border:         none;
  letter-spacing: 0.5px;
  transition:     background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

body.page-auth .button:hover {
  background-color: var(--color-brand-hover);
  color:            #ffffff;
  box-shadow:       0 6px 16px var(--color-brand-shadow);
  transform:        translateY(-1px);
}

body.page-auth .cancelButton {
  margin-top:      20px;
  width:           100%;
  background-color: #ffffff;
  color:           #080710;
  padding:         15px 0;
  font-size:       18px;
  font-weight:     600;
  border-radius:   var(--radius-sm);
  cursor:          pointer;
  text-decoration: none;
  display:         flex;
  align-items:     center;
  justify-content: center;
}

body.page-auth .cancelButton:hover {
  background-color: red;
  color:            #ffffff;
}

.link {
  text-decoration: none;
  color:           var(--color-brand);
  font-size:       32px;
  font-weight:     500;
  line-height:     42px;
  text-align:      center;
  margin-left:     30px;
}

.logo-auth {
  width:      clamp(120px, 36vw, 190px);
  max-width:  100%;
  max-height: 88px;
  height:     auto;
  display:    block;
  object-fit: contain;
}

.auth-title       { color: var(--color-brand); }
.auth-helper-text { margin-top: 10px; }

.chart {
  background-color: #ffffff;
  box-sizing:   border-box;
  border:       1px solid #d2d2d3;
  border-radius: var(--radius-sm);
  box-shadow:   0 6px 7px -4px rgba(0, 0, 0, 0.2);
}


/* ─────────────────────────────────────────────────────────────
   5. PAINEL INTERNO  (body.page-panel)
   ───────────────────────────────────────────────────────────── */
body.page-panel {
  margin:           0;
  padding:          0;
  background-color: var(--panel-bg);
  color:            var(--text-body);
  font-family:      "Montserrat", sans-serif;
}

body.page-panel .material-icons-outlined {
  vertical-align: middle;
  line-height:    1px;
}

body.page-panel .text-primary { color: var(--text-body); }

/* Grid */
body.page-panel .grid-container {
  display:               grid;
  grid-template-columns: 260px 1fr 1fr 1fr;
  grid-template-rows:    0.2fr 3fr;
  grid-template-areas:
    "sidebar header header header"
    "sidebar main   main   main";
  height: 100vh;
}

/* ---- Header ---- */
body.page-panel .header {
  grid-area:        header;
  height:           70px;
  background-color: #ffffff;
  display:          flex;
  align-items:      center;
  justify-content:  space-between;
  padding:          0 30px;
  box-shadow:       0 6px 7px -4px rgba(0, 0, 0, 0.2);
}

body.page-panel .menu-icon  { display: none; }

body.page-panel .logout {
  text-decoration: none;
  color:           var(--text-body);
  font-size:       16px;
  font-weight:     500;
  line-height:     20px;
  text-align:      center;
}
body.page-panel .logout:hover { color: red; }

/* ---- Sidebar ---- */
body.page-panel #sidebar {
  grid-area:    sidebar;
  height:       100%;
  background-color: var(--panel-sidebar-bg);
  color:        var(--panel-sidebar-fg);
  overflow-y:   auto;
  transition:   all 0.5s;
}

body.page-panel .sidebar-title {
  display:        flex;
  justify-content: space-between;
  align-items:    center;
  padding:        20px 20px 0;
  margin-bottom:  10px;
}

body.page-panel .sidebar-title > span { display: none; }

body.page-panel .sidebar-brand {
  display:    flex;
  align-items: center;
  margin-top: 15px;
  max-width:  100%;
}

body.page-panel .logo-sidebar {
  width:      clamp(96px, 34vw, 132px);
  max-width:  100%;
  max-height: 72px;
  height:     auto;
  object-fit: contain;
  display:    block;
}

body.page-panel .sidebar-list {
  padding:        0;
  margin-top:     15px;
  list-style-type: none;
}

body.page-panel .sidebar-list-item {
  padding:      10px 20px;
  border-left:  3px solid transparent;
  transition:   background-color 0.2s ease, border-color 0.2s ease;
}

body.page-panel .sidebar-list-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-left-color: var(--color-brand);
  cursor: pointer;
}

body.page-panel .sidebar-list-item.active {
  background-color:  rgba(12, 213, 100, 0.12);
  border-left-color: var(--color-brand);
}

body.page-panel .sidebar-list-item.active > a {
  color:       var(--color-brand);
  font-weight: 600;
}

body.page-panel .sidebar-list-item > a {
  text-decoration: none;
  color:           var(--panel-sidebar-fg);
}

body.page-panel .sidebar-responsive {
  display:  inline !important;
  position: absolute;
  z-index:  12 !important;
}

/* ---- Main ---- */
body.page-panel .main-container {
  grid-area:   main;
  overflow-y:  auto;
  padding:     20px 32px;
  max-width:   1400px;
  width:       100%;
  margin-left: auto;
  margin-right: auto;
}

body.page-panel .main-title {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  margin-bottom:   4px;
}

body.page-panel .main-title > p {
  font-size:      11px;
  font-weight:    700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color:          #94a3b8;
  margin:         0;
}

/* ---- Route filter ---- */
body.page-panel .route-filter-panel {
  width:      100%;
  max-width:  860px;
  margin:     8px 0 20px;
  padding:    20px;
  background: linear-gradient(120deg, #ffffff 0%, #f7fafc 100%);
  border:     1px solid #d9e2ec;
  border-radius: 10px;
  box-shadow: 0 6px 14px -8px rgba(15, 23, 42, 0.35);
}

body.page-panel .route-filter-header        { margin-bottom: 12px; }
body.page-panel .route-filter-header h2     { margin: 0; color: var(--text-dark); }
body.page-panel .route-filter-header p      { margin: 8px 0 0; color: #5a6b7b; }

body.page-panel .route-filter-form {
  display:     flex;
  align-items: end;
  gap:         12px;
  flex-wrap:   wrap;
}

body.page-panel .route-filter-form label {
  font-size:   14px;
  font-weight: 700;
  color:       #344054;
  margin:      0;
}

body.page-panel .route-select {
  min-width: 220px;
  max-width: 420px;
  width:     100%;
  height:    40px;
}

body.page-panel .route-filter-form .btn-adicionar {
  height:      40px;
  padding:     0 16px;
  font-weight: 600;
}

/* ---- Cards ---- */
body.page-panel .main-cards {
  display:               grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap:                   20px;
  margin:                12px 0 24px;
}

body.page-panel .main-cards .card {
  display:          flex !important;
  flex-direction:   column !important;
  justify-content:  space-around;
  padding:          22px 25px;
  background-color: #ffffff !important;
  border:           1px solid var(--panel-border);
  border-radius:    var(--radius-lg);
  box-shadow:       var(--panel-shadow-sm);
  transition:       box-shadow 0.2s ease, transform 0.15s ease;
  min-height:       90px;
}
body.page-panel .main-cards .card:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  transform:  translateY(-2px);
}

body.page-panel .main-cards .card:nth-child(1) { border-left: 7px solid #246dec; }
body.page-panel .main-cards .card:nth-child(2) { border-left: 7px solid #f5b74f; }
body.page-panel .main-cards .card:nth-child(3) { border-left: 7px solid #367952; }
body.page-panel .main-cards .card:nth-child(4) { border-left: 7px solid #cc3c43; }

body.page-panel .main-cards .card > span { font-size: 20px; font-weight: 600; }

body.page-panel .card-inner {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
}

body.page-panel .card-inner > p {
  font-size:      12px;
  font-weight:    700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color:          var(--text-muted);
  margin:         0;
}

body.page-panel .card-inner > span { font-size: 35px; }

/* ---- Charts ---- */
body.page-panel .charts {
  display:               grid;
  grid-template-columns: 1fr 1fr;
  gap:                   20px;
}

body.page-panel .charts-card {
  background-color:      #ffffff;
  margin-bottom:         20px;
  padding:               25px;
  border:                1px solid #d2d2d3;
  border-radius:         var(--radius-sm);
  box-shadow:            0 6px 7px -4px rgba(0, 0, 0, 0.2);
}

body.page-panel .chart-title {
  display:         flex;
  align-items:     center;
  justify-content: center;
  font-size:       22px;
  font-weight:     600;
}

body.page-panel .chart-panel {
  background-color: #ffffff;
  border:           1px solid #d2d2d3;
  border-radius:    var(--radius-sm);
  box-shadow:       0 6px 7px -4px rgba(0, 0, 0, 0.2);
  margin-top:       20px;
}

/* ---- Formulários ---- */
body.page-panel .main-products-form {
  width:            100%;
  display:          flex;
  flex-direction:   row;
  align-items:      center;
  justify-content:  center;
  background-color: #ffffff;
  border:           1px solid var(--panel-border);
  border-radius:    var(--radius-lg);
  box-shadow:       var(--panel-shadow-sm);
  padding:          28px 24px;
  margin-bottom:    20px;
}

body.page-panel .main-products-form.table-responsive {
  display: block;
  padding: 16px;
}

body.page-panel .main-products-form-exlcude {
  width:            100%;
  display:          flex;
  flex-direction:   column;
  align-items:      center;
  justify-content:  center;
  background-color: #ffffff;
  border:           1px solid var(--panel-border);
  border-radius:    var(--radius-lg);
  box-shadow:       var(--panel-shadow-sm);
  padding:          20px;
  margin-bottom:    20px;
}

body.page-panel .form {
  width:          min(70%, 640px);
  display:        flex;
  flex-direction: column;
}

body.page-panel .div-input {
  display:        flex;
  flex:           1;
  margin:         20px;
  align-content:  center;
  align-items:    center;
  flex-direction: row;
}

body.page-panel .div-input label {
  width:          30%;
  font-size:      13px;
  font-weight:    700;
  color:          var(--text-label);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* Report specific */
body.page-panel .report-row          { width: 100%; max-width: 800px; }
body.page-panel .report-row label    { width: 80%; }
body.page-panel .report-input        { width: 20%; margin-left: 10px; }
body.page-panel .report-button {
  width:           20%;
  height:          35px;
  margin-left:     10px;
  display:         flex;
  align-items:     center;
  justify-content: center;
}
body.page-panel .section-title-center { text-align: center; }

/* ---- Inputs ---- */
body.page-panel .input {
  width:         100%;
  height:        38px;
  border:        1px solid #d1d5db;
  border-radius: var(--radius-md);
  padding:       0 12px;
  font-size:     14px;
  color:         #1f2937;
  transition:    border-color 0.2s ease, box-shadow 0.2s ease;
}

body.page-panel .input:focus {
  border-color: var(--color-brand);
  box-shadow:   0 0 0 3px rgba(12, 213, 100, 0.15);
  outline:      none;
}

/* ---- Botão principal (#button) ---- */
body.page-panel #button {
  margin:           24px auto;
  width:            50%;
  background-color: var(--color-brand);
  color:            #ffffff;
  padding:          12px 0;
  font-size:        15px;
  font-weight:      700;
  border-radius:    var(--radius-md);
  cursor:           pointer;
  border:           none;
  letter-spacing:   0.5px;
  transition:       background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

body.page-panel #button:hover {
  background-color: var(--color-brand-hover);
  box-shadow:       0 4px 12px var(--color-brand-shadow);
  transform:        translateY(-1px);
}

/* ---- Tabelas ---- */
body.page-panel table {
  border-collapse: collapse;
  width:           100%;
  margin-bottom:   4px;
}

body.page-panel th,
body.page-panel td {
  text-align: center;
  padding:    8px;
  border:     1px solid #ddd;
}

body.page-panel th {
  background-color: #f8fafc;
  color:            var(--text-label);
  font-size:        12px;
  font-weight:      700;
  letter-spacing:   0.6px;
  text-transform:   uppercase;
  padding:          10px 8px;
}

body.page-panel tr:nth-child(even) { background-color: #f2f2f2; }
body.page-panel tr:hover           { background-color: #ddd; }

body.page-panel .tabelas-div h1,
body.page-panel .tabelas-div h2 {
  margin: 18px 0 10px;
  color:  var(--text-dark);
}

body.page-panel .tabelas-div {
  background-color: #ffffff;
  border:           1px solid var(--panel-border);
  border-radius:    var(--radius-lg);
  box-shadow:       var(--panel-shadow-sm);
  padding:          20px;
  margin-bottom:    20px;
}

/* ---- Toolbar / pesquisa ---- */
body.page-panel .table-toolbar {
  width:           100%;
  display:         flex;
  justify-content: flex-end;
  margin:          0 0 8px;
}

body.page-panel .table-search-input {
  width:         min(360px, 100%);
  height:        36px;
  border:        1px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding:       0 12px;
  font-size:     14px;
  color:         #1f2937;
}

body.page-panel .table-search-input:focus {
  border-color: #22c55e;
  box-shadow:   0 0 0 3px rgba(34, 197, 94, 0.15);
  outline:      none;
}

body.page-panel .data-table-controls {
  width:           100%;
  display:         flex;
  flex-wrap:       wrap;
  gap:             10px;
  justify-content: flex-start;
  align-items:     center;
  margin:          0 0 10px;
}

body.page-panel .data-table-pagination {
  display:     flex;
  align-items: center;
  gap:         8px;
}

body.page-panel .table-page-info {
  min-width:        38px;
  height:           32px;
  display:          inline-flex;
  align-items:      center;
  justify-content:  center;
  padding:          0 10px;
  border:           1px solid #d0d5dd;
  border-radius:    var(--radius-sm);
  background-color: #f8fafc;
  font-size:        13px;
  font-weight:      700;
  color:            #344054;
}

/* ---- Paginação ---- */
body.page-panel .pagination {
  margin:          20px auto;
  display:         flex;
  justify-content: center;
  align-items:     center;
  gap:             6px;
}

body.page-panel .pagination a,
body.page-panel .pagination span {
  display:     inline-block;
  padding:     8px 16px;
  border:      1px solid #ddd;
  border-radius: 4px;
  font-weight: 600;
}

body.page-panel .pagination a {
  text-decoration:  none;
  background-color: #f2f2f2;
  color:            #333;
}

body.page-panel .pagination a:hover { background-color: #ddd; }

body.page-panel .pagination .current-page {
  background-color: var(--color-brand);
  color:            white;
  border:           1px solid var(--color-brand);
}

body.page-panel .pagination .disabled {
  background-color: #eef2f6;
  color:            #98a2b3;
  border-color:     #d0d5dd;
  cursor:           not-allowed;
}

/* ---- Sorting ---- */
body.page-panel .sortable-th         { cursor: pointer; user-select: none; }
body.page-panel .sortable-th:hover   { background-color: #e5e7eb; }

/* ---- Botões de ação ---- */
body.page-panel .buttons-camp {
  display:         flex;
  flex-direction:  row;
  justify-content: center;
  align-items:     center;
  gap:             10px;
  width:           100%;
}

body.page-panel .btn-excluir {
  background-color: var(--color-danger-bg);
  color:            #fff;
  border:           none;
  padding:          6px 14px;
  border-radius:    var(--radius-sm);
  cursor:           pointer;
  font-size:        13px;
  font-weight:      600;
  transition:       background-color 0.2s ease, box-shadow 0.2s ease;
}
body.page-panel .btn-excluir:hover {
  background-color: var(--color-danger);
  box-shadow:       0 3px 8px rgba(185, 28, 28, 0.35);
}

body.page-panel .btn-adicionar {
  background-color: var(--color-brand);
  color:            #fff;
  border:           none;
  padding:          6px 14px;
  border-radius:    var(--radius-sm);
  cursor:           pointer;
  font-size:        13px;
  font-weight:      600;
  transition:       background-color 0.2s ease, box-shadow 0.2s ease;
}
body.page-panel .btn-adicionar:hover {
  background-color: var(--color-brand-hover);
  box-shadow:       0 3px 8px var(--color-brand-shadow);
}

body.page-panel .btn-adicionar:disabled {
  opacity: 0.6;
  cursor:  not-allowed;
}


/* ─────────────────────────────────────────────────────────────
   6. SCROLLBARS
   ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 6px; }
::-webkit-scrollbar-track { box-shadow: inset 0 0 5px #a5aaad; border-radius: 10px; }
::-webkit-scrollbar-thumb { background-color: #4f35a1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background-color: #a5aaad; }


/* ─────────────────────────────────────────────────────────────
   7. MEDIA QUERIES
   ───────────────────────────────────────────────────────────── */

/* Medium ≤ 992px */
@media screen and (max-width: 992px) {
  body.page-panel .grid-container {
    grid-template-columns: 1fr;
    grid-template-rows:    0.2fr 3fr;
    grid-template-areas:
      "header"
      "main";
  }

  body.page-panel #sidebar                { display: none; }
  body.page-panel .menu-icon              { display: inline; }
  body.page-panel .sidebar-title > span   { display: inline; }
}

/* Small ≤ 768px */
@media screen and (max-width: 768px) {
  body.page-panel .main-cards {
    grid-template-columns: 1fr;
    gap:                   10px;
    margin-bottom:         0;
  }

  body.page-panel .charts {
    grid-template-columns: 1fr;
    margin-top:            30px;
  }

  body.page-panel .route-filter-form {
    flex-direction: column;
    align-items:    stretch;
  }

  body.page-panel .route-select {
    min-width: 100%;
    max-width: 100%;
  }
}

/* Extra Small ≤ 576px */
@media screen and (max-width: 576px) {
  body.page-panel .header-left { display: none; }
}
