/* styles.css - shadcn/ui inspired styling */
:root {
  --background: #ffffff;
  --foreground: #09090b;
  --card: #ffffff;
  --card-foreground: #09090b;
  --popover: #ffffff;
  --popover-foreground: #09090b;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --accent: #18181b;
  --accent-foreground: #fafafa;
  --destructive: #ef4444;
  --destructive-foreground: #fafafa;
  --border: #e4e4e7;
  --input: #e4e4e7;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --secondary: #f4f4f5;
  --secondary-foreground: #18181b;
  --ring: #18181b;
  --tabs-bg: #e6e1ce; /* fundo das abas não selecionadas */
  --tabs-active: #18181b; /* fundo da aba selecionada */
  --tabs-active-foreground: #ffffff;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--background);
  color: var(--foreground);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

.gm-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Typography */
h1 {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.3125rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

p {
  line-height: 1.6;
  margin-bottom: 1rem;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: opacity 0.2s;
}

a:hover {
  opacity: 0.8;
}

/* Navigation */
nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

nav a {
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  transition: background-color 0.2s;
  font-weight: 500;
}

nav a:hover {
  background-color: var(--muted);
  opacity: 1;
}

/* SVG Icons styling */
i[data-lucide],
svg.lucide {
  display: inline;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  margin-right: 0.4rem;
}

svg.lucide {
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke: currentColor;
}

/* Tabs (global) - permite scroll horizontal quando necessário (útil em mobile)
   As regras permitem que as abas rolem horizontalmente quando não couberem na tela. */
.gm-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 1rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.gm-tab {
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  background: var(--tabs-bg); /* aba não selecionada */
  color: var(--foreground);
  white-space: nowrap;
  flex: 0 0 auto; /* evita que os itens encolham e permite scroll */
}

.gm-tab.gm-active { background: var(--tabs-active); color: var(--tabs-active-foreground); }
.gm-panel { display: none; }
.gm-panel.gm-active { display: block; }

/* Buttons */
button, .gm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  height: 2.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  background-color: var(--primary);
  color: var(--primary-foreground);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  gap: 0.5rem;
}

button:hover, .gm-btn:hover {
  background-color: #000;
  border-color: #000;
}

button:focus, .gm-btn:focus {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

button.gm-secondary, .gm-btn.gm-secondary {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--border);
}

.gm-btn.gm-secondary:hover, button.gm-secondary:hover {
  background-color: #e4e4e7;
}

button.gm-destructive, .gm-btn.gm-destructive {
  background-color: var(--destructive);
  color: var(--destructive-foreground);
  border-color: var(--destructive);
}

.gm-btn.gm-destructive:hover, button.gm-destructive:hover {
  background-color: #dc2626;
}

button.gm-ghost, .gm-btn.gm-ghost {
  background-color: transparent;
  border-color: transparent;
  color: var(--primary);
}

.gm-btn.gm-ghost:hover, button.gm-ghost:hover {
  background-color: var(--muted);
}

/* Inputs and Forms */
input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
input[type='date'],
input[type='time'],
textarea,
select {
  display: block;
  width: 100%;
  height: 2.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--input);
  border-radius: 0.375rem;
  background-color: var(--background);
  color: var(--foreground);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 1rem;
  box-sizing: border-box;
}

input[type='text']:focus,
input[type='email']:focus,
input[type='password']:focus,
input[type='number']:focus,
input[type='date']:focus,
input[type='time']:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.1);
}

textarea {
  height: auto;
  min-height: 5rem;
  resize: vertical;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
}

.gm-form-group {
  margin-bottom: 1.5rem;
}

/* Cards */
.gm-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  /* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); */
}

.gm-card-title {
  font-size: 1.3125rem;
  font-weight: 600;
}

