﻿/* ============================
   BASE LAYOUT & TYPOGRAPHY
   ============================ */

   html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background-color: #f3f4f6;
    color: #333;
  }
  
  .app-shell {
  /* Center the entire app content with equal left/right gutters */
  max-width: 1400px;
  width: calc(100% - 48px);
  margin: 24px auto 32px auto;

  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  padding: 24px 28px 32px 28px;
  box-sizing: border-box;
}
  
  .app-header {
    border-bottom: 2px solid #d62a2a;
    padding-bottom: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
  }
  
  .app-header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #b8191e;
  }
  
  .app-subtitle {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: #6b7280;
  }
  
  /* Generic label style */
  label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 3px;
    color: #374151;
  }
  
  /* Small helper / title elements */
  .segment-title {
    font-weight: bold;
    margin-bottom: 6px;
  }
  
  /* Warnings */
  #warnings {
    color: red;
    margin-top: 10px;
  }
  
  /* ============================
     FIELDSETS / PANELS
     ============================ */
  
  fieldset {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px 14px 14px 14px;
    margin: 0;
    background-color: #fafafa;
    box-sizing: border-box;
  }
  
  legend {
    padding: 0 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #b8191e;
  }
  
  /* “Card-like” fieldsets where you used class="panel" */
  .panel {
    border: 1px solid #ccc;
    padding: 0.5rem 0.75rem;
    background-color: #fafafa;
  }
  
  /* ============================
     FORM CONTROLS
     ============================ */
  
  input[type="number"],
  input[type="text"],
  select {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    font-size: 13px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    background-color: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }
  
  input[type="number"]:focus,
  input[type="text"]:focus,
  select:focus {
    outline: none;
    border-color: #d62a2a;
    box-shadow: 0 0 0 1px rgba(214, 42, 42, 0.2);
  }
  
  input[readonly],
  input:disabled,
  select:disabled {
    background-color: #f3f4f6;
    color: #6b7280;
  }
  
  /* For those numeric inputs you explicitly classed as "input-field" */
  .input-field {
    padding: 3px;
  }
  
  /* ============================
     BUTTONS
     ============================ */
  
  /* Main red button style (can be reused by class="button-primary") */
  button[type="submit"],
  .button-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 18px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    background-color: #d62a2a;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
  }
  
  button[type="submit"]:hover,
  .button-primary:hover {
    background-color: #b8191e;
    box-shadow: 0 3px 10px rgba(214, 42, 42, 0.35);
  }
  
  button[type="submit"]:active,
  .button-primary:active {
    transform: translateY(1px);
  }
  
  /* Calculate button uses same visual language */
  .btn-calc {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 18px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    background-color: #d62a2a;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
  }
  
  .btn-calc:hover {
    background-color: #b8191e;
    box-shadow: 0 3px 10px rgba(214, 42, 42, 0.35);
  }
  
  .btn-calc:active {
    transform: translateY(1px);
  }
  
  /* Optional secondary / ghost buttons */
  .button-ghost {
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 999px;
    border: 1px solid #d62a2a;
    background: #fff;
    color: #b8191e;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
  }
  
  .button-ghost:hover {
    background-color: #fff5f5;
    color: #8f1014;
  }
  
  /* ============================
     TOP LAYOUT: DESIGN / RESULTS / CHECKS
     ============================ */
  
  /* Whole top bar: ONE ROW with 3 columns */
  .top-layout {
  margin-top: 1rem;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.75rem;
  align-items: flex-start;

  /* Make the row shrink to its visible panels, then center it */
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;

  /* If it ever exceeds viewport, allow horizontal scroll instead of breaking layout */
  overflow-x: auto;
}
  
  /* Column 1: Design mode + button */
  .design-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    flex: 0 0 280px;  /* adjust if you like */
  }
  
  /* Column 2: combined Results + Design/Optimization */
  #combined-results-design {
    flex: 1 1 0;
    min-width: 260px;
  }
  
  /* Column 3: Checks */
  #checks-panel {
    flex: 0 0 260px;
  }
  
  /* Spacing inside result texts */
  .results-block p,
  .design-group p,
  #checks-panel p {
    margin: 0.12rem 0;
  }
  
  /* ============================
     SECOND ROW: 3 COLUMNS
     ============================ */
  
  .second-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 1.5rem;
    margin-top: 1.5rem;
    align-items: flex-start;
  }
  
  /* Each column */
  .second-col {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0; /* helps avoid overflow */
  }
  
  /* Allow full width for panels inside columns */
  .second-col .panel {
    width: 100%;
    box-sizing: border-box;
  }
  
  /* ============================
     TABLES
     ============================ */
  
  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 4px;
  }
  
  th, td {
    border: 1px solid #ccc;
    padding: 4px 8px;
    text-align: left;
  }
  
  table thead {
    background-color: #f9fafb;
  }
  
  table th {
    font-weight: 600;
    color: #374151;
  }
  
  /* Zebra rows */
  table tbody tr:nth-child(odd) {
    background-color: #fdfdfd;
  }
  
  /* History table (if you use it elsewhere) */
  .history-table {
    margin-top: 20px;
  }
  
  /* Results table (if you ever show it) */
  .results-table {
    margin-top: 20px;
    width: 40%;
  }
  
  .results-table th,
  .results-table td {
    text-align: right;
  }
  
  .results-table th:first-child,
  .results-table td:first-child {
    text-align: left;
  }
  
  /* Inputs-table for Gypsum board parameters */
  .inputs-table {
    width: 100%;
  }
  
  .results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.9rem;
  }

  .results-table th,
  .results-table td {
    border: 1px solid #ddd;
    padding: 0.3rem 0.5rem;
    text-align: left;
  }

  .results-table th {
    background-color: #f5f5f5;
  }

  .ok-cell {
    font-weight: 600;
    color: #0a7b24;   /* greenish */
  }

  .notok-cell {
    font-weight: 600;
    color: #b00020;   /* reddish */
  }


  /* ============================
     SMALL HELPERS
     ============================ */
  
  .helper-text {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
  }
  
  .badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 999px;
    background-color: #fee2e2;
    color: #b8191e;
    vertical-align: middle;
  }
  
  /* ============================
     RESPONSIVE (MOBILE)
     ============================ */
  
  @media (max-width: 768px) {
    .app-shell {
      margin: 0;
      border-radius: 0;
      box-shadow: none;
      padding: 16px 14px 24px 14px;
    }
  
    .top-layout {
      flex-direction: column;
      width: 100%;
    }
  
    .second-row {
      flex-direction: column;
    }
  
    .second-col {
      width: 100%;
    }
  
    fieldset,
    fieldset.panel {
      width: 100%;
      box-sizing: border-box;
    }
  
    .btn-calc {
      width: 100%;
    }
  
    table {
      width: 100%;
      font-size: 0.9rem;
    }
  
    input[type="number"],
    input[type="text"],
    select {
      width: 100%;
      box-sizing: border-box;
    }
  }
  
  .sort-btn {
  border: none;
  background: none;
  padding: 0 2px;
  cursor: pointer;
  font-size: 0.8rem;
}
.sort-btn:focus {
  outline: none;
}

