/* ============================================================
   Jaguar Framework — Modern CSS
   Mantém compatibilidade total com seletores legados
   ============================================================ */

:root {
  --corSistema: #CECEFF;

  /* Tipografia */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, Roboto, sans-serif;
  --font-size-base: 12px;
  --font-size-sm:   11px;
  --font-size-xs:   10px;
  --line-height:    1.4;

  /* Cores base */
  --color-text:        #1e293b;
  --color-text-muted:  #64748b;
  --color-link:        #1d4ed8;
  --color-link-hover:  #dc2626;
  --color-bg:          #ffffff;
  --color-surface:     #ffffff;
  --color-border:      #e2e8f0;
  --color-border-dark: #cbd5e1;

  /* Tabela */
  --table-header-bg:   var(--corSistema);
  --table-header-text: #1e293b;
  --table-row-odd:     #ffffff;
  --table-row-even:    #f2f2f2;
  --table-row-hover:   #dbeafe;
  --table-filter-odd:  #dbeafe;
  --table-filter-even: #bfdbfe;
  --table-cell-pad:    3px 7px;
  --table-head-pad:    4px 7px;

  /* Inputs */
  --input-bg:           #f8fafc;
  --input-border:       #cbd5e1;
  --input-border-focus: #3b82f6;
  --input-radius:       3px;
  --input-pad:          2px 5px;

  /* Botões */
  --btn-radius: 3px;
  --btn-pad:    3px 9px;

  /* Sombras */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.07);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.10);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.12);

  /* Raios */
  --radius-sm: 4px;
  --radius:    6px;
  --radius-lg: 8px;
}

/* ============================================================
   Reset base
   ============================================================ */

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

html {
  overflow-y: scroll;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  margin: 0;
  /*padding: 5px 9px 16px;*/
  line-height: var(--line-height);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /*overflow-x: scroll;*/
  /*-webkit-overflow-scrolling: touch;*/
}

/* ============================================================
   Layout — conteúdo ocupa 95% da largura
   ============================================================ */

.jaguar-page-content {
  display: block;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
  text-align: center;
}

/* ============================================================
   Tipografia
   ============================================================ */

blockquote {
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-style: italic;
  padding: 0 0 0 12px;
  border-left: 4px solid #cbd5e1;
  margin: 0 0 0 10px;
  color: var(--color-text-muted);
}

tt {
  font-size: 9pt;
}

h1 {
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin: 7px 0 10px;
}

h2 {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin: 7px 0 9px;
}

h3 {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin: 5px 0 9px;
}

h4 {
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  margin: 5px 0 7px;
}

h5 {
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text);
  margin: 4px 0 5px;
}

/* ============================================================
   Links
   ============================================================ */

a {
  cursor: pointer;
  color: var(--color-link);
  text-decoration: none;
  font-family: var(--font-family);
  font-size: 8pt;
}

a:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

A:link {
  font-family: var(--font-family);
  font-size: 8pt;
  text-decoration: none;
  color: var(--color-link);
}

A:visited {
  font-family: var(--font-family);
  font-size: 8pt;
  text-decoration: none;
  color: var(--color-link);
}

A:hover {
  font-family: var(--font-family);
  font-size: 8pt;
  text-decoration: underline;
  color: var(--color-link-hover);
}

A.white:link,
A.white:visited,
A.white:hover {
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  text-decoration: none;
  color: #ffffff;
  font-weight: bold;
}

/* ============================================================
   Tabelas
   ============================================================ */

table {
  width: 100%;
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  border-collapse: separate;
  border-spacing: 0;
  background-color: var(--color-surface);
  box-shadow: var(--shadow-xs);
  margin-bottom: 8px;
  overflow: hidden;
}

/* Impede tabelas com width fixo de ultrapassar o container */
table[width] {
  max-width: 100%;
}

/* Tabelas de layout (wrapper) que declaram border:none inline — ex: menu, sistema */
table[style*="border:none"],
table[style*="border: none"] {
  border: none !important;
  box-shadow: none !important;
  background-color: transparent !important;
  border-radius: 0 !important;
  margin-bottom: 0 !important;
}
table[style*="border:none"] td,
table[style*="border:none"] th,
table[style*="border: none"] td,
table[style*="border: none"] th {
  border: none !important;
  background-color: transparent !important;
  box-shadow: none !important;
}

/* Scroll horizontal por tabela quando o conteúdo excede a largura */
.jtable-scroll-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

