/* ==============================================================================
   ANSYS FEA Results Portal - Professional Engineering Stylesheet
   Clean Light Theme - Human-Crafted, No AI-Generated Shaded Badges
   ============================================================================== */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #f8fafc;
  color: #1e293b;
  line-height: 1.5;
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background-color: #ffffff;
  border-bottom: 1px solid #cbd5e1;
  padding: 16px 24px;
}

.header-titles h1 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.header-titles .subtitle {
  font-size: 13px;
  color: #64748b;
  margin-top: 2px;
}

.header-right {
  display: flex;
  gap: 8px;
}

/* Navigation Tabs */
.nav-tabs {
  background-color: #ffffff;
  border-bottom: 1px solid #cbd5e1;
  display: flex;
  padding: 0 24px;
  gap: 8px;
  overflow-x: auto;
}

.nav-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: #475569;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-tab:hover {
  color: #0f172a;
}

.nav-tab.active {
  color: #1d4ed8;
  border-bottom-color: #1d4ed8;
}

/* Main Container */
.main-container {
  padding: 20px 24px 60px 24px;
  flex: 1;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

/* Tab Contents */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Content Box (Standard Clean Card) */
.content-box {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 18px 20px;
  margin-bottom: 20px;
}

.box-header {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 10px;
  margin-bottom: 16px;
}

.box-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

/* Page Title Block */
.page-title-block {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 16px 20px;
}

.page-title-block h2 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.section-desc {
  font-size: 13px;
  color: #64748b;
  margin-top: 3px;
}

.cal-toggle-wrap {
  display: flex;
  align-items: center;
}

.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.toggle-control input {
  cursor: pointer;
  accent-color: #1d4ed8;
}

/* Table Group */
.table-group {
  margin-bottom: 22px;
}

.table-group:last-child {
  margin-bottom: 0;
}

.table-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.table-header-row h4 {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

/* View Switch Buttons */
.view-switch-btns {
  display: inline-flex;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  overflow: hidden;
  background-color: #ffffff;
}

.btn-view {
  background: none;
  border: none;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  border-right: 1px solid #e2e8f0;
}

.btn-view:last-child {
  border-right: none;
}

.btn-view:hover {
  background-color: #f1f5f9;
}

.btn-view.active {
  background-color: #e2e8f0;
  color: #0f172a;
  font-weight: 600;
}

/* Data Tables */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background-color: #ffffff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: center;
}

.data-table th {
  background-color: #f1f5f9;
  color: #1e293b;
  padding: 9px 12px;
  font-weight: 600;
  border-bottom: 1px solid #cbd5e1;
  border-right: 1px solid #e2e8f0;
  white-space: nowrap;
}

.data-table th:last-child {
  border-right: none;
}

/* Page 1 and Page 2: Compact Container & Proportional Column Widths */
#page-1,
#page-2 {
  max-width: 1040px;
  margin: 0 auto;
}

#page-1 .data-table,
#page-2 .data-table {
  width: 100%;
  table-layout: fixed;
}

/* Support Spacing: width meets the width of the text "Support Spacing" */
#page-1 .data-table th:first-child,
#page-1 .data-table td:first-child,
#page-2 .data-table th:first-child,
#page-2 .data-table td:first-child {
  width: 130px;
  min-width: 125px;
  max-width: 135px;
  text-align: center;
  font-weight: 700;
  padding: 8px 10px;
  white-space: nowrap;
  background-color: #fafafa;
}

/* Load columns (100 lbs - 400 lbs): width reduced accordingly */
#page-1 .data-table th:not(:first-child):not(:last-child),
#page-1 .data-table td:not(:first-child):not(:last-child),
#page-2 .data-table th:not(:first-child):not(:last-child),
#page-2 .data-table td:not(:first-child):not(:last-child) {
  padding: 8px 4px;
}

/* View Images column: fits header and button */
#page-1 .data-table th:last-child,
#page-1 .data-table td:last-child,
#page-2 .data-table th:last-child,
#page-2 .data-table td:last-child {
  width: 105px;
  min-width: 100px;
  max-width: 110px;
  text-align: center;
  padding: 6px 6px;
  border-right: none;
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  white-space: nowrap;
  vertical-align: middle;
}

.data-table td:last-child {
  border-right: none;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover td {
  background-color: #f8fafc;
}

/* Deformation Cells (Plain Text, No Badges) */
.def-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
}

.def-line {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.def-lbl {
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
}

.stress-cell {
  font-weight: 600;
}

/* Plain Text Status Labels (Zero Shading / Zero Pills) */
.status-text {
  font-weight: 600;
  font-size: 12.5px;
}

.status-safe {
  color: #166534;
}

.status-marginal {
  color: #b45309;
}

.status-fail {
  color: #b91c1c;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background-color: #1d4ed8;
  color: #ffffff;
  border-color: #1d4ed8;
}

.btn-primary:hover {
  background-color: #1e40af;
  border-color: #1e40af;
}

.btn-secondary {
  background-color: #ffffff;
  color: #334155;
  border-color: #cbd5e1;
}

.btn-secondary:hover {
  background-color: #f1f5f9;
}

.btn-sm {
  padding: 3px 8px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

/* Form Controls */
.form-group {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-control {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  padding: 7px 10px;
  border-radius: 4px;
  font-size: 13.5px;
  outline: none;
}

.form-control:focus {
  border-color: #2563eb;
}

/* Page 3: Side-by-Side & Parameter Selector Layout */
#page-3 {
  max-width: 1260px;
  margin: 0 auto;
}

#page-3 .page-3-form-wrap {
  max-width: 760px;
  margin: 0 auto 1.5rem auto;
}

#page-3 .form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.p3-side-layout {
  display: grid;
  grid-template-columns: 42% 58%;
  gap: 20px;
  align-items: start;
}

