#inventoryTracker {
  max-width: 900px;
  margin: 20px auto;
  padding: 0 15px;
  font-family: Arial, sans-serif;
  color: #222;
}

#inventoryTracker h1 {
  text-align: center;
  margin-bottom: 24px;
}

/* Table styles */
#stockTable {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  box-shadow: 0 0 8px rgb(0 0 0 / 0.1);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 24px;
  table-layout: fixed; /* helps keep columns stable on narrow screens */
  word-wrap: break-word; /* allow content wrap */
}

#stockTable th,
#stockTable td {
  padding: 12px 15px;
  border-bottom: 2px solid #000;
  text-align: left;
  font-weight: 600;
  color: #222;
  vertical-align: middle;
  white-space: nowrap; /* prevent wrapping in desktop */
}

#stockTable tbody tr:last-child td {
  border-bottom: none;
}

#stockTable tbody tr.empty td {
  text-align: center;
  font-weight: 400;
  color: #888;
  white-space: normal; /* allow wrapping for empty row text */
}

/* Buttons in table */
.adjust-btn,
.remove-btn {
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 999px;
  border: 2px solid #000;
  background-color: #ffde59;
  font-weight: 700;
  color: #000;
  user-select: none;
  transition: background-color 0.3s ease;
  white-space: nowrap;
}

.adjust-btn:hover,
.remove-btn:hover {
  background-color: #e6c800;
}

.remove-btn {
  font-size: 18px;
  line-height: 1;
}

/* Form layout */
#stockForm {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-start;
}

/* Wrapper to keep main inputs on the same row */
.stock-fields {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
  align-items: center;
  width: 100%;
  max-width: 600px;
}

/* Inputs inside the stock-fields container */
.stock-fields input,
#priceInputWrapper {
  flex-shrink: 0;
}

.stock-fields input[type="text"] {
  flex: 2 1 200px;
  max-width: 220px;
  padding: 10px 12px;
  font-size: 16px;
  border: 2px solid #000;
  border-radius: 999px;
  background-color: #fff;
  color: #000;
  outline-offset: 2px;
  transition: border-color 0.3s ease;
}

.stock-fields input[type="text"]:focus {
  border-color: #ffc107;
  outline: none;
}

.stock-fields input[type="number"] {
  flex: 1 1 100px;
  max-width: 120px;
  padding: 10px 12px;
  font-size: 16px;
  border: 2px solid #000;
  border-radius: 999px;
  background-color: #fff;
  color: #000;
  outline-offset: 2px;
  transition: border-color 0.3s ease;
}

.stock-fields input[type="number"]:focus {
  border-color: #ffc107;
  outline: none;
}

/* Price input wrapper for currency prefix */
#priceInputWrapper {
  position: relative;
  flex: 1 1 120px;
  max-width: 220px;
}

#priceInputWrapper input[type="number"] {
  width: 100%;
  padding-left: 24px;
  box-sizing: border-box;
  font-size: 16px;
  border: 2px solid #000;
  border-radius: 999px;
  background-color: #fff;
  color: #000;
  outline-offset: 2px;
  transition: border-color 0.3s ease;
}

#priceInputWrapper input[type="number"]:focus {
  border-color: #ffc107;
  outline: none;
}

#currencyPrefix {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 600;
  color: #555;
  pointer-events: none;
  user-select: none;
}

/* Currency selector */
#currencySelect {
  padding: 8px 12px;
  border-radius: 999px;
  border: 2px solid #000;
  font-size: 16px;
  cursor: pointer;
  background-color: #fff;
  color: #333;
  min-width: 120px;
  outline-offset: 2px;
  transition: border-color 0.3s ease;
}

#currencySelect:focus {
  border-color: #ffc107;
  outline: none;
}

/* Submit button */
#stockForm button {
  padding: 10px 20px;
  border-radius: 999px;
  border: 5px solid #000;
  background: #ffde59;
  color: #000;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.3s ease;
}

#stockForm button:hover {
  background-color: #e6c800;
}

#exportCsvBtn {
  padding: 10px 20px;
  border-radius: 999px;
  border: 5px solid #000;
  background: #1e6e42!important;
  color: #ffffff!important;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.3s ease;
  margin-left: 12px;
}

#exportCsvBtn:hover {
  background-color: #e6c800;
}

/********************** Mobile Responsive Styles ***************************/
@media (max-width: 600px) {
  #inventoryTracker {
    padding: 0 10px;
  }
  #exportCsvBtn {
    width: 100%;
    margin-left: 0;
    margin-top: 10px;
  }
  #stockForm {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 20px;
  }

  /* Input fields: normal shape, stacked */
  .stock-fields {
    flex-direction: column;
    gap: 12px;
    max-width: 100%;
  }

  .stock-fields input[type="text"],
  .stock-fields input[type="number"],
  #priceInputWrapper input[type="number"] {
    border-radius: 4px;  /* remove pill shape */
    width: 93%;
    max-width: 100%;
    padding: 8px 10px;
    font-size: 16px;
  }

.stock-fields input[type="text"] {
    flex: 2 1 20px;
  }

  .stock-fields input[type="number"]{
    flex: 2 1 20px;
  }

  #currencyPrefix{
    display: none;
  }

  #priceInputWrapper {
    flex: none;        /* prevent flex shrink/grow */
    width: 100% !important;  /* force full width */
    max-width: 100% !important;
  }

  #currencySelect,
  #stockForm button {
    width: 100%;
    max-width: 100%;
  }

  #currencySelect {
    margin-top: 4px;
    border-radius: 4px;
  }

  #stockTable thead {
    display: none; /* Hide headers */
  }

  #stockTable tbody tr {
    display: block;
    margin-bottom: 20px;
    background: #fff;
    box-shadow: 0 0 6px rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 12px 16px;
  }

  #stockTable tbody tr.empty td {
    text-align: center;
    font-weight: 400;
    color: #888;
    border: none;
  }

  #stockTable tbody tr td {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-weight: 500;
  }

  #stockTable tbody tr td:last-child {
    border-bottom: none;
  }

  #stockTable tbody tr td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #666;
    flex-basis: 45%;
    white-space: nowrap;
  }

  /* Adjust buttons spacing */
  .adjust-btn,
  .remove-btn {
    margin-left: 8px;
    padding: 4px 8px;
    font-size: 14px;
  }

  .remove-btn {
    font-size: 16px;
  }

  #stockForm button {
    padding: 12px;
    font-size: 16px;
  }

  .copyright {
    margin-bottom: 10% !important;
}
}