/* Cabeçalho de tabela */
th {
  background-color: var(--table-header-bg);
  color: var(--table-header-text);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 600;
  padding: var(--table-head-pad);
  text-align: left;
  border-bottom: 1px solid rgba(0,0,0,0.10);
  border-right: 1px solid rgba(0,0,0,0.06);
}

th[align="center"] { text-align: center; }
th[align="right"]  { text-align: right; }
th[align="left"]   { text-align: left; }

th:last-child {
  border-right: none;
}

th.header {
  cursor: pointer;
  user-select: none;
}

th.header:hover {
  filter: brightness(1);
}

/* th que contém botões de ação (submit/reset) */
th:has(input[type="submit"]),
th:has(input[type="reset"]),
th:has(input[type="button"]) {
  text-align: center;
  background-color: var(--corSistema);
  padding-top: 8px;
  padding-bottom: 6px;
}

/* Células */
td {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  padding: var(--table-cell-pad);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  text-align: left;
  min-width: 0;
}

td[align="center"] { text-align: center; }
td[align="right"]  { text-align: right; }
td[align="left"]   { text-align: left; }

.table-grid-td {
  padding: 1px 6px;
  border-right: 1px solid var(--color-border);
  vertical-align: middle;
}

/* Linhas zebradas */
tr.rowodd {
  background-color: var(--table-row-odd);
}

tr.roweven {
  background-color: var(--table-row-even);
}

tr.rowodd td {
  height: auto;
  min-height: 22px;
}

tr.roweven td {
  height: auto;
  min-height: 22px;
}

tr.rowodd-hi {
  background-color: var(--table-row-hover);
}

tr.roweven-hi {
  background-color: var(--table-row-hover);
}

tr.rowodd-hi td {
  height: auto;
  min-height: 22px;
}

tr.roweven-hi td {
  height: auto;
  min-height: 22px;
}

/* Linhas de filtro */
tr.rowodd_filter {
  background-color: var(--table-filter-odd);
}

tr.roweven_filter {
  background-color: var(--table-filter-even);
}

tr.rowodd_filter td,
tr.roweven_filter td {
  border-left: 1px solid #ffffff;
}

/* ============================================================
   Labels
   ============================================================ */

label {
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
  margin-right: 8px;
  margin-left: 1px;
  margin-bottom: 3px;
  display: inline-block;
}

label > input[type=radio] {
  margin-right: 3px;
}

/* ============================================================
   Inputs, Selects, Textareas
   ============================================================ */

input[type='text'],
input[type='tel'],
input[type='password'],
textarea,
select {
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--input-radius);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--color-text);
  padding: var(--input-pad);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input[type='text']:focus,
