/* ==========================================================================
   Base Styles & Tokens (CSS Variables) - Vidrieria Garcia EIRL
   ========================================================================== */

:root {
  /* Brand Colors (Derived from Logo) */
  --color-primary: #a2a9ff; /* Light Lilac/Blue */
  --color-primary-dark: #6c72cb;
  --color-secondary: #eaebfa; /* Very light background tint */

  /* UI Colors */
  --text-main: #333333;
  --text-muted: #666666;
  --bg-main: #fdfdfd;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --whatsapp-color: #25d366;
  --whatsapp-hover: #1ebe5d;

  /* Typography */
  --font-family: "Inter", system-ui, -apple-system, sans-serif;

  /* Spacing & Layout */
  --sidebar-width: 280px;
  --header-height: 70px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  color: var(--text-main);
  background-color: var(--bg-main);
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

/* ==========================================================================
   Header Styles
   ========================================================================== */
.app-header {
  height: var(--header-height);
  background: var(--bg-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-container .logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-secondary);
  color: var(--color-primary-dark);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
}

/* Base Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  font-size: 0.9rem;
}

.btn-primary {
  background: var(--whatsapp-color);
  color: white;
}

.btn-primary:hover {
  background: var(--whatsapp-hover);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.btn-outline:hover {
  background: var(--secondary);
  color: var(--text-main);
}

/* ==========================================================================
   Layout (Sidebar + Main)
   ========================================================================== */
.app-container {
  display: flex;
  min-height: calc(100vh - var(--header-height));
  max-width: 1440px;
  margin: 0 auto;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: #fafafa;
  border-right: 1px solid var(--border-color);
  padding: 2rem 1.5rem;
  flex-shrink: 0;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
}

.nav-title {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.nav-item:hover {
  background: var(--color-secondary);
  color: var(--color-primary-dark);
}

.nav-item.active {
  background: var(--color-primary-dark);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* Main Content Area */
.content-area {
  flex-grow: 1;
  padding: 2.5rem;
  background: var(--bg-main);
  overflow-y: auto;
}

.content-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.category-title {
  font-size: 2rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.category-desc {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

/* Product Card */
.product-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary);
}

.card-image-wrap {
  position: relative;
  width: 100%;
  height: 220px;
  background: #f0f0f0;
  cursor: pointer; /* Indicates it's clickable for modal */
  overflow: hidden;
}

.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.product-card:hover .card-image-wrap img {
  transform: scale(1.05);
}

.img-overlay-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

.card-image-wrap:hover .img-overlay-text {
  opacity: 1;
}

.card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 1rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
}

.card-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  flex-grow: 1;
}

.card-actions {
  margin-top: auto;
}

.btn-whatsapp {
  width: 100%;
  background: var(--whatsapp-color);
  color: white;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.btn-whatsapp:hover {
  background: var(--whatsapp-hover);
}

/* ==========================================================================
   Modal / Lightbox
   ========================================================================== */
.modal {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 90vw;
  max-height: 90vh;
  width: 1000px; /* Max width for desktop */
  overflow: visible;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-content {
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
  position: relative;
  max-height: 90vh;
}

.modal-close {
  position: absolute;
  top: -15px;
  right: -15px;
  background: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  color: red;
  transform: scale(1.1);
}

.modal-body {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Main Modal Image Area */
.modal-body img {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  background: #111;
}

.modal-info {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-info h3 {
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.modal-info p {
  color: var(--text-muted);
}

/* Miniatures/Gallery inside Modal */
.modal-footer {
  padding: 1.5rem;
  background: #fafafa;
}

.modal-gallery-thumbs {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.thumb-item {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  object-fit: cover;
  opacity: 0.6;
  transition: all var(--transition-fast);
  border: 2px solid transparent;
}

.thumb-item:hover,
.thumb-item.active {
  opacity: 1;
  border-color: var(--color-primary-dark);
}

/* ==========================================================================
   Responsive Logic
   ========================================================================== */
@media (max-width: 900px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    position: static;
  }
  .nav-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }
  .nav-item {
    white-space: nowrap;
  }
}
