/* tecnoroll.css — TecnoRoll Stylesheet */
:root {
  --tr-primary: #062F87;
  --tr-primary-light: #1a4ba0;
  --tr-accent: #FF6B35;
  --tr-bg: #f8fafc;
  --tr-card-bg: #ffffff;
  --tr-border: #e2e8f0;
  --tr-text: #1e293b;
  --tr-text-muted: #64748b;
  --tr-success: #16a34a;
  --tr-warning: #d97706;
  --tr-danger: #dc2626;
}

.tr-hero {
  background: linear-gradient(135deg, var(--tr-primary) 0%, #0a1628 100%);
  color: #fff;
  padding: 60px 20px 40px;
  text-align: center;
  margin-top: var(--header-h, 140px);
}
.tr-hero h1 { font-size: 2.2rem; margin: 0 0 8px; font-weight: 800; }
.tr-hero h1 i { color: var(--tr-accent); margin-right: 10px; }
.tr-hero p { font-size: 1rem; opacity: 0.85; max-width: 700px; margin: 0 auto; }
.tr-hero .tr-kpi-bar {
  display: flex; justify-content: center; gap: 30px; margin-top: 20px; flex-wrap: wrap;
}
.tr-hero .tr-kpi-item {
  text-align: center; background: rgba(255,255,255,0.1); padding: 12px 24px; border-radius: 8px; min-width: 120px;
}
.tr-hero .tr-kpi-item .kpi-num { font-size: 1.6rem; font-weight: 800; display: block; }
.tr-hero .tr-kpi-item .kpi-label { font-size: 0.75rem; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.5px; }

.tr-container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* Filtros */
.tr-filters {
  background: var(--tr-card-bg); border: 1px solid var(--tr-border); border-radius: 10px;
  padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.tr-filters .filter-row {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px;
}
.tr-filters .filter-group { display: flex; flex-direction: column; }
.tr-filters .filter-group label {
  font-size: 0.75rem; font-weight: 600; color: var(--tr-text-muted);
  text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 3px;
}
.tr-filters .filter-group input,
.tr-filters .filter-group select {
  padding: 7px 10px; border: 1px solid var(--tr-border); border-radius: 5px;
  font-size: 0.85rem; background: #fff; transition: border-color 0.2s;
}
.tr-filters .filter-group input:focus,
.tr-filters .filter-group select:focus {
  border-color: var(--tr-primary); outline: none; box-shadow: 0 0 0 3px rgba(6,47,135,0.1);
}

.tr-filters .filter-actions {
  display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap;
}
.tr-btn { 
  padding: 8px 18px; border: none; border-radius: 5px; font-size: 0.85rem;
  font-weight: 600; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px;
}
.tr-btn-primary { background: var(--tr-primary); color: #fff; }
.tr-btn-primary:hover { background: var(--tr-primary-light); }
.tr-btn-secondary { background: #e2e8f0; color: var(--tr-text); }
.tr-btn-secondary:hover { background: #cbd5e1; }
.tr-btn-accent { background: var(--tr-accent); color: #fff; }
.tr-btn-accent:hover { background: #e55a2b; }
.tr-btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.tr-btn-outline { background: transparent; border: 1.5px solid var(--tr-primary); color: var(--tr-primary); }
.tr-btn-outline:hover { background: var(--tr-primary); color: #fff; }

/* Resultados */
#tr-results-count { font-size: 0.9rem; color: var(--tr-text-muted); margin-bottom: 12px; }

.tr-table-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--tr-border); }
.tr-table {
  width: 100%; border-collapse: collapse; font-size: 0.82rem;
}
.tr-table th {
  background: var(--tr-primary); color: #fff; padding: 10px 12px;
  text-align: left; font-weight: 600; white-space: nowrap; cursor: pointer; user-select: none;
  position: sticky; top: 0;
}
.tr-table th:hover { background: var(--tr-primary-light); }
.tr-table th i { margin-left: 4px; font-size: 0.7rem; }
.tr-table td { padding: 8px 12px; border-bottom: 1px solid var(--tr-border); vertical-align: middle; }
.tr-table tr:hover td { background: #f1f5f9; }
.tr-table .tr-row-selected td { background: #dbeafe; }
.tr-table .tr-code { font-weight: 700; color: var(--tr-primary); cursor: pointer; }
.tr-table .tr-code:hover { text-decoration: underline; }
.tr-table .tr-type-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.7rem;
  font-weight: 600; text-transform: uppercase;
}
.tr-table .tr-type-badge.ball { background: #dbeafe; color: #1e40af; }
.tr-table .tr-type-badge.roller { background: #fef3c7; color: #92400e; }

/* Detalhes do rolamento */
#tr-detail-panel {
  display: none; background: var(--tr-card-bg); border: 1px solid var(--tr-border);
  border-radius: 10px; padding: 20px; margin-top: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
#tr-detail-panel.tr-active { display: block; }
.tr-detail-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px;
}
.tr-detail-header h3 { margin: 0; font-size: 1.2rem; color: var(--tr-primary); }
.tr-detail-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 16px;
}
.tr-detail-item {
  background: #f8fafc; padding: 10px 14px; border-radius: 6px;
}
.tr-detail-item .label { font-size: 0.7rem; color: var(--tr-text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.tr-detail-item .value { font-size: 1.1rem; font-weight: 700; color: var(--tr-text); }

/* Calculo L10 */
.tr-calc-section {
  background: #f8fafc; border-radius: 8px; padding: 16px; margin-top: 12px;
  border: 1px solid var(--tr-border);
}
.tr-calc-section h4 { margin: 0 0 12px; font-size: 0.95rem; color: var(--tr-primary); }
.tr-calc-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px;
}
.tr-calc-result {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: #fff; border-radius: 5px; border: 1px solid var(--tr-border); margin-top: 8px;
}
.tr-calc-result .tr-cr-label { font-size: 0.78rem; color: var(--tr-text-muted); }
.tr-calc-result .tr-cr-value { font-size: 1.1rem; font-weight: 700; }
.tr-calc-result .tr-cr-unit { font-size: 0.7rem; color: var(--tr-text-muted); margin-left: 4px; }

/* Paginacao */
.tr-pagination {
  display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 16px;
}
.tr-pagination button {
  padding: 6px 12px; border: 1px solid var(--tr-border); border-radius: 4px;
  background: #fff; cursor: pointer; font-size: 0.8rem; transition: all 0.15s;
}
.tr-pagination button:hover:not(:disabled) { background: var(--tr-primary); color: #fff; border-color: var(--tr-primary); }
.tr-pagination button:disabled { opacity: 0.4; cursor: default; }
.tr-pagination .tr-page-active { background: var(--tr-primary); color: #fff; border-color: var(--tr-primary); }

/* Tolerancia */
.tr-tolerance-section {
  background: #f8fafc; border-radius: 8px; padding: 16px;
  border: 1px solid var(--tr-border); margin-top: 12px;
}
.tr-tol-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
}
.tr-tol-header h4 { margin: 0; font-size: 0.9rem; color: var(--tr-primary); }
.tr-tol-header h4 i { margin-right: 6px; }
.tr-tol-select {
  padding: 5px 10px; border: 1px solid var(--tr-border); border-radius: 5px;
  font-size: 0.8rem; background: #fff; cursor: pointer;
}
.tr-tol-select:focus { border-color: var(--tr-primary); outline: none; box-shadow: 0 0 0 3px rgba(6,47,135,0.1); }
.tr-tol-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; margin-top: 8px; }
.tr-tol-table th, .tr-tol-table td {
  padding: 6px 10px; border: 1px solid var(--tr-border); text-align: left;
}
.tr-tol-table th { background: var(--tr-primary); color: #fff; font-weight: 600; }
.tr-tol-table .tr-tol-val { text-align: center; }
.tr-tol-table td { background: #fff; }

/* Report actions */
.tr-report-actions { margin-top: 12px; text-align: right; }

/* ============================================================
 *  PRINT STYLES
 * ============================================================ */
@media print {
  body * { visibility: hidden; }
  #print-report, #print-report * { visibility: visible; }
  #print-report { position: absolute; left: 0; top: 0; width: 100%; padding: 20px; }
  #header-container, #footer-container, .tr-hero, .tr-filters, .tr-table-wrap,
  .tr-pagination, #tr-detail-panel .tr-detail-header button, .tr-report-actions { display: none !important; }
  #tr-detail-panel { border: none; box-shadow: none; padding: 0; }
  #tr-detail-panel.tr-active { display: block !important; }
  #tr-detail-panel .tr-calc-section { break-inside: avoid; }
  .tr-tolerance-section { break-inside: avoid; }
  #print-report { font-family: 'Fira Sans', 'Roboto', Arial, sans-serif; color: #000; }
  #print-report h2 { font-size: 1.4rem; margin-bottom: 4px; color: #062F87; }
  #print-report h3 { font-size: 1rem; margin: 16px 0 6px; color: #062F87; border-bottom: 1px solid #ccc; padding-bottom: 4px; }
  #print-report .report-header { margin-bottom: 12px; }
  #print-report .report-header p { font-size: 0.75rem; color: #555; }
  #print-report .report-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
  #print-report .report-table td { padding: 4px 8px; border: 1px solid #ccc; }
  #print-report .report-table td:first-child { font-weight: 600; background: #f0f4f8; width: 40%; }
  #print-report .report-table td:last-child { width: 60%; }
}

/* Responsivo */
@media (max-width: 768px) {
  .tr-hero { padding: 40px 16px 30px; margin-top: 110px; }
  .tr-hero h1 { font-size: 1.5rem; }
  .tr-filters .filter-row { grid-template-columns: repeat(2, 1fr); }
  .tr-detail-grid { grid-template-columns: repeat(2, 1fr); }
  .tr-table { font-size: 0.72rem; }
  .tr-table th, .tr-table td { padding: 6px 8px; }
}

/* Sobre */
.sobre-details { background: var(--tr-card-bg); border: 1px solid var(--tr-border); border-radius: 10px; padding: 16px 20px; margin: 20px auto; max-width: 1200px; }
.sobre-details summary { font-weight: 700; color: var(--tr-primary); cursor: pointer; font-size: 0.95rem; }
