
/* ========================================= */
/*              GLOBAL STYLES                */
/* ========================================= */

body {
  background: #fff;
  color: #222;
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
}

h2 {
  margin-top: 0;
  font-size: 1.3rem;
}

header {
  text-align: left;
  margin-bottom: 1.5rem;
  padding-left: 0.25rem;
}

.main-header {
  margin-bottom: 2rem;
  padding-left: 0rem;
}

.main-header h1 {
  font-size: 1.8rem;
  margin: 0;
  text-align: left;
}

#app {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* ========================================= */
/*              LAYOUT STYLES                */
/* ========================================= */

.page-wrapper {
  width: 900px;
  margin: 0 auto;
  padding: 0 1rem;
}

.section-box {
  padding: 1rem;
  background: #f8f8f8;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.section-flex {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

/* ========================================= */
/*              INPUT STYLES                 */
/* ========================================= */

input {
  width: fit-content;
  display: block;
  box-sizing: border-box;
  padding: 0.4rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  margin-top: 0.3rem;
  margin-bottom: 0.3rem;
}

select {
  width: fit-content;
  display: block;
  box-sizing: border-box;
  padding: 0.4rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  margin-top: 0.3rem;
  margin-bottom: 0.3rem;
}


input[type="number"] {
  width: 200px;
  padding: 4px 8px;
}

/* ========================================= */
/*             TABLE STYLES                  */
/* ========================================= */

.material-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #ccc;
  border-radius: 8px;
  overflow: hidden;
}

.material-table th, .material-table td {
  border: 1px solid #ccc;
  padding: 0.5rem;
  text-align: center;
}

.material-table th {
  background: #eaeaea;
}

/* === KEVENNYS TABLE === */
#kevennys-material-table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  overflow: hidden;
}

#kevennys-material-table-wrapper th, #kevennys-material-table-wrapper td {
  border: 1px solid #ccc;
  padding: 0.4rem;
  text-align: center;
}

#kevennys-material-table-wrapper th {
  background: #eaeaea;
}

/* === PAINUMA TABLE === */
#painuma-material-table-wrapper table,
#painuma-soil-table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  overflow: hidden;
}

#painuma-material-table-wrapper th, #painuma-material-table-wrapper td,
#painuma-soil-table-wrapper th, #painuma-soil-table-wrapper td {
  border: 1px solid #ccc;
  padding: 0.4rem;
  text-align: center;
}

#painuma-material-table-wrapper th, #painuma-soil-table-wrapper th {
  background: #eaeaea;
}

#painuma-soil-table-wrapper input {
  width: 100%;
  padding: 4px 6px;
  box-sizing: border-box;
}

/* ========================================= */
/*      KANTAVUUS VISUALIZATION STYLES       */
/* ========================================= */

#visualization-container {
  flex: 1;
  border: 1px solid #ccc;
  background: #f9f9f9;
  padding: 10px;
  min-height: 100%;
  max-width: 260px;
  width: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.vis-layer {
  width: 100%;
  min-height: 30px;
  text-align: center;
  border: 1px solid #aaa;
  background: #ddd;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* === Layer Colors === */
.vis-pintakerros { background: #dddddd !important; }
.vis-kantava { background: #e4e4e4 !important; }
.vis-jakava { background: #eeeeee !important; }
.vis-pohjamaa { background: #e8d5b5 !important; }
.vis-layer.kevennys { background: #cceeff; }
.vis-layer.eps { background: #e6ccff; }
.vis-layer.suodatin { background: #ffeebb; }

/* === Labels === */
.vis-dig-label, .vis-ground-label, .vis-korotus-label {
  position: absolute;
  left: 5px;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.8);
  padding: 2px 4px;
  border: 1px solid #aaa;
  border-radius: 4px;
  z-index: 10;
}

/* ========================================= */
/*         SETTLEMENT VISUALIZATION          */
/* ========================================= */

#settlement-plot-container {
  width: 100%;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  border: 1px solid #ccc;
  background: white;
  padding: 10px;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.settle-bar {
  border-radius: 4px;
  background: #66a3ff;
  text-align: right;
  color: white;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4);
  text-indent: 4px;
  white-space: nowrap;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
}

.settle-bar.oc {
  background: #ff6666;
}

/* ========================================= */
/*             RESULT & DEBUG STYLES         */
/* ========================================= */

.results-block {
  padding: 0.2rem 0;
  font-size: 1.05rem;
}

.kevennys-output, .painuma-output {
  margin-top: 1rem;
  font-size: 1.05rem;
}

#painuma-debug-output {
  margin-top: 1em;
  max-height: 400px;
  overflow-y: auto;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.85rem;
  background-color: #f9f9f9;
  border: 1px solid #ccc;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.05);
}

#painuma-debug-output table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5em;
}

#painuma-debug-output th, #painuma-debug-output td {
  border: 1px solid #ddd;
  padding: 4px 8px;
  text-align: right;
}

#painuma-debug-output th {
  background-color: #f0f0f0;
  font-weight: bold;
}

#painuma-debug-output tr:nth-child(even) {
  background-color: #fafafa;
}

/* ========================================= */
/*           UTILITY & FIXES                 */
/* ========================================= */

#layer-rows select { min-width: 260px; }
#layer-rows td { padding: 4px 8px; }
#routanousu-warning { margin-left: 6px; font-size: 0.9rem; font-weight: bold; }

.routa-neutral { color: #aaa; }

/* ========================================= */
/*                 INFO BOXES                */
/* ========================================= */

.info-icon {
  display: inline-block;
  cursor: pointer;
  font-size: 0.9rem;
  color: #007bff;
  margin-left: 4px;
}

.info-box {
  max-width: 800px;
  position: absolute;
  background: white;
  border: 1px solid #ccc;
  padding: 10px;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  top: 50px;
  text-align: center;
  z-index: 100;
}

.hidden {
  display: none;
}

.info-box button {
  margin-top: 8px;
  padding: 4px 8px;
  border: none;
  background: #007bff;
  color: white;
  border-radius: 4px;
  cursor: pointer;
}

.info-box button:hover {
  background: #0056b3;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
}

.info-table th, .info-table td {
  border: 1px solid #ccc;
  padding: 6px;
  text-align: left;
}

.info-table th {
  background: #f0f0f0;
  font-weight: bold;
}

.info-lisatekstit {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: #444;
  background: #f9f9f9;
  padding: 0.8rem;
  border-left: 4px solid #0077cc;
  border-radius: 4px;
  line-height: 1.4;
}
