/* ============================================================
   DrillForceaMeister Cost Reduction Simulator — Stylesheet
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-family: "Noto Sans JP", sans-serif;
  font-size: 15px;
  line-height: 26px;
  color: #2B2B2B;
  background: #FFF;
}

body { min-height: 100vh; }

/* --- Hero --- */
.hero {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}
.hero img {
  width: 100%;
  height: auto;
  display: block;
}

/* --- Header --- */
header {
  background: #0A0A0A;
  color: #FFF;
  height: 60px;
  display: flex;
  align-items: center;
}
.header-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.header-logo {
  height: 42px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.header-title {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Toggle buttons (lang, unit) */
.toggle-group {
  display: flex;
  border: 1px solid #555;
  border-radius: 4px;
  overflow: hidden;
}
.toggle-btn {
  background: transparent;
  color: #ccc;
  border: none;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.toggle-btn.active {
  background: #0D974A;
  color: #FFF;
}

/* Currency selector */
.currency-wrapper select {
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #555;
  background: #222;
  color: #FFF;
}

/* --- Content Area --- */
.content {
  width: 770px;
  max-width: 100%;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

/* --- Section Titles --- */
.section-title {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  border-bottom: 1px solid #DBDBDB;
  padding-bottom: 10px;
  margin-bottom: 20px;
  margin-top: 40px;
}
.section-title:first-of-type { margin-top: 0; }

/* --- Tool Type Selector --- */
.tool-type-selector {
  display: flex;
  gap: 24px;
  margin-bottom: 30px;
}
.tool-type-selector label {
  cursor: pointer;
  font-size: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.tool-type-icon {
  display: block;
  max-width: 120px;
  height: auto;
}
.tool-type-icon--head {
  max-width: 84px;
}

/* --- Form Tables --- */
.p-userdata {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}
.p-userdata th {
  font-size: 15px;
  font-weight: 400;
  color: #333;
  padding: 15px 7px;
  text-align: left;
  vertical-align: middle;
  width: 45%;
}
.p-userdata td {
  padding: 15px 7px;
  vertical-align: middle;
}
.p-userdata input[type="number"],
.p-userdata select {
  width: 260px;
  max-width: 60%;
  height: 40px;
  font-family: Arial, sans-serif;
  font-size: 15px;
  color: #000;
  background: #FAFAFA;
  border: 1px solid #DBDBDB;
  border-radius: 0;
  padding: 10px 20px;
  text-align: right;
}
.p-userdata select { text-align: left; }

.unit-label {
  font-size: 15px;
  color: #333;
  margin-left: 6px;
}

.required-note {
  font-size: 13px;
  color: #999;
  margin-bottom: 10px;
}
.discount-note {
  font-size: 13px;
  color: #666;
  margin-bottom: 10px;
}

.auto-calc-value {
  display: inline-block;
  min-width: 80px;
  font-family: Arial, sans-serif;
  font-size: 15px;
  text-align: right;
}
.auto-calc-badge {
  font-size: 12px;
  color: #0D974A;
  margin-left: 8px;
}

/* --- Errors --- */
.error-msg {
  color: #D32F2F;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 0;
  text-align: center;
}

/* --- Primary Button --- */
.primary-btn {
  display: block;
  width: 300px;
  height: 50px;
  margin: 30px auto;
  font-size: 20px;
  font-weight: 700;
  font-family: "Noto Sans JP", sans-serif;
  color: #FFF;
  background: #0D974A;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity .2s;
}
.primary-btn:hover { opacity: .85; }

/* --- Result Section --- */
.p-result {
  border: 4px solid #0D974A;
  border-radius: 4px;
  padding: 30px;
  margin-top: 40px;
}
.result-title {
  font-size: 24px;
  font-weight: 700;
  color: #0D974A;
  margin-bottom: 20px;
}
.result-card {
  background: #FFF;
  border-radius: 4px;
  padding: 20px;
  margin: 12px 0 30px;
}
.result-subtitle {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  border-bottom: 1px solid #DBDBDB;
  padding-bottom: 10px;
  margin-bottom: 10px;
}
.reduction-title {
  font-size: 16px;
  font-weight: 400;
  color: #333;
  border-bottom: 1px solid #DBDBDB;
  padding-bottom: 10px;
  margin-bottom: 10px;
  margin-top: 20px;
}
.result-table {
  width: 100%;
  border-collapse: collapse;
}
.result-table th {
  font-size: 15px;
  font-weight: 700;
  color: #333;
  padding: 5px 7px;
  text-align: left;
  width: 55%;
}
.result-table td {
  font-size: 15px;
  font-weight: 400;
  color: #333;
  padding: 5px 10px;
  text-align: right;
}

/* Highlighted value rows (holes, savings) */
.highlight-row th {
  vertical-align: middle;
}
.val-highlight {
  font-size: 28px;
  font-weight: 700;
  color: #E8382F;
  white-space: nowrap;
}

/* Sub rows (cutting length) */
.sub-row th {
  font-weight: 400;
  color: #888;
  font-size: 13px;
  padding-left: 24px;
}
.val-sub {
  font-size: 16px;
  font-weight: 400;
  color: #888;
  white-space: nowrap;
}

/* --- Chart --- */
.chart-card canvas {
  width: 100% !important;
  max-width: 662px;
  height: auto !important;
}

/* --- Print Button (inside result) --- */
.print-btn {
  width: 250px;
}

/* --- Exchange Rate Info --- */
.exchange-rate-info {
  text-align: center;
  font-size: 12px;
  color: #888;
  padding: 10px 0;
}

/* --- Print Conditions (screen-hidden, print-visible) --- */
.print-conditions {
  display: none;
}
.print-conditions h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
}
.print-conditions table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}
.print-conditions th,
.print-conditions td {
  padding: 4px 8px;
  font-size: 14px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}
.print-conditions th { font-weight: 600; width: 45%; }

/* ============ RESPONSIVE ============ */

@media (max-width: 1023px) {
  .content {
    width: 100%;
    padding: 20px;
  }
}

@media (max-width: 767px) {
  .header-inner {
    flex-direction: column;
    height: auto;
    padding: 8px 12px;
    gap: 6px;
  }
  header { height: auto; }
  .header-title { font-size: 13px; }

  .content { padding: 16px 12px; }

  .tool-type-selector {
    flex-direction: column;
    gap: 10px;
  }

  .p-userdata th,
  .p-userdata td {
    display: block;
    width: 100%;
    padding: 6px 4px;
  }
  .p-userdata input[type="number"],
  .p-userdata select {
    width: 100%;
    max-width: 100%;
  }

  .primary-btn { width: 100%; }

  .p-result { padding: 16px; }

  /* Result tables: stack th/td vertically */
  .result-table th,
  .result-table td {
    display: block;
    width: 100%;
    text-align: left;
  }
  .result-table td {
    padding-bottom: 12px;
  }

  /* Highlighted values */
  .val-highlight {
    font-size: 24px;
  }

  /* Charts: ensure minimum height on mobile */
  .chart-card canvas {
    min-height: 250px;
  }
}

/* ============ PRINT ============ */

@media print {
  header,
  .input-area,
  button,
  .exchange-rate-info { display: none !important; }

  .print-conditions { display: block !important; }

  .p-result {
    display: block !important;
    border: 2px solid #333;
  }

  .content { width: 100%; padding: 0; }
}
