@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  --blue: #0066b3; /* FoodTech Blue */
  --white: #ffffff;
  --bg-color: #fafafa;
  --text-main: #333333;
  --text-muted: #666666;
  --border-color: #e0e0e0;
  --sidebar-width: 280px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  scroll-behavior: smooth;
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--white);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  top: 0;
  left: 0;
  padding: 2rem 1.5rem;
  z-index: 10;
}

.sidebar-header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo {
  max-width: 140px;
  height: auto;
  margin-bottom: 1rem;
}

.sidebar-header h2 {
  font-size: 1.1rem;
  color: var(--text-main);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-right: 0.5rem; /* For scrollbar breathing room */
}

/* Sidebar scrollbar styling */
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 4px;
}

.nav-link {
  display: block;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 500;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-link:hover, .nav-link.active {
  background-color: rgba(0, 102, 179, 0.05); /* very light blue hover */
  color: var(--blue);
  border-left-color: var(--blue);
}

.admin-link {
  margin-top: 1.5rem;
  text-align: center;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: color 0.2s;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.admin-link:hover {
  color: var(--blue);
  border-color: var(--blue);
  background-color: rgba(0, 102, 179, 0.05);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 3rem 4rem;
  background-color: var(--bg-color);
  min-height: 100vh;
}

.category-section {
  margin-bottom: 4rem;
  scroll-margin-top: 2rem; 
}

.category-title {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--blue);
}

/* Grid responsivo */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
}

/* Square Card */
.card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--white);
  border: 1px solid var(--border-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
  display: block;
  text-decoration: none;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 102, 179, 0.15);
  border-color: var(--blue);
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.card:hover img {
  transform: scale(1.05);
}

.card-overlay {
  position: absolute;
  inset: auto 0 0 0; /* at bottom */
  background: var(--blue);
  padding: 0.8rem 1rem;
  text-align: center;
}

.card-title {
  color: var(--white);
  font-weight: 500;
  font-size: 1.05rem;
  margin: 0;
}

/* Spinner e status */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.no-data {
  text-align: center;
  padding: 2rem;
  background-color: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-muted);
}

/* Base estrutural main */
.main-page {
  flex: 1;
  margin-left: var(--sidebar-width);
  background-color: var(--bg-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.main-content {
  padding: 0 4rem 4rem 4rem;
  flex: 1;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
}

/* Área de pesquisa */
.search-container {
  padding: 3rem 4rem 1rem 4rem;
  background-color: var(--bg-color);
  position: sticky;
  top: 0;
  z-index: 5;
}

.search-input {
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  display: block;
  padding: 1rem 1.5rem;
  border-radius: 50px;
  border: 1px solid var(--border-color);
  font-size: 1.05rem;
  font-family: inherit;
  color: var(--text-main);
  box-shadow: 0 4px 6px rgba(0,0,0,0.02);
  transition: all 0.3s ease;
  outline: none;
}

.search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 4px 15px rgba(0, 102, 179, 0.1);
}

/* --- Mobile Toggle Button --- */
.mobile-toggle-btn {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 120;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--blue);
  color: var(--white);
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 102, 179, 0.35);
  transition: all 0.3s ease;
  align-items: center;
  justify-content: center;
}
.mobile-toggle-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 102, 179, 0.45);
}
.mobile-toggle-btn:active {
  transform: scale(0.95);
}

/* Overlay for sidebar on mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Sidebar transition */
.sidebar {
  transition: transform 0.3s ease;
}

/* --- Responsive: Tablet (max-width: 992px) --- */
@media (max-width: 992px) {
  .main-page {
    margin-left: var(--sidebar-width);
  }
  .main-content {
    padding: 0 2rem 2rem 2rem;
  }
  .search-container {
    padding: 2rem 2rem 1rem 2rem;
  }
  .category-title {
    font-size: 1.5rem;
  }
  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
  }
}

/* --- Responsive: Mobile (max-width: 768px) --- */
@media (max-width: 768px) {
  .mobile-toggle-btn {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-page {
    margin-left: 0;
  }

  .main-content {
    padding: 0 1rem 2rem 1rem;
  }

  .search-container {
    padding: 1rem 1rem 0.75rem 1rem;
    padding-top: 4.5rem; /* space for toggle btn */
  }

  .search-input {
    padding: 0.85rem 1.2rem;
    font-size: 1rem;
    border-radius: 30px;
  }

  .category-title {
    font-size: 1.3rem;
    margin-bottom: 1rem;
  }

  .category-section {
    margin-bottom: 2.5rem;
  }

  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
  }

  .card-overlay {
    padding: 0.5rem 0.6rem;
  }

  .card-title {
    font-size: 0.85rem;
  }
}

/* --- Responsive: Small phones (max-width: 480px) --- */
@media (max-width: 480px) {
  .items-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }

  .search-input {
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
  }

  .category-title {
    font-size: 1.15rem;
  }

  .card-title {
    font-size: 0.8rem;
  }

  .card-overlay {
    padding: 0.4rem 0.5rem;
  }

  .logo {
    max-width: 100px;
  }

  .sidebar-header h2 {
    font-size: 0.95rem;
  }
}
