@import url("https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");

:root {
  --main: #3e5f44;
  --sub: #5e936c;
  --dark: #131f24;
  --background: #edf3e9;
  --text-light: #ffffff;
  --warning: #ffc107;
  --error: #f44336;
  --more: #2196f3;
  --font-size-base: clamp(1rem, 0.5vw + 0.8rem, 1.125rem);
  --font-size-sm: clamp(0.875rem, 0.5vw + 0.7rem, 1rem);
  --font-size-lg: clamp(1.125rem, 0.5vw + 0.9rem, 1.25rem);
  --font-size-h2: clamp(1.5rem, 1vw + 1.2rem, 2rem);
  --font-size-h1: clamp(1.8rem, 2vw + 1.5rem, 2.5rem);
}

.preload-transitions * {
  transition: none !important;
}

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

body {
  font-family: "Be Vietnam Pro", sans-serif;
  font-size: var(--font-size-base);
  color: var(--sub);
  background-color: var(--background);
}

input,
button,
select,
textarea {
  font-family: "Be Vietnam Pro", sans-serif;
}

p {
  font-size: var(--font-size-lg);
  line-height: 1.6;
}

h1 {
  font-size: var(--font-size-h1);
  color: var(--main);
}

h2 {
  font-size: var(--font-size-h2);
  color: var(--main);
}

h3,
h4 {
  font-size: var(--font-size-lg);
  color: var(--main);
}

small {
  font-size: var(--font-size-sm);
}

a {
  color: var(--more);
  text-decoration: none;
}

.link {
  position: relative;
  color: inherit;
  transition: color 0.2s ease;
}

.link::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 2px;
  left: 0;
  right: 0;
  bottom: -5px;
  background-color: var(--background);
  transform: scaleX(0);
  transform-origin: bottom left;
  transition: transform 0.2s ease-out;
}

.link:hover {
  color: var(--background);
}

.link:hover::after {
  transform: scaleX(1);
}

header {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  margin: 0 auto;
  background: rgba(47, 63, 29, 0.753);
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(9.5px);
  -webkit-backdrop-filter: blur(9.5px);
  width: 74%;
  z-index: 1;
}

header #nav {
  display: flex;
  justify-content: space-between;
  list-style: none;
  align-items: center;
  padding: 2px 3rem;
  flex-wrap: wrap;
}

#sidebar #top a p,
header #nav #logo a p {
  font-size: 1.5rem;
}

#sidebar #top a,
header #nav #logo a {
  display: flex;
  align-items: center;
  color: var(--text-light);
  font-weight: bold;
  text-decoration: none;
}

#sidebar #top a img,
header #nav #logo img {
  width: 3rem;
  height: 3.3rem;
  margin-right: 10px;
}

header #nav #right {
  display: flex;
  gap: 50px;
}

header #nav #right a {
  color: var(--text-light);
  font-weight: 500;
  transition: all ease-in-out 0.2s;
}

header #nav #right a:hover {
  color: var(--text-light);
  text-decoration: none;
}

main {
  margin: auto;
}

main #introduce {
  margin-bottom: 15rem;
  margin-top: 8rem;
}
main #introduce,
main #tinhnang #chung {
  display: flex;
  justify-content: space-evenly;
  flex-wrap: wrap;
}

main #introduce #text,
main #tinhnang #chung #text {
  width: 30%;
  min-width: 300px;
}

main #introduce #text h1,
main #tinhnang #chung #text h1 {
  text-transform: uppercase;
  margin-bottom: 15px;
  font-weight: 900;
}

main #introduce #img img,
main #tinhnang #chung #img img {
  width: 100%;
  max-width: 400px;
  height: 300px;
  object-fit: cover;
  border-radius: 10px;
  -webkit-box-shadow: 11px 5px 20px -3px #000000;
  box-shadow: 10px 5px 20px -3px #000000;
  transition: all ease 0.3s;
}

main #introduce #img img:hover,
main #tinhnang #chung #img img:hover {
  transform: scale(1.02);
}

main #tinhnang > h1 {
  text-align: center;
  margin-top: 120px;
  margin-bottom: 7rem;
  font-size: 4rem;
}

main #tinhnang #chung {
  margin-bottom: 120px;
}

main #tinhnang #chung:nth-child(even) {
  flex-direction: row-reverse;
}

main #sign-in,
main #sign-up {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 3rem;
  padding-bottom: 2rem;
}

