/* =========================
   Base card layout
   ========================= */
.card {
  margin: 1rem 0;
  padding: 1rem;
  border-radius: 6px;
  text-align: center;        /* Center headings, labels, buttons */
}

/* =========================
   Table wrapper (centers the table)
   ========================= */
.table-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;   /* Center the table horizontally */
}

/* =========================
   Table styling
   ========================= */
.excel-table {
  width: auto;               /* Let table size to its content */
  max-width: 100%;           /* But never overflow the card width */
  border-collapse: collapse;
  font-family: monospace;
  margin: 0 auto;            /* Extra safety centering */
}

.excel-table th,
.excel-table td {
  border: 1px solid var(--card-border);
  padding: 0.5rem;
  text-align: center;
}

.excel-table thead {
  background-color: var(--table-header-bg);
  font-weight: bold;
}

.excel-table tfoot {
  background-color: var(--table-footer-bg);
  font-weight: bold;
}

/* =========================
   Input field sizing
   ========================= */
.excel-table input[type="number"],
.denom-input {
  width: 70px;          /* Desktop width */
  padding: 0.25rem;
  text-align: center;
  font-size: 1rem;
  box-sizing: border-box;
}

/* =========================
   Toggle switch styling
   ========================= */
.toggle-switch {
  appearance: none;
  width: 40px;
  height: 20px;
  background: var(--card-border);
  border-radius: 20px;
  position: relative;
  cursor: pointer;
  outline: none;
  transition: background 0.3s ease;
}

.toggle-switch::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--button-text);
  border-radius: 50%;
  transition: transform 0.3s ease;
}

.toggle-switch:checked {
  background: var(--button-bg);
}

.toggle-switch:checked::before {
  transform: translateX(20px);
}

/* =========================
   Responsive handling
   ========================= */

/* Medium screens (tablets) */
@media (max-width: 900px) {
  .excel-table th,
  .excel-table td {
    padding: 0.4rem;
    font-size: 0.9rem;
  }

  .card {
    padding: 0.75rem;
  }

  .toggle-switch {
    width: 36px;
    height: 18px;
  }

  .toggle-switch::before {
    width: 14px;
    height: 14px;
  }

  .excel-table input[type="number"],
  .denom-input {
    width: 60px;        /* Tablet width */
    font-size: 0.9rem;
  }
}

/* Small screens (phones) */
@media (max-width: 600px) {
  header,
  footer {
    text-align: center;
  }

  .card {
    margin: 0.5rem 0;
    padding: 0.5rem;
  }

  .excel-table th,
  .excel-table td {
    padding: 0.25rem;
    font-size: 0.8rem;
  }

  .excel-table {
    font-size: 0.8rem;
  }

  .toggle-switch {
    width: 32px;
    height: 16px;
  }

  .toggle-switch::before {
    width: 12px;
    height: 12px;
  }

  .excel-table input[type="number"],
  .denom-input {
    width: 80px;        /* Mobile width */
    font-size: 0.8rem;
    padding: 0.2rem;
  }

  /* Mobile horizontal scroll while staying centered */
  .table-wrapper {
    overflow-x: auto;
  }

  .excel-table {
    display: inline-block;   /* Centered inside the flex wrapper */
    white-space: nowrap;
  }
}

/* =========================
   Toast notifications
   ========================= */
.toast {
  visibility: hidden;
  min-width: 200px;
  margin-left: -100px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 4px;
  padding: 12px;
  position: fixed;
  z-index: 9999;
  left: 50%;
  bottom: 30px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.5s, bottom 0.5s;
}

.toast.show {
  visibility: visible;
  opacity: 1;
  bottom: 50px;
}

.toast.success { background-color: #28a745; }
.toast.error { background-color: #dc3545; }