/* Estilos generales */

* {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background: #f4f4f4;
  color: #222;
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

/* Cabecera y navegación */

header {
  background: #222;
  color: white;
  padding: 20px;
  text-align: center;
}

header h1 {
  margin: 0 0 15px 0;
}

nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

nav a {
  color: white;
  text-decoration: none;
  padding: 8px 12px;
  background: #444;
  border-radius: 6px;
}

nav a:hover {
  background: #666;
}

/* Contenido principal */

main {
  max-width: 1000px;
  margin: 20px auto;
  padding: 0 15px;
}

section {
  background: white;
  padding: 20px;
  margin-bottom: 20px;
  border-radius: 8px;
}

h2 {
  margin-top: 0;
}

h3 {
  margin-bottom: 10px;
}

/* Enlaces */

a {
  color: #1a5fb4;
}

a:hover {
  text-decoration: underline;
}

/* Listas */

ul {
  padding-left: 20px;
}

li {
  margin-bottom: 6px;
}

/* Formularios */

form {
  margin-top: 15px;
}

label {
  display: block;
  margin-top: 12px;
  margin-bottom: 4px;
  font-weight: bold;
}

input,
select,
textarea {
  display: block;
  width: 100%;
  padding: 8px;
  border: 1px solid #bbb;
  border-radius: 5px;
  font-family: Arial, sans-serif;
  font-size: 1rem;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #6aa0e8;
}

/* Botones */

button {
  margin: 5px;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: #1a5fb4;
  color: white;
  font-size: 1rem;
  cursor: pointer;
}

button:hover {
  background: #14457f;
}

button:disabled {
  background: #999;
  cursor: not-allowed;
}

/* Imágenes */

img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

figure {
  margin: 0 0 15px 0;
}

figcaption {
  font-size: 0.9rem;
  color: #555;
}

/* Listados dinámicos */

#products-list,
#my-products-list,
#favorites-list,
#messages-list {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

/* Tarjetas que podrá crear JavaScript */

.product-card,
.message-card {
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 15px;
  width: 280px;
}

.product-card h3,
.message-card h3 {
  margin-top: 0;
}

.product-card p,
.message-card p {
  margin: 6px 0;
}

/* Detalle del producto */

#product-detail p {
  margin: 8px 0;
}

/* Mensajes de resultado */

#login-result,
#register-result,
#profile-result,
#logout-result,
#product-form-result,
#contact-result,
#products-message {
  margin-top: 12px;
  font-weight: bold;
}

/* Pie de página */

footer {
  text-align: center;
  padding: 15px;
  background: #222;
  color: white;
  margin-top: 30px;
}

/* Pantallas pequeñas */

@media (max-width: 600px) {
  nav {
    flex-direction: column;
  }

  .product-card,
  .message-card {
    width: 100%;
  }
}