@media (max-width: 960px) {
  .p3-side-layout {
    grid-template-columns: 1fr;
  }
}

.p3-viewer-card {
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 14px 16px;
  background: #ffffff;
}

/* Modal Slider & Zoom Viewport */
.btn-view-plots {
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-view-plots:hover {
  background-color: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}

.modal-container {
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 1000px;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #cbd5e1;
}

.modal-header {
  padding: 12px 18px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f8fafc;
  gap: 12px;
  flex-wrap: wrap;
}

.modal-title-wrap h3 {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.modal-subtitle {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

.modal-load-tabs {
  display: flex;
  gap: 4px;
  background-color: #e2e8f0;
  padding: 3px;
  border-radius: 4px;
}

.btn-load-tab {
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: #475569;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-load-tab.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  color: #64748b;
  cursor: pointer;
  line-height: 1;
  padding: 0 6px;
}

.modal-close-btn:hover {
  color: #0f172a;
}

.modal-body {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.viewer-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 4px;
}

.plot-name-label {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.zoom-controls .btn-xs {
  padding: 2px 8px;
  font-size: 11.5px;
  height: 24px;
  min-width: 24px;
}

.zoom-level-text {
  font-size: 11.5px;
  color: #64748b;
  min-width: 44px;
  text-align: center;
  font-weight: 600;
}

.viewer-viewport {
  position: relative;
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
  cursor: grab;
}

.p3-viewer-card .viewer-viewport {
  height: 400px;
}

.viewer-viewport:active {
  cursor: grabbing;
}

.image-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  transition: transform 0.05s ease-out;
  transform-origin: center center;
}

.zoomable-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.img-fallback {
  padding: 30px 20px;
  text-align: center;
  color: #64748b;
  max-width: 480px;
}

.img-fallback h4 {
  font-size: 14px;
  color: #334155;
  margin-bottom: 6px;
}

.img-fallback p {
  font-size: 12px;
  line-height: 1.5;
  color: #64748b;
  word-break: break-all;
}

.slider-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(15, 23, 42, 0.65);
  color: #ffffff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  z-index: 10;
  transition: background-color 0.15s;
}

.slider-arrow:hover {
  background-color: rgba(15, 23, 42, 0.9);
}

.arrow-prev { left: 12px; }
.arrow-next { right: 12px; }

.thumbnails-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 2px;
}

.thumbnail-item {
  flex: 1 1 0;
  min-width: 95px;
  border: 2px solid #e2e8f0;
  border-radius: 4px;
  padding: 4px;
  background-color: #ffffff;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.thumbnail-item:hover {
  border-color: #94a3b8;
}

.thumbnail-item.active {
  border-color: #0f172a;
  background-color: #f8fafc;
}

.thumbnail-item img {
  width: 100%;
  height: 52px;
  object-fit: cover;
  border-radius: 2px;
  display: block;
}

.thumbnail-item .thumb-label {
  font-size: 10px;
  color: #475569;
  font-weight: 600;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.interactive-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .interactive-layout {
    grid-template-columns: 1fr;
  }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 20px;
  text-align: center;
  color: #64748b;
}

.empty-state h4 {
  font-size: 15px;
  color: #334155;
  margin-bottom: 4px;
}

.p3-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.p3-metric-card {
  background-color: #fafafa;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 14px 16px;
}

.p3-metric-card .label {
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
}

.p3-metric-card .val {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin-top: 4px;
}

/* Page 4: Width Reduction & Layout */
#page-4 {
  max-width: 1160px;
  margin: 0 auto;
}

/* Page 4: All 4 dropdown selection cards in a single line */
.config-cards-grid,
.compare-selectors-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.config-card {
  padding: 12px 14px;
}

.config-card .form-group {
  margin-bottom: 10px;
}

.config-card .form-group:last-child {
  margin-bottom: 0;
}

.config-card .form-group label {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  margin-bottom: 3px;
  display: block;
}

.config-card .form-control {
  padding: 5px 8px;
  font-size: 12.5px;
  height: 32px;
  width: 100%;
}

.config-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
}

.config-header h4 {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: #475569;
}

.checkbox-inline input {
  accent-color: #1d4ed8;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: #64748b;
  border-top: 1px solid #e2e8f0;
  background-color: #ffffff;
  margin-top: auto;
}

/* Print Rules */
@media print {
  .app-header .header-right,
  .nav-tabs,
  .btn,
  .app-footer,
  .cal-toggle-wrap,
  .view-switch-btns {
    display: none !important;
  }

  body {
    background-color: #ffffff !important;
    color: #000000 !important;
  }

  .content-box,
  .page-title-block {
    border: 1px solid #cbd5e1 !important;
    page-break-inside: avoid;
  }

  .tab-content {
    display: block !important;
    margin-bottom: 24px;
  }
}
