/*========== RESET & BASE ==========*/
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;          /* 1rem = 16px */
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f4f6f8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/*========== VARIABLES ==========*/
/* Couleurs */
:root {
  --primary:    #2c3e50;
  --secondary:  #3498db;
  --light:      #ecf0f1;
  --dark:       #34495e;
  --success:    #27ae60;
  --error:      #e74c3c;
  --text:       #2c3e50;
  --bg:         #f4f6f8;
}

/*========== LAYOUT ==========*/
header {
  background: var(--primary);
  color: white;
  padding: 1rem 2rem;
}

header h1 {
  font-size: 1.75rem;
}
ul {
  list-style: none;
}
nav ul {
  list-style-type:none;
  display: flex;
  gap: 10rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

nav a {
  color: white;
  text-decoration: none;
  font-weight: 500;
}

nav a:hover {
  text-decoration: underline;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

footer {
  background: var(--dark);
  color: white;
  text-align: center;
  padding: 1rem;
  font-size: 0.9rem;
}

/*========== BUTTONS ==========*/
.btn {
  display: inline-block;
  padding: 0.6em 1.2em;
  background: var(--secondary);
  color: white;
  text-decoration: none;
  border-radius: 0.3rem;
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

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

/*========== ALERTS ==========*/
.alert {
  padding: 0.75rem 1rem;
  border-radius: 0.3rem;
  margin-bottom: 1rem;
}

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

.alert-error {
  background: var(--error);
  color: white;
}

/*========== INTRO SECTION ==========*/
.intro {
  position: relative;
  text-align: center;
  color: white;
  padding: 4rem 1rem;
  background: linear-gradient(
      rgba(0, 0, 0, 0.4),
      rgba(0, 0, 0, 0.4)
    ),
    url('images/bg.jpg') center/cover no-repeat;
}

.intro h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.intro p {
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

/*========== CATEGORIES ==========*/
.categories {
  margin: 2rem 0;
}

.categories ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.categories a {
  background: var(--light);
  padding: 0.5rem 1rem;
  border-radius: 0.3rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s ease;
}

.categories a:hover {
  background: var(--secondary);
  color: white;
}

/*========== PRODUCT CARDS ==========*/
.card-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.card {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.card-content {
  padding: 1rem;
  flex: 1;
}

.card-content h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.card-content p {
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.card-content .btn {
  margin-top: auto;
}

/*========== FORMS ==========*/
form {
  background: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  margin-bottom: 2rem;
}

form label {
  display: block;
  margin-top: 1rem;
  font-weight: 500;
}

form input,
form select,
form textarea {
  width: 100%;
  padding: 0.6rem;
  margin-top: 0.3rem;
  border: 1px solid #ccc;
  border-radius: 0.3rem;
  font-size: 1rem;
}

form input:focus,
form select:focus,
form textarea:focus {
  outline: none;
  border-color: var(--secondary);
}

/*========== TABLES ==========*/
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  margin-bottom: 2rem;
  border-radius: 0.5rem;
  overflow: hidden;
}

table th,
table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e1e1e1;
}

table th {
  background: var(--light);
  font-weight: 600;
}

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

/*========== MEDIA QUERIES ==========*/
@media (max-width: 768px) {
  .intro h2 {
    font-size: 2rem;
  }
  .intro p {
    font-size: 1rem;
  }
  nav ul {
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.5rem;
  }
  .card-container {
    grid-template-columns: 1fr;
  }
  form {
    padding: 1rem;
  }
}

/*========== END OF STYLE =========*/
