@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&family=Playfair+Display:wght@400;700&display=swap');

:root {
  --color-primary: #8B4513; /* SaddleBrown */
  --color-secondary: #6B8E23; /* OliveDrab */
  --color-light: #F5DEB3; /* Wheat */
  --color-dark: #4A3728; /* Dark Brown */
  --color-accent: #B8860B; /* DarkGoldenrod */
  --font-heading: 'Playfair Display', serif;
  --font-body: 'Lato', sans-serif;
}

/* Reset básico */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background: var(--color-light);
  color: var(--color-dark);
}

/* Estilos para a tela de login */
.login-bg {
  background: linear-gradient(135deg, var(--color-primary), var(--color-light));
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: #fff;
  padding: 2em;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  text-align: center;
}

.login-card h2 {
  margin-bottom: 1em;
  color: var(--color-primary);
  font-family: var(--font-heading);
}

.login-card input {
  width: 100%;
  padding: 0.75em;
  margin: 0.5em 0;
  border: 1px solid var(--color-secondary);
  border-radius: 4px;
}

.btn {
  padding: 0.75em 1.5em;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.btn:hover {
  background: var(--color-accent);
}

.error {
  color: #d32f2f;
  margin-top: 0.5em;
}

/* Cabeçalho e Menu */
.header {
  background: var(--color-primary);
  color: var(--color-light);
  padding: 1em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
.header-left {
  display: flex;
  align-items: center;
}
.header-left h1 {
  margin-left: 0.5em;
  font-size: 1.8em;
  font-family: var(--font-heading);
}
.header-right {
  display: flex;
  align-items: center;
}
.user-photo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 0.5em;
  border: 2px solid var(--color-light);
}
.btn-logout {
  background: var(--color-accent);
  padding: 0.5em 1em;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: var(--color-dark);
  transition: background 0.3s ease;
}
.btn-logout:hover {
  background: darken(var(--color-accent), 10%); /* Placeholder for CSS preprocessor */
}
.btn-menu {
  background: transparent;
  border: none;
  font-size: 1.8em;
  color: var(--color-light);
  cursor: pointer;
}

/* Sidebar – Menu lateral */
.sidebar {
  background: var(--color-dark);
  color: var(--color-light);
  width: 220px;
  min-height: calc(100vh - 60px);
  padding-top: 1em;
  position: fixed;
  left: 0;
  top: 60px;
  transition: transform 0.3s ease;
}
.sidebar ul {
  list-style: none;
}
.sidebar ul li {
  padding: 0.75em 1em;
  cursor: pointer;
  transition: background 0.3s ease;
}
.sidebar ul li:hover,
.sidebar ul li.active {
  background: var(--color-secondary);
}

/* Para mobile: esconder sidebar inicialmente */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    z-index: 1000;
  }
  .sidebar.active {
    transform: translateX(0);
  }
}

/* Conteúdo Principal */
.main-content {
  margin-left: 220px;
  padding: 1.5em;
  background: var(--color-light);
  min-height: calc(100vh - 60px);
  transition: margin-left 0.3s ease;
}
@media (max-width: 768px) {
  .main-content {
    margin-left: 0;
  }
}

/* Seções */
.section {
  display: none;
  padding: 1.5em 0;
}
.section.active {
  display: block;
}

.section h2 {
  font-family: var(--font-heading);
  color: var(--color-primary);
  margin-bottom: 1em;
}

/* Formulários Inline */
.form-inline input,
.form-inline button,
.form-inline label {
  margin: 0.5em 0.5em 0.5em 0;
}

.form-inline input {
  border: 1px solid var(--color-secondary);
  border-radius: 4px;
  padding: 0.75em;
}

/* Containers de Listas e Cards */
.list-container {
  margin-top: 1.5em;
  display: grid;
  gap: 1em;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* Responsive grid */
}
.item-card {
  background: #fff;
  border: 1px solid var(--color-secondary);
  padding: 1.5em;
  border-radius: 8px;
  margin-bottom: 0; /* Handled by gap */
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
  transition: transform 0.2s ease-in-out;
}
.item-card:hover {
  transform: translateY(-5px);
}
.item-card img {
  max-width: 100%;
  height: 200px; /* Fixed height for product images */
  object-fit: cover; /* Ensure images cover the area */
  margin-bottom: 1em;
  border-radius: 4px;
  border: 1px solid var(--color-light);
}
.item-card h3 {
  font-family: var(--font-heading);
  color: var(--color-primary);
  margin-bottom: 0.5em;
}
.item-card p {
  font-size: 0.95em;
  line-height: 1.4;
  margin-bottom: 0.5em;
}
.btn-group {
  margin-top: 1em;
  display: flex;
  gap: 0.5em;
}
.btn-edit {
  background: var(--color-primary);
  color: var(--color-light);
  padding: 0.6em 1.2em;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.3s ease;
}
.btn-edit:hover {
  background: var(--color-accent);
}
.btn-delete {
  background: #d32f2f;
  color: #fff;
  padding: 0.6em 1.2em;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.3s ease;
}
.btn-delete:hover {
  background: #b71c1c;
}

/* Métricas na Home */
.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5em;
  margin-top: 1.5em;
  justify-content: center; /* Center cards on smaller screens */
}
.metric-card {
  background: #fff;
  padding: 1.5em;
  border-radius: 8px;
  flex: 1 1 220px; /* Slightly larger cards */
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: transform 0.2s ease-in-out;
  border: 1px solid var(--color-secondary);
}
.metric-card:hover {
  transform: translateY(-7px);
}
.metric-card h3 {
  margin-bottom: 0.75em;
  color: var(--color-primary);
  font-family: var(--font-heading);
}
.metric-card p {
  font-size: 1.8em;
  font-weight: 700;
  color: var(--color-dark);
}

/* Modal */
.modal {
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(var(--color-dark-rgb), 0.7); /* Semi-transparent dark overlay */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1em;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal.active {
  opacity: 1;
  visibility: visible;
}
.modal-content {
  background: var(--color-light);
  padding: 2em;
  width: 100%;
  max-width: 550px; /* Slightly wider modal */
  max-height: 90vh; /* More vertical space */
  overflow-y: auto;
  border-radius: 10px;
  position: relative;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}
.modal.active .modal-content {
  transform: translateY(0);
}
.modal .close {
  position: absolute;
  right: 15px;
  top: 15px;
  font-size: 2em;
  cursor: pointer;
  color: var(--color-primary);
  transition: color 0.2s ease;
}
.modal .close:hover {
  color: var(--color-accent);
}

/* Notificação */
.notification {
  display: none;
  position: fixed;
  top: 80px; /* Adjusted for header height */
  right: 20px;
  background: var(--color-primary);
  color: var(--color-light);
  padding: 0.8em 1.5em;
  border-radius: 6px;
  z-index: 3000;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  transition: opacity 0.3s ease;
}
.notification.error {
  background: #d32f2f;
}

/* Rodapé */
.footer {
  background: var(--color-dark);
  color: var(--color-light);
  text-align: center;
  padding: 1.5em;
  margin-top: 2em;
  font-size: 0.9em;
  font-family: var(--font-body);
}
