/* ===== GLOBAL RESET ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== GLOBAL BACKGROUND & TYPOGRAPHY ===== */
body {
  font-family: "Segoe UI", "Roboto", Arial, sans-serif;
  background: #f3f3f3; /* Windows 11 neutral grey */
  color: #333;
}

/* ===== PAGE WRAPPER ===== */
.page-wrapper {
  max-width: 1200px;   /* keeps layout centered */
  margin: 0 auto;
  padding: 20px;
}

/* ===== PAGE TITLE ===== */
.page-title {
  background: linear-gradient(to right,
    #ffcccc, #cce5ff, #ccffcc, #fff9c4, #ffe0b2, #e1bee7);
  color: #333;
  padding: 20px;
  text-align: center;
  font-size: 1.6em;
  font-weight: bold;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
  border-radius: 8px;
  margin-bottom: 16px;
}

/* ===== MENU BAR ===== */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #e0e0e0;
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.4);
  position: relative;
  margin-bottom: 18px;
}

nav .brand {
  font-weight: 700;
  font-size: 1.2em;
  color: #333;
}

nav .menu-buttons {
  display: flex;
  gap: 10px;
}

nav a {
  background: #d6d6d6; /* grey raised buttons */
  color: #333;
  padding: 10px 18px;
  text-decoration: none;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.4);
  transition: all 0.2s ease;
  font-weight: 600;
}

nav a:hover {
  background: #e5e5e5;
  transform: translateY(-2px);
  box-shadow: 0 6px 10px rgba(0,0,0,0.5);
}

/* Hamburger button */
.menu-toggle {
  display: none;
  background: #bdbdbd;
  color: #333;
  border: none;
  padding: 10px 16px;
  font-size: 1.2em;
  border-radius: 6px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.4);
  cursor: pointer;
  margin-left: auto;
}