main #sign-in h1,
main #sign-up h1 {
  font-size: var(--font-size-h2);
  font-weight: 900;
}

main #sign-in > div,
main #sign-up > div {
  border: 1px solid var(--sub);
  border-radius: 10px;
  text-align: center;
  max-width: 350px;
  width: 100%;
}

main #sign-in > div {
  padding: 20px 60px;
}

main #sign-up > div {
  padding: 20px 50px;
}

main #sign-in h1 {
  text-transform: uppercase;
  margin-bottom: 40px;
}

main #sign-up h1 {
  text-transform: uppercase;
  margin-bottom: 30px;
}

main #sign-in form,
main #sign-up form {
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 10px;
  margin-bottom: 40px;
}

main #sign-in form label,
main #sign-up form label {
  color: var(--main);
  font-weight: 500;
  font-size: var(--font-size-sm);
}

main #sign-in form input[type="text"],
main #sign-in form input[type="password"],
main #sign-up form input[type="text"],
main #sign-up form input[type="password"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: var(--font-size-base);
  transition: all ease 0.3s;
}

main #sign-in form input[type="submit"],
main #sign-up form input[type="submit"] {
  color: var(--main);
  background-color: var(--background);
  border: 1px solid var(--main);
  border-radius: 10px;
  margin-top: 10px;
  padding: 12px;
  font-size: var(--font-size-base);
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s;
}

main #sign-in form input[type="submit"]:hover,
main #sign-up form input[type="submit"]:hover {
  background-color: var(--main);
  color: var(--background);
}

main #sign-in #more a,
main #sign-up #more a {
  color: var(--main);
  font-weight: bold;
}

.flash-error {
  color: var(--error);
}

.button {
  min-width: 100%;
  border-radius: 16px;
  border: 2px solid #e5e5e5;
  border-bottom: 6px solid #e5e5e5;
  margin: 10px;
  transition: all 0.1s;
  display: inline-flex;
  padding: 12px 16px;
}

.button:hover {
  background-color: #ddf4ff;
  border-color: #1cb0f6;
}

.button:active {
  border-bottom: 2px solid #1cb0f6;
}

#manager-page {
  display: grid;
  grid-template-columns: 250px 1fr;
  width: 100%;
  gap: 10px;
}

#sidebar {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 10px;
  background: var(--main);
  box-shadow: 0 100px 30px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(9.5px);
  -webkit-backdrop-filter: blur(9.5px);
}

#sidebar #top {
  display: flex;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--background);
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

ul {
  list-style-type: none;
}

#sidebar #manager ul li {
  margin: 1.5rem 0;
  padding: 10px;
  border-radius: 3px;
  transition: all ease 0.2s;
}
#sidebar #manager ul li:hover {
  background-color: var(--background);
}

#sidebar #manager ul li:hover a {
  color: var(--main);
}

#sidebar #manager a {
  color: var(--background);
  font-size: var(--font-size-sm);
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

.fa-solid {
  margin-right: 0;
  width: 20px;
  text-align: center;
}

#sidebar #manager ul li.active {
  background-color: var(--background);
}

#sidebar #manager ul li.active a {
  color: var(--main);
  font-weight: bold;
}

.farm-dropdown {
  position: relative;
  display: inline-block;
}

.farm-dropdown-button {
  background-color: #f9f9f9;
  color: #333;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.farm-dropdown-content {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  position: absolute;
  background-color: #ffffff;
  min-width: 200px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 100;
  border-radius: 4px;
  overflow: hidden;
  left: -8px;
  transition: all 0.3s ease-in-out;
}

.farm-dropdown-content button {
  color: black;
  padding: 12px 22px;
  text-decoration: none;
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all ease 0.1s;
}

.farm-dropdown-content button:hover {
  background-color: var(--sub, #ddd);
  color: var(--text-light, #000);
}

.farm-dropdown:hover .farm-dropdown-content {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.farm-dropdown:hover .farm-dropdown-button {
  background-color: #eee;
}

.sidebar-text {
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
  opacity: 1;
  transform: translateX(0);
  white-space: nowrap;
}

#menu-toggle.hidden {
  display: none;
}

#content {
  min-height: 100vh;
  transition: all ease 0.3s;
  color: var(--main);
  padding: 0;
}

#top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background-color: var(--text-light);
  margin-right: 10px;
  margin-top: 10px;
  border-radius: 5px;
  border: 0.2px solid var(--main);
  transition: all ease 0.3s;
  z-index: 1000;
}

