/* ========== VARIÁVEIS CSS ========== */
:root {
  --primary: #1a1a1a;
  --secondary: #ff6b35;
  --accent: #f7931e;
  --light: #f5f5f5;
  --white: #ffffff;
  --text: #333333;
  --border: #e0e0e0;
  --success: #27ae60;
  --danger: #e74c3c;
  --warning: #f39c12;
  --spacing: 1rem;
  --border-radius: 8px;
  --transition: all 0.3s ease;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background-color: var(--white);
  line-height: 1.6;
}

/* ========== TIPOGRAFIA ========== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--spacing);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: var(--spacing);
}

a {
  color: var(--secondary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent);
}

/* ========== CONTAINER ========== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing);
}

/* ========== HEADER ========== */
header {
  background-color: var(--primary);
  color: var(--white);
  padding: 1rem 0;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--white);
}

.logo span {
  color: var(--secondary);
}

/* ========== NAVEGAÇÃO ========== */
nav ul {
  display: flex;
  list-style: none;
  gap: 2rem;
  align-items: center;
}

nav a {
  color: var(--white);
  font-weight: 500;
  transition: var(--transition);
}

nav a:hover {
  color: var(--secondary);
}

.user-menu {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.user-menu span {
  font-size: 0.9rem;
}

/* ========== BOTÕES ========== */
button, .btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

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

.btn-primary:hover {
  background-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background-color: var(--light);
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  background-color: var(--white);
  border-color: var(--secondary);
}

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

.btn-danger:hover {
  background-color: #c0392b;
}

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

.btn-success:hover {
  background-color: #229954;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.btn-block {
  width: 100%;
  display: block;
}

/* ========== FORMULÁRIOS ========== */
form {
  max-width: 500px;
  margin: 2rem auto;
  background: var(--light);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

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

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text);
}

input, textarea, select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

/* ========== CARDS ========== */
.card {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.card-header {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 1rem;
}

.card-body {
  margin-bottom: 1rem;
}

.card-footer {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}

/* ========== GRID ========== */
.grid {
  display: grid;
  gap: 2rem;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ========== PRODUTO CARD ========== */
.produto-card {
  background: var(--white);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: pointer;
}

.produto-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-8px);
}

.produto-imagem {
  width: 100%;
  height: 250px;
  background: var(--light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.produto-imagem img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

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

.produto-info {
  padding: 1.5rem;
}

.produto-nome {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.produto-descricao {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 1rem;
}

.produto-preco {
  font-size: 1.5rem;
  color: var(--secondary);
  font-weight: 700;
  margin-bottom: 1rem;
}

.produto-estoque {
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.estoque-baixo {
  color: var(--warning);
}

.estoque-indisponivel {
  color: var(--danger);
}

/* ========== CARRINHO ========== */
.carrinho-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
}

.carrinho-item-imagem {
  width: 100px;
  height: 100px;
  background: var(--light);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.carrinho-item-imagem img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carrinho-item-info {
  flex: 1;
}

.carrinho-item-titulo {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.carrinho-item-detalhes {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.carrinho-item-preco {
  color: var(--secondary);
  font-weight: 700;
}

.quantidade-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100px;
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 0.25rem;
}

.quantidade-selector button {
  background: none;
  border: none;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  color: var(--text);
}

.quantidade-selector input {
  border: none;
  text-align: center;
  width: 50px;
  padding: 0.25rem;
}

/* ========== ALERTAS ========== */
.alert {
  padding: 1rem;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.alert-success {
  background-color: #d4edda;
  border: 2px solid var(--success);
  color: #155724;
}

.alert-danger {
  background-color: #f8d7da;
  border: 2px solid var(--danger);
  color: #721c24;
}

.alert-warning {
  background-color: #fff3cd;
  border: 2px solid var(--warning);
  color: #856404;
}

.alert-info {
  background-color: #d1ecf1;
  border: 2px solid #0c5460;
  color: #0c5460;
}

/* ========== TABELA ========== */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
}

th {
  background-color: var(--primary);
  color: var(--white);
  padding: 1rem;
  text-align: left;
  font-weight: 700;
}

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

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

/* ========== FOOTER ========== */
footer {
  background-color: var(--primary);
  color: var(--white);
  padding: 3rem 0 1rem;
  margin-top: 4rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h3 {
  color: var(--secondary);
  margin-bottom: 1rem;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 0.5rem;
}

.footer-section a {
  color: var(--white);
}

.footer-section a:hover {
  color: var(--secondary);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1rem;
  text-align: center;
  font-size: 0.9rem;
}

/* ========== LOADING ========== */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-radius: 50%;
  border-top-color: var(--secondary);
  animation: spin 0.6s linear infinite;
}

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

/* ========== MODAL ========== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--border-radius);
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
}

/* ========== RESPONSIVO ========== */
@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.2rem; }

  nav ul {
    gap: 1rem;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .footer-content {
    grid-template-columns: 1fr;
  }

  form {
    padding: 1.5rem;
  }

  table {
    font-size: 0.9rem;
  }

  th, td {
    padding: 0.75rem;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; }

  button, .btn {
    padding: 0.6rem 1rem;
  }

  nav ul {
    flex-direction: column;
    gap: 0.5rem;
  }

  .container {
    padding: 0 0.75rem;
  }
}

/* ========== UTILITÁRIOS ========== */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-1 { margin-top: var(--spacing); }
.mt-2 { margin-top: calc(var(--spacing) * 2); }
.mt-3 { margin-top: calc(var(--spacing) * 3); }

.mb-1 { margin-bottom: var(--spacing); }
.mb-2 { margin-bottom: calc(var(--spacing) * 2); }
.mb-3 { margin-bottom: calc(var(--spacing) * 3); }

.p-1 { padding: var(--spacing); }
.p-2 { padding: calc(var(--spacing) * 2); }
.p-3 { padding: calc(var(--spacing) * 3); }

.text-muted {
  color: #999;
}

.text-danger {
  color: var(--danger);
}

.text-success {
  color: var(--success);
}

.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden;
}