/* ===== SUB-ACTIONS BAR (page-level actions) ===== */
.sub-actions {
  display: flex;
  flex-wrap: wrap;              /* allows wrapping on small screens */
  justify-content: center;
  gap: 12px;
  margin: 15px 0;
  padding: 12px;
  background: linear-gradient(to right, #f9f9f9, #e0e0e0);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.sub-actions .btn {
  flex: 1 1 140px;              /* grow/shrink with min width */
  max-width: 200px;
  text-align: center;
  font-weight: bold;
  font-size: 15px;
  padding: 12px 16px;
}

/* ===== TABLE WRAPPER ===== */
.table-wrapper {
  width: 100%;
  overflow-x: auto;             /* scroll only if needed */
  background: linear-gradient(to right, #f0f4f8, #e8ecf1);
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  padding: 10px;
  margin-bottom: 20px;
}

/* ===== TABLES (global + supplier) ===== */
table,
.supplier-table {
  width: 90%;
  margin: 30px auto;
  border-collapse: collapse;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  table-layout: auto; /* lets table adapt to content */
}

table thead th,
.supplier-table th {
  background: linear-gradient(to right,
    #ffcccc, #cce5ff, #ccffcc, #fff9c4, #ffe0b2, #e1bee7);
  color: #333;
  padding: 12px;
  text-align: left;
  font-weight: bold;
  box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

table td,
.supplier-table td {
  background: #e0e0e0;
  padding: 10px;
  border: 1px solid #ccc;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
  vertical-align: middle;
}

.supplier-table td:nth-child(1),
.supplier-table td:nth-child(2),
.supplier-table td:nth-child(3),
.supplier-table td:nth-child(5) {
  white-space: nowrap;       /* keep on one line */
  overflow: hidden;
  text-overflow: ellipsis;   /* show … if too long */
}

/* ===== TABLE ACTIONS CELL ===== */
.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== FORMS ===== */
.form-container {
  max-width: 600px;
  margin: 40px auto;
  background: #fff;
  border: 2px solid #000;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.form-container h2 {
  text-align: center;
  margin-bottom: 20px;
}

.form-container label {
  display: block;
  margin-top: 15px;
  font-weight: bold;
}

.form-container input[type="text"],
.form-container select {
  width: 100%;
  padding: 10px;
  margin-top: 5px;
  border: 1px solid #ccc;
  border-radius: 6px;
  min-height: 44px; /* touch-friendly */
}

/* Inline form rows / utilities */
.form-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.form-row > * {
  flex: 1;
}

.form-container .button-row {
  margin-top: 20px;
  text-align: center;
}

/* ===== SEARCH BAR ===== */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.search-bar input[type="text"] {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #aaa;
  border-radius: 6px;
  font-size: 1rem;
  background: #fff;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.search-bar button,
.search-bar a.btn-cancel {
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: bold;
  background: linear-gradient(to bottom, #4a90e2, #357ABD);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0,0,0,0.3);
  text-decoration: none;
}

.search-bar button:hover,
.search-bar a.btn-cancel:hover {
  background: linear-gradient(to bottom, #5aa0f2, #4688d0);
  transform: translateY(-2px);
}

/* ===== BUTTONS (global + variants) ===== */
.btn,
button {
  background: linear-gradient(to bottom, #d6d6d6, #9e9e9e);
  color: #333;
  padding: 12px 24px;       /* touch-friendly */
  min-height: 44px;         /* recommended minimum for touch targets */
  min-width: 80px;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn:hover,
button:hover {
  background: linear-gradient(to bottom, #e5e5e5, #bdbdbd);
  transform: translateY(-2px);
  box-shadow: 0 6px 10px rgba(0,0,0,0.5);
}

/* Button variants */
.btn-save {
  background: linear-gradient(to bottom, #4CAF50, #388E3C);
  color: #fff;
}

.btn-reset {
  background: linear-gradient(to bottom, #f44336, #c62828);
  color: #fff;
}

.btn-edit {
  background: linear-gradient(to bottom, #2196F3, #1976D2);
  color: #fff;
}

.btn-delete {
  background: linear-gradient(to bottom, #f44336, #c62828);
  color: #fff;
}

/* Link-style buttons should never underline */
.btn {
  text-decoration: none;
}

/* ===== MODALS ===== */
.modal {
  display: none;
  position: fixed;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  padding: 20px;
  border: 1px solid #ccc;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
  z-index: 1000;
  width: 400px;
  border-radius: 8px;
}

.modal.active {
  display: block;
}

.modal input {
  display: block;
  margin-bottom: 12px;
  padding: 8px;
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 15px;
}

/* ===== FOOTER ===== */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f0f0f0;
  color: #333;
  padding: 10px 20px;
  font-size: 0.9em;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.footer-left,
.footer-middle,
.footer-right {
  flex: 1;
  white-space: nowrap;
}

.footer-left { text-align: left; }
.footer-middle { text-align: center; }
.footer-right { text-align: right; }

/* ===== RESPONSIVENESS ===== */
@media (max-width: 1280px) {
  .menu-toggle { display: block; }

  nav .menu-buttons {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    position: absolute;
    top: 100%; /* dropdown below nav bar */
    left: 0;
    background: #e0e0e0;
    width: 100%;
    padding: 10px 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border-radius: 0 0 10px 10px;
  }

  nav .menu-buttons.show { display: flex; }

  nav a {
    width: auto;
    min-width: 140px;
    text-align: left;
    margin: 4px 12px;
    padding: 8px 14px;
    font-size: 0.95em;
  }
}

@media (max-width: 1024px) {
  button, .btn,
  input[type="text"], select {
    font-size: 1.05rem;
  }

  .page-wrapper {
    padding: 16px;
  }

  table, .supplier-table {
    width: 95%;
    margin: 20px auto;
  }
}

@media (max-width: 480px) {
  nav a {
    min-width: 120px;
    padding: 6px 12px;
    font-size: 0.9em;
  }

  .sub-actions .btn {
    max-width: none;
    flex: 1 1 100%;
  }

  .form-row {
    flex-direction: column;
  }

  table, .supplier-table {
    width: 100%;
    margin: 12px auto;
  }
}
