@import url('https://fonts.googleapis.com/css?family=Open+Sans:400,700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Open Sans', sans-serif;
  background: #f1f5f8;
  color: #102a42;
  line-height: 1.5;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.section-center {
  width: 90vw;
  max-width: 35rem;
  background: #fff;
  border-radius: 0.25rem;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s linear;
  padding: 2rem;
}

.section-center:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* 提示框样式 */
.alert {
  margin-bottom: 1rem;
  height: 1.25rem;
  display: grid;
  align-items: center;
  text-align: center;
  font-size: 0.7rem;
  border-radius: 0.25rem;
  letter-spacing: 0.1rem;
  text-transform: capitalize;
}

.alert-danger {
  color: #721c24;
  background: #f8d7da;
}

.alert-success {
  color: #155724;
  background: #d4edda;
}

/* 表单样式 */
.grocery-form h3 {
  color: #063251;
  margin-bottom: 1.5rem;
  text-align: center;
  font-size: 1.75rem;
}

.form-control {
  display: flex;
  justify-content: center;
}

.grocery {
  padding: 0.5rem;
  padding-left: 1rem;
  background: #f1f5f8;
  border-top-left-radius: 0.25rem;
  border-bottom-left-radius: 0.25rem;
  border-color: transparent;
  font-size: 1rem;
  flex: 1 0 auto;
  color: #617d98;
}

.grocery::placeholder {
  color: #a0b3c6;
}

.submit-btn {
  background: #a5d8ff;
  border-color: transparent;
  flex: 0 0 5rem;
  display: grid;
  align-items: center;
  padding: 0.25rem;
  text-transform: capitalize;
  letter-spacing: 2px;
  border-top-right-radius: 0.25rem;
  border-bottom-right-radius: 0.25rem;
  cursor: pointer;
  color: #49a6e9;
  transition: all 0.3s linear;
  font-size: 0.85rem;
}

.submit-btn:hover {
  background: #49a6e9;
  color: #fff;
}

/* 列表样式 */
.grocery-container {
  margin-top: 2rem;
  transition: all 0.3s linear;
  visibility: hidden; /* 默认隐藏，有数据时显示 */
}

.show-container {
  visibility: visible;
}

.grocery-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  transition: all 0.3s linear;
  padding: 0.25rem 1rem;
  border-radius: 0.25rem;
}

.grocery-item:hover {
  background: #f1f5f8;
}

.title {
  margin-bottom: 0;
  color: #102a42;
  letter-spacing: 2px;
  text-transform: capitalize;
}

.edit-btn,
.delete-btn {
  background: transparent;
  border-color: transparent;
  cursor: pointer;
  font-size: 0.7rem;
  margin: 0 0.15rem;
  transition: all 0.3s linear;
}

.edit-btn {
  color: #6be675;
}

.edit-btn:hover {
  color: #25bb32;
}

.delete-btn {
  color: #e66b6b;
}

.delete-btn:hover {
  color: #bb2525;
}

.clear-btn {
  text-transform: capitalize;
  width: 10rem;
  height: 1.5rem;
  display: grid;
  align-items: center;
  background: transparent;
  border-color: transparent;
  color: #e66b6b;
  margin: 0 auto;
  margin-top: 1.25rem;
  font-size: 0.85rem;
  letter-spacing: 0.1rem;
  cursor: pointer;
  transition: all 0.3s linear;
}

.clear-btn:hover {
  color: #bb2525;
}
