/* ============================================
   WIRE CALCULATOR — style.css
   KK Wiring / Mozello premium ecommerce theme
   ============================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  background: #ffffff;
  color: #000000;
  font-family: 'Raleway', Arial, Helvetica, sans-serif;
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

.calculator-wrap {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 12px;
  overflow-x: auto;
}

/* ============================================
   INFO BOX — KK Wiring current rating note
   ============================================ */

.info-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #f5f5f5;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 16px;
  color: #555;
  line-height: 1.5;
}

.info-icon {
  flex-shrink: 0;
  font-size: 16px;
  margin-top: 2px;
}

/* ============================================
   INFO BOX CONTENT — merged rating note + criteria
   ============================================ */

.info-box-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.selection-criteria {
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.08);
  font-size: 16px;
  color: #666;
  line-height: 1.5;
}

/* ============================================
   TABLE
   ============================================ */

.sheet-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  table-layout: fixed;
}

.sheet-title {
  font-size: 16px;
  font-weight: 800;
  text-align: left;
  padding: 10px 0 14px;
  color: #000;
  border-bottom: 2px solid #000;
}

.sheet-table th {
  padding: 10px 6px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  white-space: normal;
  word-wrap: break-word;
}

.sheet-table td {
  padding: 8px 6px;
  text-align: center;
  font-size: 15px;
  vertical-align: middle;
  height: 48px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

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

/* ============================================
   INPUTS — blend into cells
   ============================================ */

.sheet-table input,
.sheet-table select {
  width: 100%;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 15px;
  font-family: 'Raleway', Arial, Helvetica, sans-serif;
  padding: 6px 2px;
  outline: none;
  box-sizing: border-box;
  color: #000;
}

.sheet-table input::placeholder {
  color: #ccc;
}

.sheet-table input:focus,
.sheet-table select:focus {
  background: #f8f9fa;
  border-radius: 2px;
}

/* Remove number spinners */
.sheet-table input[type="number"]::-webkit-inner-spin-button,
.sheet-table input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.sheet-table input[type="number"] {
  -moz-appearance: textfield;
}

/* Select dropdown */
.sheet-table select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 22px;
}

.sheet-table select option {
  background: #fff;
  color: #000;
}

/* ============================================
   RESULT CELLS
   ============================================ */

.result-wire {
  font-weight: 800;
  font-size: 16px;
}

.wire-combined {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.wire-value {
  font-weight: 800;
  font-size: 16px;
}

.wire-sub {
  font-size: 12px;
  font-weight: 500;
  color: #888;
}

.result-voltage-at-device {
  font-weight: 700;
  font-size: 15px;
}

.result-voltage-drop {
  font-weight: 500;
  font-size: 15px;
  color: #666;
}

/* ============================================
   COLUMN CLASSES — width control & visual weight
   ============================================ */

.col-device {
  width: 20%;
}

.col-wire {
  width: 14%;
}

.col-voltage-device {
  width: 14%;
}

.col-secondary {
  width: 10%;
}

.sheet-table th.col-secondary {
  font-weight: 500;
  color: #999;
}

.sheet-table td.col-secondary {
  color: #888;
  font-weight: 400;
}

.sheet-table td.col-secondary input,
.sheet-table td.col-secondary select {
  color: #888;
  font-weight: 400;
}

.sheet-table td.col-secondary .result-voltage-drop {
  color: #888;
  font-weight: 400;
}

.pass-cell {
  background: #d4edda !important;
}

.fail-cell {
  background: #fdecea !important;
}

.warning-cell {
  background: #fff3cd !important;
  color: #856404;
  font-weight: 600;
}

.voltage-good {
  background: #d4edda !important;
  color: #155724;
  font-weight: 700;
}

.voltage-warn {
  background: #fff3cd !important;
  color: #856404;
  font-weight: 700;
}

.voltage-bad {
  background: #f8d7da !important;
  color: #721c24;
  font-weight: 700;
}

/* ============================================
   TOP CONTROLS — system voltage + wire type
   ============================================ */

.top-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 12px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.control-group label {
  font-size: 16px;
  font-weight: 800;
  color: #000;
}

.control-group input,
.control-group select {
  padding: 8px 10px;
  font-size: 15px;
  font-family: 'Raleway', Arial, Helvetica, sans-serif;
  font-weight: 700;
  border: 1px solid #ccc;
  border-radius: 4px;
  outline: none;
  color: #000;
  background: #fff;
}

.control-group input:focus,
.control-group select:focus {
  border-color: #666;
}

.control-group input {
  width: 90px;
}

.control-group select {
  width: 160px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

.control-group select option {
  background: #fff;
  color: #000;
}

.control-helper {
  font-size: 16px;
  color: #888;
  line-height: 1.5;
}

@media (max-width: 768px) {
  .top-controls {
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
  }

  .control-group {
    align-items: center;
  }

  .control-group input {
    font-size: 16px;
    width: 100px;
  }

  .control-group select {
    font-size: 16px;
    text-align-last: center;
  }

  .control-helper {
    text-align: center;
  }
}

/* ============================================
   ADD CONSUMER BUTTON
   ============================================ */

.add-consumer-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  font-family: 'Raleway', Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: #27ae60;
  border: 1px solid #27ae60;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.add-consumer-btn:hover {
  background: #1e8449;
  border-color: #1e8449;
}

/* ============================================
   REMOVE BUTTON COLUMN
   ============================================ */

.remove-col {
  width: 44px;
}

.remove-cell {
  width: 44px;
  padding: 0;
  text-align: center;
  vertical-align: middle;
}

.remove-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  color: #999;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.remove-row:hover {
  color: #c0392b;
  background: #fdecea;
  border-color: #e8b4b4;
}