.sidebar-toggle-btn {
  position: relative;
  top: auto;
  left: auto;
  z-index: auto;
  display: block;
  font-size: 1.2rem;
}

#menu-toggle {
  position: relative;
  top: auto;
  left: auto;
  background: none;
  border: none;
  color: var(--main);
}

#menu-toggle.hidden {
  display: none;
}

#sidebar-close {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 1001;
  font-size: 1rem;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  background: var(--main);
  color: var(--text-light);
  border: 1px solid var(--text-light);
}

#top-bar .farm-dropdown {
  margin-top: 0;
  position: relative;
}

#top-bar .farm-dropdown-button {
  width: auto;
}

#top-bar-account ul {
  display: flex;
  list-style: none;
  gap: 15px;
  margin: 0;
}
#top-bar-account ul li {
  margin: 0 15px;
}
.farms-List,
#top-bar-account a {
  color: var(--main);
  font-size: var(--font-size-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
.farms-List:hover,
#top-bar-account a:hover {
  color: var(--sub);
}

#top-bar-account .fa-solid {
  margin: 0;
  width: auto;
  text-align: left;
}

#main-content-area {
  margin: 10px 10px 10px 0;
}

#manage-area-page,
#manage-farm-page {
  background-color: var(--text-light);
  padding: 20px;
  border-radius: 5px;
}

#manage-area-page .tab,
#manage-farm-page .tab {
  margin-bottom: 10px;
  display: flex;
  flex: 1;
  justify-content: center;
}

#manage-area-page .tab button,
#manage-farm-page .tab button {
  background-color: var(--background);
  color: var(--main);
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  font-size: var(--font-size-sm);
  border-radius: 5px;
  margin-right: 5px;
  transition: all ease 0.2s;
}

#manage-area-page .tab button.active,
#manage-area-page .tab button:hover,
#manage-farm-page .tab button.active,
#manage-farm-page .tab button:hover {
  background-color: var(--sub);
  color: var(--text-light);
}

#manage-area-page .tab-content,
#manage-farm-page .tab-content {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  color: var(--main);
}

.cards .card a {
  color: var(--main);
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: center;
  text-align: center;
  border: 1px solid black;
  border-radius: 5px;
  padding: 10px;
  gap: 0px;
  height: 100%;
  transition: all ease 0.3s;
}
.cards .card a:hover {
  -webkit-box-shadow: 11px 5px 10px -3px #00000028;
  box-shadow: 10px 5px 10px -3px #00000028;
  transform: scale(1.02);
}

.card .card-icon {
  font-size: 3rem;
}

.card .card-Info h4 {
  border-bottom: 1px solid black;
  padding-bottom: 10px;
  font-size: 1rem;
}

.card .card-Info p {
  padding-top: 10px;
  font-size: 0.999rem;
}

@media screen and (min-width: 769px) {
  .sidebar-toggle-btn {
    display: block;
  }

  #sidebar-close {
    display: none;
  }

  #manager-page {
    transition: grid-template-columns 0.3s ease-out;
  }

  #sidebar {
    transition-property: width;
    transition-duration: 0.3s;
    transition-timing-function: ease-out;

    position: sticky;
    width: 250px;
  }

  #manager-page.sidebar-collapsed {
    grid-template-columns: 80px 1fr;
  }

  #manager-page.sidebar-collapsed #sidebar {
    width: 80px;
    align-items: center;
  }

  #manager-page.sidebar-collapsed #sidebar .sidebar-text {
    opacity: 0;
    transition: opacity 0.2s ease-out;

    position: absolute;
    visibility: hidden;
    pointer-events: none;
  }

  #manager-page.sidebar-collapsed #sidebar #top a {
    justify-content: center;
  }

  #manager-page.sidebar-collapsed #sidebar #top a img {
    margin-right: 0;
  }

  #manager-page.sidebar-collapsed #sidebar .farm-dropdown {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  #manager-page.sidebar-collapsed #sidebar .farm-dropdown-button {
    width: 50px;
    font-size: 0;
    padding: 10px 0;
    text-align: center;
  }

  #manager-page.sidebar-collapsed #sidebar .farm-dropdown-button .fa-caret-down {
    font-size: 16px;
    float: none;
    margin: 0;
  }

  #manager-page.sidebar-collapsed #sidebar .farm-dropdown-content {
    left: -10px;
    top: 0;
  }
}

