:root {
  --primary-color: #bdd4e7;
  --secondary-color: #4f6367;
}

/* 1. Use a more-intuitive box-sizing model */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 2. Remove default margin */
*:not(dialog) {
  margin: 0;
}

/* 3. Enable keyword animations */
@media (prefers-reduced-motion: no-preference) {
  html {
    interpolate-size: allow-keywords;
  }
}

body {
  /* 4. Increase line-height */
  line-height: 1.5;
  /* 5. Improve text rendering */
  -webkit-font-smoothing: antialiased;
  padding: 20px 40px;
}

/* 6. Improve media defaults */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

/* 7. Inherit fonts for form controls */
input,
button,
textarea,
select {
  font: inherit;
}

/* 8. Avoid text overflows */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* 9. Improve line wrapping */
p {
  text-wrap: pretty;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
}

/*
  10. Create a root stacking context
*/
#root,
#__next {
  isolation: isolate;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 480px;
  padding: 24px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  background: #fafafa;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-weight: 500;
  font-size: 0.875rem;
  color: #333;
}

.form-input {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-input:focus {
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(79, 99, 103, 0.15);
}

dialog {
  border: none;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  max-width: 480px;
  width: 100%;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
}

dialog .form {
  border: none;
  background: transparent;
  padding: 0;
}

.dialog-title {
  margin-bottom: 20px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.btn {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}

.btn-primary {
  background: var(--secondary-color);
  color: white;
}

.btn-primary:hover {
  background: #3d4f52;
}

.btn-ghost {
  background: transparent;
  color: #555;
  border: 1px solid #ccc;
}

.btn-ghost:hover {
  background: #f0f0f0;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.form-error {
  color: #c0392b;
  font-size: 0.8rem;
}

.form-input--error {
  border-color: #c0392b;
}

.form-input--error:focus {
  border-color: #c0392b;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.15);
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo-primary {
  font-size: 32px;
  font-weight: 600;
}

.logo-secondary {
  font-style: italic;
}

.navbar {
  display: flex;
  align-items: center;
  padding: 20px;
}

.navbar-links {
  display: flex;
  gap: 30px;
}

.navbar-links > li {
  list-style: none;
}

.navbar-links > li > a {
  text-decoration: none;
  color: black;
}

.index-category {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 48px;
}

.index-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 24px;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid #ccc;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.card-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-name {
  font-weight: 600;
}

.card-price {
  color: var(--secondary-color);
}

.card-quantity {
  font-size: 0.875rem;
  color: #888;
}

.categories {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.category-row {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}

.category-row-img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.category-row-name {
  flex: 1;
  font-weight: 600;
  color: black;
  text-decoration: none;
}

.category-row-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-row {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}

.item-row-img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.item-row-name {
  flex: 1;
  font-weight: 600;
}

.item-row-price {
  color: var(--secondary-color);
  min-width: 60px;
  text-align: right;
}

.item-row-quantity {
  color: #888;
  font-size: 0.875rem;
  min-width: 70px;
  text-align: right;
}

.item-row-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #555;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: #f0f0f0;
  color: #222;
}

.icon-btn--danger {
  color: #c0392b;
}

.icon-btn--danger:hover {
  background: #fdecea;
  color: #a93226;
}