/* ============================================
   PROJECT SAVE / LOAD BUTTONS
   ============================================ */

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

.primary-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.danger-actions {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.project-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  font-family: 'Raleway', Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.save-btn {
  color: #fff;
  background: #27ae60;
  border-color: #27ae60;
}

.save-btn:hover {
  background: #1e8449;
  border-color: #1e8449;
}

.new-btn {
  color: #fff;
  background: #c0392b;
  border-color: #c0392b;
}

.new-btn:hover {
  background: #a93226;
  border-color: #a93226;
}

/* ============================================
   TOAST MESSAGE
   ============================================ */

.toast-message {
  margin-top: 10px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast-message.show {
  opacity: 1;
}

.toast-message.success {
  background: #eaf7ea;
  color: #27ae60;
}

.toast-message.error {
  background: #fdecea;
  color: #c0392b;
}

/* ============================================
   CONFIRMATION MODAL
   ============================================ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.45);
  justify-content: center;
  align-items: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: #fff;
  border-radius: 8px;
  padding: 28px 28px 24px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.modal-text {
  font-size: 15px;
  line-height: 1.5;
  color: #000;
  margin: 0 0 22px;
  text-align: center;
  font-weight: 600;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.modal-btn {
  min-width: 120px;
  justify-content: center;
  font-size: 15px;
  padding: 10px 22px;
}

.cancel-btn {
  color: #555;
  background: #f0f0f0;
  border-color: #d0d0d0;
}

.cancel-btn:hover {
  background: #e0e0e0;
  border-color: #bbb;
}

.confirm-btn {
  color: #fff;
  background: #c0392b;
  border-color: #c0392b;
}

.confirm-btn:hover {
  background: #a93226;
  border-color: #a93226;
}

/* ============================================
   FOOTNOTE
   ============================================ */

.table-footnote {
  font-size: 12px;
  color: #999;
  margin-top: 12px;
  text-align: left;
}

/* ============================================
   WIRE DIAGRAM
   ============================================ */

.wire-diagram {
  text-align: center;
  margin: 24px 0 28px;
}

.wire-diagram h2 {
  font-size: 18px;
  font-weight: 700;
  color: #000;
  margin: 0 0 12px;
  text-align: left;
}

.wire-diagram p {
  font-size: 16px;
  line-height: 1.6;
  color: #555;
  margin: 0 0 16px;
  text-align: left;
}

.wire-diagram p strong {
  color: #000;
}

.wire-diagram img {
  max-width: 850px;
  width: 100%;
  height: auto;
  display: block;
  margin: 16px auto;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
}

/* ============================================
   RESPONSIVE — mobile stacked card layout
   ============================================ */

/* Mobile-only elements, hidden on desktop */
.mobile-title {
  display: none;
}

@media (max-width: 768px) {
  .calculator-wrap {
    width: 100%;
    padding: 16px;
    overflow: visible;
  }

  #calculator-form {
    overflow: visible;
  }

  /* Convert table to stacked cards */
  .sheet-table {
    display: block;
    min-width: 0;
    width: 100%;
    table-layout: auto;
  }

  .sheet-table thead {
    display: none;
  }

  .sheet-table tbody,
  .sheet-table tr {
    display: block;
    width: 100%;
  }

  .sheet-table tr {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
  }

  .sheet-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    height: auto;
    min-height: 42px;
    text-align: right;
    font-size: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  }

  .sheet-table td:last-child {
    border-bottom: none;
  }

  .sheet-table td.remove-cell {
    justify-content: center;
    padding: 4px 0 0;
    border-bottom: none;
    min-height: 0;
  }

  .sheet-table td.remove-cell::before {
    display: none;
  }

  .sheet-table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 12px;
    text-align: left;
    flex-shrink: 0;
  }

  .sheet-table input,
  .sheet-table select {
    width: auto;
    flex: 1;
    max-width: 55%;
    text-align: right;
    font-size: 16px;
    min-height: 42px;
    padding: 6px 8px;
    border: none;
    background: transparent;
    font-family: 'Raleway', Arial, Helvetica, sans-serif;
    outline: none;
    color: #000;
  }

  .sheet-table input::placeholder {
    color: #ccc;
  }

  .sheet-table input:focus,
  .sheet-table select:focus {
    background: #fff;
    border-radius: 2px;
  }

  .sheet-table select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
    padding-right: 20px;
  }

  .sheet-table select option {
    background: #fff;
    color: #000;
  }

  .sheet-table input[type="number"]::-webkit-inner-spin-button,
  .sheet-table input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }

  .sheet-table input[type="number"] {
    -moz-appearance: textfield;
  }

  /* Show mobile-only elements */
  .mobile-title {
    display: block;
    font-size: 18px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 16px;
  }

  /* Responsive image */
  .wire-diagram img {
    max-width: 100%;
  }

  /* ============================================
     ACTION BUTTONS — mobile two-row centered layout
     ============================================ */

  .project-actions {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
  }

  .primary-actions {
    width: 100%;
    justify-content: center;
    gap: 8px;
  }

  .primary-actions button {
    flex: 1;
    max-width: 150px;
    justify-content: center;
  }

  .danger-actions {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  .danger-actions button {
    width: 150px;
    justify-content: center;
  }

  /* ============================================
     MOBILE TYPOGRAPHY OVERRIDES — restore previous mobile sizes
     ============================================ */

  .control-group label {
    font-size: 14px;
  }

  .control-helper {
    font-size: 14px;
    line-height: 1.4;
  }

  .info-box {
    font-size: 14px;
  }

  .selection-criteria {
    font-size: 14px;
  }

  .wire-diagram h2 {
    font-size: 16px;
  }

  .wire-diagram p {
    font-size: 14px;
    line-height: 1.5;
  }

  /* ============================================
     MOBILE COLUMN RESETS — card layout needs auto widths
     ============================================ */

  .col-device,
  .col-wire,
  .col-voltage-device,
  .col-secondary {
    width: auto;
  }

  /* Reset secondary column muted styling on mobile */
  .sheet-table td.col-secondary {
    color: inherit;
    font-weight: inherit;
  }

  .sheet-table td.col-secondary input,
  .sheet-table td.col-secondary select {
    color: #000;
    font-weight: 400;
  }

  .sheet-table td.col-secondary .result-voltage-drop {
    color: inherit;
    font-weight: inherit;
  }
}