@media screen and (max-width: 768px) {
  header {
    padding-bottom: 1rem;
    width: 100%;
  }

  header #nav {
    justify-content: center;
  }

  main #introduce #text,
  main #tinhnang #chung #text {
    margin-bottom: 20px;
    width: 80%;
    min-width: unset;
  }

  main #introduce #img img,
  main #tinhnang #chung #img img {
    max-width: 300px;
    height: 200px;
  }

  .sidebar-toggle-btn {
    display: block;
  }

  #manager-page {
    grid-template-columns: 1fr;
    gap: 0;
  }

  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease-out;
    justify-content: flex-start;
  }

  #sidebar #top {
    margin-top: 40px;
  }

  #sidebar.sidebar-active {
    transform: translateX(0);
  }

  #sidebar-close {
    display: none;
  }

  #sidebar.sidebar-active #sidebar-close {
    display: block;
  }

  #sidebar .sidebar-text {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
  }

  #top-bar {
    padding: 10px 15px;
    margin: 0;
  }

  .hide-on-mobile {
    display: none;
  }

  #top-bar-account a {
    font-size: 1.2rem;
  }

  #main-content-area {
    padding: 15px;
    margin-top: 0;
  }

  #content {
    margin-top: 0;
    padding-left: 0;
  }

  #main-content-area {
    border-radius: 0;
    padding: 0;
    margin: 10px;
  }

  #manage-farm-page {
    padding: 10px;
  }

  #manage-farm-page .tab {
    justify-content: space-around;
  }

  #manage-farm-page .tab button {
    display: flex;
    flex: 1;
    justify-content: center;
  }

  .cards {
    gap: 10px;
  }
  .card a .card-icon {
    font-size: 2rem;
  }
}

.modal-toggle {
  display: none;
}

.modal-overlay {
  display: none;

  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: var(--background, #fff);
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 400px;
  text-align: center;
}

.modal-content.flash-success {
  border-top: 5px solid var(--main, #3e5f44);
}
.modal-content.flash-error {
  border-top: 5px solid var(--error, #f44336);
}
.modal-content.flash-error p {
  color: var(--error, #f44336);
  font-weight: 500;
}
.modal-content.flash-success p {
  color: var(--main, #3e5f44);
  font-weight: 500;
}

.modal-close-btn {
  display: inline-block;
  margin-top: 20px;
  padding: 10px 20px;
  background-color: var(--main, #3e5f44);
  color: var(--text-light, #fff);
  border-radius: 5px;
  cursor: pointer;
  font-weight: 500;
  transition: opacity 0.2s;
}
.modal-close-btn:hover {
  opacity: 0.8;
}

.modal-content.flash-error .modal-close-btn {
  background-color: var(--error, #f44336);
}

.modal-toggle:not(:checked) + .modal-overlay {
  display: none;
}

.modal-toggle:checked + .modal-overlay {
  display: flex;
}

.dashboard-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 20px;
}

.dashboard-col-1,
.dashboard-col-2 {
  flex: 1;
  min-width: 300px;
  background-color: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dashboard-col-1 h3,
.dashboard-col-2 h3 {
  margin-top: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid #f0f0f0;
  padding-bottom: 10px;
}

.stock-list {
  list-style: none;
  padding: 0;
}

.stock-list li {
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stock-list li:last-child {
  border-bottom: none;
}

.stock-list .stock-name {
  font-weight: bold;
  color: var(--sub);
}

.stock-list .stock-name span {
  display: block;
  font-weight: normal;
  font-size: var(--font-size-sm);
  color: #888;
}

.stock-list .stock-qty {
  font-weight: bold;
  color: var(--main);
  font-size: var(--font-size-lg);
}

.timeline {
  margin-top: 20px;
  background-color: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.timeline h3 {
  margin-top: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid #f0f0f0;
  padding-bottom: 10px;
}

.timeline-item {
  display: flex;
  padding: 15px 0;
  border-bottom: 1px solid #f0f0f0;
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-date {
  flex-basis: 100px;
  font-size: var(--font-size-sm);
  color: #888;
  font-weight: 500;
  padding-right: 15px;
}

.timeline-content {
  font-size: var(--font-size-base);
  color: var(--sub);
}
