/* Font import moved to HTML for performance */

:root {
  /* Brand Colors */
  --primary-color: #d85900;
  --secondary-color: #f39200;
  --primary-dark: #b04600;
  --primary-light: #ff7f2a;

  /* Neutral Colors */
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-light: #757575;
  --background-body: #f8f9fa;
  --surface-white: #ffffff;
  --surface-hover: #f0f0f0;
  --border-color: #e0e0e0;

  /* Gradients */
  --brand-gradient: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
  --surface-gradient: linear-gradient(to bottom, #ffffff, #f8f9fa);

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-hover: 0 12px 32px rgba(216, 89, 0, 0.15);

  /* Spacing & Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --sidebar-width: 280px;
  --header-height: 70px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--brand-gradient);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* Loading Overlay */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.loader {
  width: 48px;
  height: 48px;
  border: 4px solid var(--surface-hover);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* App Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface-white);
  border-right: 1px solid var(--border-color);
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  padding: 2rem 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  max-width: 230px;
  height: auto;
  margin-bottom: 1rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.05));
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.category-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  margin-top: auto;
}

.sidebar-footer p {
  font-size: 0.8rem;
  color: var(--text-light);
  font-weight: 500;
}

.category-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  width: 100%;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 1.2rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.category-btn img {
  width: 28px;
  /* Increased slightly from 24px */
  height: 28px;
  object-fit: contain;
  opacity: 0.85;
  transition: var(--transition-fast);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
  /* Subtle shadow for depth */
}

.category-btn:hover {
  background: var(--surface-hover);
  color: var(--primary-color);
}

.category-btn:hover img {
  opacity: 1;
  transform: scale(1.15);
  /* Slightly stronger zoom */
  filter: drop-shadow(0 2px 4px rgba(216, 89, 0, 0.2));
  /* Colored shadow on hover */
}

.category-btn.active {
  background: var(--brand-gradient);
  color: white;
  box-shadow: var(--shadow-md);
}

.category-btn.active img {
  opacity: 1;
  filter: brightness(0) invert(1) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 2rem 3rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  position: relative;
  z-index: 10;
}

.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background var(--transition-fast);
}

.menu-toggle:hover {
  background: var(--surface-hover);
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Search Bar */
.search-container {
  position: relative;
  max-width: 600px;
  margin: 0 auto 3rem;
  z-index: 10;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}

#pesquisa {
  width: 100%;
  padding: 16px 16px 16px 48px;
  font-size: 1rem;
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  background: var(--surface-white);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
}

#pesquisa:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: var(--shadow-lg);
}

#pesquisa::placeholder {
  color: #9ca3af;
}

/* Grid & Cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2rem;
  padding-bottom: 4rem;
}

.card {
  background: var(--surface-white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  cursor: pointer;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  position: relative;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(216, 89, 0, 0.2);
}

.card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  padding: 1.5rem;
  background: #fff;
  border-bottom: 1px solid var(--surface-hover);
  transition: transform var(--transition-normal);
}

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

.card-content {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.card p strong {
  color: var(--primary-color);
  font-weight: 600;
}

/* Prompts & Empty States */
.prompt-mensagem,
.nenhum-resultado-mensagem {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
  animation: fadeIn 0.5s ease;
}

.prompt-icon,
.empty-icon {
  font-size: 48px;
  color: var(--medium-gray);
  margin-bottom: 1rem;
  display: block;
}

.prompt-content {
  background: var(--surface-white);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: inline-block;
}

/* Modal */
.image-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.image-modal.active {
  opacity: 1;
}

.modal-content {
  background: var(--surface-white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 1000px;
  max-height: 90vh;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform var(--transition-normal);
}

.image-modal.active .modal-content {
  transform: scale(1);
}

.modal-image-container {
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

#modal-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
  cursor: zoom-in;
}

#modal-img.zoomed {
  transform: scale(2);
  cursor: zoom-out;
}

.modal-details {
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.modal-details h3 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.modal-info {
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-info p {
  font-size: 1rem;
  color: var(--text-secondary);
  padding: 0.75rem;
  background: var(--background-body);
  border-radius: var(--radius-sm);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.modal-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  font-size: 1rem;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: #e5e5e5;
  transform: translateY(-2px);
}

.close-modal-x {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.close-modal-x:hover {
  background: var(--primary-color);
  color: white;
  transform: rotate(90deg);
}

/* Floating Actions */
.fixed-action-buttons {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 900;
  align-items: center;
}

.back-to-top-button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  border: none;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all var(--transition-normal);
}

.back-to-top-button.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.whatsapp-bubble {
  width: 60px;
  height: 60px;
  transition: transform var(--transition-normal);
}

.whatsapp-bubble:hover {
  transform: scale(1.1);
}

.whatsapp-bubble img {
  width: 100%;
  height: 100%;
}

/* Mobile Overlay */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

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

  .main-content {
    padding: 1.5rem;
  }

  .menu-toggle {
    display: block;
  }

  .prompt-desktop {
    display: none;
  }

  .prompt-mobile {
    display: block;
  }
}

@media (max-width: 768px) {
  .modal-content {
    grid-template-columns: 1fr;
    max-height: 95vh;
    overflow-y: auto;
  }

  .modal-image-container {
    height: 300px;
    padding: 1rem;
  }

  .modal-details {
    padding: 1.5rem;
  }

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

  .card h3 {
    font-size: 0.9rem;
  }

  .search-container {
    margin-bottom: 2rem;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* View Controls */
.view-controls {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  background: white;
  padding: 4px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 10;
  margin-bottom: 2rem;
}

.view-btn {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.view-btn:hover {
  background: var(--background-body);
  color: var(--primary-color);
}

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

/* List View Styles */
.grid.list-view {
  grid-template-columns: 1fr;
  /* Single column */
  gap: 1rem;
}

.grid.list-view .card {
  flex-direction: row;
  align-items: center;
  padding: 0.5rem;
  max-height: 120px;
}

.grid.list-view .card img {
  width: 100px;
  height: 100px;
  padding: 0.5rem;
  border-bottom: none;
  border-right: 1px solid var(--surface-hover);
}

.grid.list-view .card-content {
  padding: 0.5rem 1rem;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.grid.list-view .card h3 {
  font-size: 1rem;
  margin-bottom: 0;
  flex: 2;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.grid.list-view .card p {
  flex: 1;
  margin: 0;
  white-space: nowrap;
}

/* Responsive List View */
@media (max-width: 768px) {
  .grid.list-view .card {
    flex-direction: column;
    max-height: none;
    align-items: flex-start;
  }

  .grid.list-view .card img {
    width: 100%;
    height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--surface-hover);
  }

  .grid.list-view .card-content {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }
}

/* Load More Button */
#load-more-btn {
  display: block;
  margin: 2rem auto;
  padding: 12px 32px;
  background: #ffffff;
  color: var(--primary-color);
  border: none;
  border-radius: var(--radius-full);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

#load-more-btn:hover {
  background: #f0f0f0;
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}