input[type='tel']:focus,
input[type='password']:focus,
textarea:focus,
select:focus {
  background-color: #ffffff;
  border-color: var(--input-border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
  outline: none;
}

input[type='text']:hover,
input[type='tel']:hover,
input[type='password']:hover,
textarea:hover,
select:hover {
  background-color: #ffffff;
  border-color: var(--color-border-dark);
  box-shadow: var(--shadow-xs);
}

input[type='checkbox'] {
  cursor: pointer;
  width: 14px;
  height: 14px;
  accent-color: var(--color-link);
}

select[name$="_origin[]"],
select[name$="_destination[]"] {
  min-width: 250px;
  max-width: 400px;
}

/* ============================================================
   Botões
   ============================================================ */

input[type='submit'],
input[type='button'],
input[type='reset'] {
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: #374151;
  margin: 0;
  padding: var(--btn-pad);
  background: linear-gradient(to bottom, #ffffff 0%, #f3f4f6 100%);
  background-repeat: no-repeat;
  box-shadow: 0 1px 2px rgba(0,0,0,0.10), inset 0 1px 0 rgba(255,255,255,0.80);
  border: 1px solid #d1d5db;
  border-radius: var(--btn-radius);
  display: inline-block;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.08s ease;
}

input[type='submit']:hover,
input[type='button']:hover,
input[type='reset']:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
  color: #111827;
  box-shadow: 0 2px 5px rgba(0,0,0,0.13);
}

input[type='submit']:active,
input[type='button']:active,
input[type='reset']:active {
  background: #e5e7eb;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.10);
  transform: translateY(1px);
}

/* ============================================================
   Componente: tabela Master/Detail (barra de navegação em abas)
   ============================================================ */

.table-md {
  width: auto !important;
  display: table;
  margin: 0 auto 4px;
  background-color: #e0e0e0;
  border: 1px solid #ccc;
  border-radius: 5px;
  box-shadow: none;
  overflow: hidden;
}

.table-md tr.roweven,
.table-md tr.rowodd {
  background-color: transparent;
}

.table-md td {
  padding: 0;
  border: none;
  box-shadow: none;
  vertical-align: middle;
  white-space: nowrap;
}

.table-md td a {
  display: block;
  text-decoration: none;
}

.table-md td a:hover {
  text-decoration: none;
}

/* ============================================================
   Componente: botão de aba MD (btn-sm-jaguar)
   ============================================================ */

.btn-sm-jaguar {
  display: block;
  width: 100%;
  padding: 5px 10px;
  margin: 0;
  color: #4b5563;
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 400;
  white-space: nowrap;
  text-align: center;
  cursor: pointer;
  background-color: #f3f4f6;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}

.btn-sm-jaguar:hover {
  background-color: #e5e7eb;
  border-color: #9ca3af;
  color: #111827;
}

/* Aba ativa — o PHP gera <b>Label</b> no botão da página atual */
.btn-sm-jaguar b {
  font-weight: 600;
  color: var(--color-link);
}

.btn-sm-jaguar:has(b) {
  background-color: var(--color-surface);
  border-color: var(--color-link);
  color: var(--color-link);
  box-shadow: 0 0 0 1px var(--color-link) inset;
}

/* ============================================================
   Ícones Bootstrap Glyphicon / FontAwesome
   ============================================================ */

a .glyphicon {
  color: #6b7280;
  font-size: 15px;
  transition: color 0.15s;
}

a .glyphicon:hover {
  color: var(--color-link);
}

/* ============================================================
   Tooltips jQuery UI
   ============================================================ */

.ui-tooltip {
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

/* ============================================================
   Botão em estado de loading
   ============================================================ */

input.loadingButton,
input.loadingButton:hover,
input.loadingButton:active,
input.loadingButton:focus {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 50 50'><g transform='rotate(0 25 22.5)'><path d='M15 5 h20 v6 l-8 9 8 9 v6 h-20 v-6 l8-9 -8-9 z' stroke='%23615241' stroke-width='3' fill='none' stroke-linejoin='round'/><polygon fill='%23615241' points='17,11 33,11 25,20'><animate attributeName='points' dur='1.8s' repeatCount='indefinite' keyTimes='0;0.6;1' values='17,11 33,11 25,20;25,11 25,11 25,11;25,11 25,11 25,11'/></polygon><polygon fill='%23615241' points='25,29 25,29 25,29'><animate attributeName='points' dur='1.8s' repeatCount='indefinite' keyTimes='0;0.6;1' values='25,29 25,29 25,29;17,38 33,38 25,29;17,38 33,38 25,29'/></polygon><animateTransform attributeName='transform' attributeType='XML' type='rotate' dur='1.8s' repeatCount='indefinite' keyTimes='0;0.6;0.9;1' values='0 25 20.5;0 25 20.5;180 25 20.5;180 25 20.5'/></g></svg>");
  background-repeat: no-repeat;
  background-position: 50% 90% !important;
  background-size: auto 90%;
  color: transparent !important;
  pointer-events: none;
  cursor: default;
  padding: var(--btn-pad);
}

/* ============================================================
   Componente: JMenu (barra de navegação horizontal + dropdowns)
   ============================================================ */

/* Barra principal de primeiro nível */
.jmenu-bar {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
}

/* Container de submenu dropdown */
.jmenu-dropdown {
  border-radius: 4px !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.30) !important;
  overflow: hidden !important;
}

/* Cada item de menu (barra ou dropdown) */
.jmenu-item {
  transition: background-color 0.14s ease, color 0.14s ease !important;
}

/* ============================================================
   Responsivo — breakpoints
   ============================================================ */

@media (max-width: 1900px) {
  .JTable {
    width: 100%;
  }
}

@media (max-width: 1200px) {
  body {
    padding: 6px 8px 16px;
  }
}

@media (max-width: 768px) {
  body {
    padding: 4px 6px 12px;
  }

  th, td {
    padding: 6px 8px;
    font-size: var(--font-size-xs);
  }

  input[type='text'],
  input[type='tel'],
  input[type='password'],
  textarea,
  select {
    font-size: var(--font-size-base);
    padding: 6px 10px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 2px 4px 10px;
  }

  th {
    font-size: var(--font-size-xs);
    padding: 5px 6px;
  }

  td {
    font-size: var(--font-size-xs);
    padding: 5px 6px;
  }
}