.tab-bar {
  margin-bottom: 0.75rem;
  border-bottom: 1px solid #ccc;
}

.tab-button {
  border: none;
  background: #eee;
  padding: 0.4rem 0.9rem;
  margin-right: 0.3rem;
  cursor: pointer;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  font-size: 0.9rem;
}

.tab-button.active {
  background: #fff;
  border: 1px solid #ccc;
  border-bottom-color: #fff;
  font-weight: 600;
}

/* Make the wall-parameter fieldset look decent when it is the only column */
.wall-params-panel {
  max-width: 400px;        /* pick 600–800px to taste */
  width: 100%;             /* so the table uses the available width inside */
  margin: 0.75rem auto 0;  /* auto left/right = centered */
}

/* Optional: keep the internal table tidy */
.wall-params-panel table {
  width: 100%;
}

/* ============================
   REPORT MODAL
   ============================ */

.report-modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 9999;
}

.report-modal{
  width: min(900px, 96vw);
  max-height: 85vh;
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 14px 40px rgba(0,0,0,0.25);
  padding: 12px 14px;
}

.report-modal-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.report-modal-close{
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
}

.report-table{
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.report-table th,
.report-table td{
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
  vertical-align: top;
}

.report-table th{
  background: #f9fafb;
  width: 38%;
  font-weight: 600;
}


.app-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 1rem;
}

.header-logo{
  height: 44px;      /* adjust */
  width: auto;
  object-fit: contain;
  display:block;
}

/* Back button (gray) */
.btn-back{
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;

  padding: 8px 12px;
  border-radius: 10px;

  background: #5e5e6d;      /* light gray */
  border: 1px solid #b8191e;
  color: #ffffff;           /* dark gray text */
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
}

.btn-back:hover{
  background: #b8191e;
}

.btn-back:active{
  transform: translateY(1px);
}

.btn-back-icon{
  font-size: 1.15rem;
  line-height: 1;
}

/* Landing page tool images */
.tool-image-link{
  display:block;
  margin-top: 0.75rem;
  border-radius: 10px;
  overflow:hidden;
}

.tool-image{
  width: 100%;
  height: auto;
  display:block;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  cursor: pointer;
}

.tool-image-link:hover .tool-image{
  transform: scale(1.02);
  box-shadow: 0 10px 26px rgba(0,0,0,0.15);
}

/* =========================
   Modal (Wallcase pickers)
   ========================= */
.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
  display: none;           /* JS "flex" yapacak */
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box{
  background: #fff;
  width: min(720px, 95vw);
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.modal-close{
  border: none;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 6px;
}

.modal-body{
  padding: 12px 14px;
  overflow: auto;
}

.modal-list{
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 10px;
  padding: 8px;
  max-height: 46vh;
  overflow: auto;
}

.modal-item{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.modal-item:hover{
  background: rgba(0,0,0,0.04);
}

.modal-footer{
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 14px;
  border-top: 1px solid rgba(0,0,0,0.08);
}

.btn-cancel{
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.18);
  background: #fff;
  cursor: pointer;
}