.gm-card-description {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.gm-card-content {
  margin-top: 1rem;
}

/* Product List */
.gm-product-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.gm-product {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  gap: 2rem;
}

.gm-product:last-child {
  border-bottom: none;
}

/* Página de listagem de produtos (index.php) - personalizações de cor */
.gm-products-index .gm-product-list {
  background-color: #f3ebd6; /* fundo da lista */
  padding: 0.20rem;
  border-radius: 8px;
}

.gm-products-index .gm-product {
  background: transparent;
  transition: background-color 0.18s ease;
  padding: 0.75rem;
  border-radius: 6px;
}

.gm-products-index .gm-product:hover {
  background-color: #e6e1ce; /* hover */
}

/* Badges de tamanho P/M/G aplicadas no container .gm-price */
.gm-products-index .gm-price {
  border: none;
  color: #fff;
  background: #006430; /* produtos com apenas um preço (default) */
}
.gm-products-index .gm-price.gm-price-p { background: #f5b50d; color: #fff; border-color: transparent; }
.gm-products-index .gm-price.gm-price-m { background: #f63a0d; color: #fff; border-color: transparent; }
.gm-products-index .gm-price.gm-price-g { background: #006430; color: #fff; border-color: transparent; }

.gm-products-index .gm-price .gm-size {
  font-weight: 700;
  margin-right: 0rem;
  display: inline-block;
  min-width: 1rem;
}

.gm-meta {
  flex: 1;
}

.gm-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}

.gm-subtitle {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.gm-prices {
  display: flex;
  gap: 0.5rem; /* reduzido para aproximar os badges de preço */
  align-items: center;
  flex-wrap: wrap;
}

.gm-price {
  background-color: var(--muted);
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 600;
  font-size: 0.875rem;
  border: 1px solid var(--border);
}

.gm-size {
  font-weight: 700;
  margin-right: 0rem;
  display: inline-block;
  min-width: 1rem;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

thead {
  background-color: var(--muted);
}

th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover {
  background-color: var(--muted);
}

/* Badges */
.gm-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background-color: var(--secondary);
  color: var(--secondary-foreground);
}

.gm-badge.gm-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.gm-badge.gm-destructive {
  background-color: var(--destructive);
  color: var(--destructive-foreground);
}

/* Alert/Message */
.gm-msg {
  padding: 1rem;
  border-radius: 0.375rem;
  margin-bottom: 1.5rem;
  border-left: 4px solid #10b981;
  background-color: #f0fdf4;
  color: #065f46;
  font-weight: 500;
}

.gm-msg.gm-error {
  border-left-color: var(--destructive);
  background-color: #fef2f2;
  color: #7f1d1d;
}

.gm-empty {
  color: var(--muted-foreground);
  padding: 2rem;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background-color: var(--muted);
}

/* Actions */
.gm-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

/* Form Layout */
form {
  display: flex;
  flex-direction: column;
}

.gm-form-inline {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.gm-form-inline > label {
  flex: 1;
  min-width: 200px;
}

/* Responsive */
@media (max-width: 768px) {
  .gm-container {
    padding: 1rem 0; /* zera padding horizontal no mobile */
  }

  h1 {
    font-size: 1.875rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .gm-product {
    flex-direction: column;
    align-items: flex-start;
  }

  .gm-prices {
    width: 100%;
  }

  .gm-form-inline {
    flex-direction: column;
  }

  .gm-form-inline > label {
    width: 100%;
  }

  table {
    font-size: 0.75rem;
  }

  th, td {
    padding: 0.75rem 0.5rem;
  }

  /* Mobile: permitir scroll horizontal em navegação e abas */
  nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* permite rolagem suave e evita quebra dos itens */
    padding-bottom: 0.5rem;
  }

  nav a {
    flex: 0 0 auto; /* evita que os botões encolham; permite scroll */
    white-space: nowrap;
  }

  .gm-tabs {
    display: flex; /* garante layout em linha */
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
  }

  .gm-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    background: #e6e1ce;
    color: var(--foreground);
  }
}

/* Aperfeiçoamentos adicionais para abas em mobile: espaçamento compacto, gradientes e scrollbar oculto */
@media (max-width: 768px) {
  .gm-tabs-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
  }

  .gm-tabs {
    flex: 1;
    display: flex;
    gap: 0.4rem;
    margin: 0.75rem 0;
    padding: 0.25rem 0.5rem; /* espaço interno leve para toque */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .gm-tab {
    padding: 0.35rem 0.7rem;
    font-size: 0.9rem;
    border-radius: 0.5rem;
    flex: 0 0 auto;
    white-space: nowrap;
    background: var(--tabs-bg); /* aba não selecionada (mobile) */
    color: var(--foreground);
  }

  /* Ajustes mobile: reduzir espaçamento e tamanho de P/M/G e preço */
  .gm-size {
    margin-right: 0.35rem; /* reduz espaçamento entre letra e preço */
    font-size: 0.65rem; /* reduz um pouco o tamanho da letra */
    min-width: 1rem;
  }

  /* Mobile: zera margem direita para o badge específico P/M/G quando usar a classe gm-size-m */
  .gm-size.gm-size-m {
    margin-right: 0;
  }

  .gm-price {
    font-size: 0.65rem; /* diminui um pouco o tamanho do preço em mobile */
    padding: 0.35rem 0.75rem;
  }

  /* Gradientes fixos nas extremidades do container de abas */
  .gm-tabs-scroll-fade {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2.2rem;
    pointer-events: none;
    z-index: 2;
  }

  .gm-tabs-fade-left {
    left: 0;
    background: linear-gradient(to right, rgba(249, 245, 234,0.95), transparent);
  }

  .gm-tabs-fade-right {
    right: 0;
    background: linear-gradient(to left, rgba(249, 245, 234,0.95), transparent);
  }

  /* escondendo a barra de rolagem visualmente, mantendo a rolagem por toque */
  .gm-tabs, nav {
    -ms-overflow-style: none;  /* IE e Edge */
    scrollbar-width: none;     /* Firefox */
  }
  .gm-tabs::-webkit-scrollbar, nav::-webkit-scrollbar {
    height: 0;                /* Chrome, Safari e Opera */
  }
}
