:root {
  --bg: #f4f6f8;
  --sidebar: #1f2937;
  --primary: #2563eb;
  --text: #111827;
  --muted: #6b7280;
  --card: #ffffff;
  --border: #e5e7eb;
}

* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, sans-serif;
}


body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
}

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--sidebar);
  color: #fff;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 600;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav a {
  color: #d1d5db;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
}

.nav a:hover,
.nav a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Main */
.main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.header h2 {
  margin: 0;
  font-size: 24px;
}

/* Buttons */
.btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
}

.btn.secondary {
  background: #e5e7eb;
  color: #111827;
}

.btn.danger {
  background: #dc2626;
}

.btn.change {
  background: #1f2937;
}

.btn.completed {
  background: #1ea500;
  cursor: default;
}

/* Cards */
.card {
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  margin-bottom: 24px;
}

.card h3 {
  margin-top: 0;
  font-size: 18px;
}

.error-message {
  background-color: #ffe0e0;
  color: #900;
  padding: 10px;
  border: 1px solid #f00;
  border-radius: 5px;
  margin-bottom: 15px;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 600;
}

tr:hover td {
  background: #f9fafb;
}

/* Forms */
form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  font-size: 13px;
  color: var(--muted);
}

input, select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
}

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

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}

/* Responsive minimal */
@media (max-width: 1100px) {
  body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
  }

  .nav {
    flex-direction: row;
  }

  form {
    grid-template-columns: 1fr;
  }

}


@media (min-width: 701px) and (max-width: 850px) {
  /* Targets the action column (last cell of each row) */
  td:last-child {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Adds space between the stacked buttons */
  }
}



@media (max-width: 700px) {
  body {
    flex-direction: column;
    height: auto;
  }

  .sidebar {
    width: 100%;
    padding: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .header p.pet_info {
    display: none;
  }


  /* --- TABLEAU STYLE "CARTE CENTRÉE" --- */
  table, thead, tbody, th, td, tr {
    display: block;
    width: 100%;
  }

  thead {
    display: none; /* Cache les colonnes du haut */
  }

  tr {
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  }

  td {
    border: none;
    padding: 8px 0;
    display: flex;
    flex-direction: column; /* Aligne le label au dessus de la valeur */
    align-items: center;    /* Centre horizontalement */
    text-align: center;     /* Centre le texte */
  }

  /* Design des libellés (si tu utilises data-label) */
  td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    margin-bottom: 4px; /* Espace entre le titre et la donnée */
    letter-spacing: 0.5px;
  }

  /* Actions (Boutons) */
  td:last-child {
    border-top: 1px solid var(--border);
    margin-top: 10px;
    padding-top: 15px;
    flex-direction: row; /* Remet les boutons côte à côte */
    justify-content: center;
    gap: 10px;
  }

  /* Formulaires */
  form {
    grid-template-columns: 1fr !important;
  }

  .form-actions {
    flex-direction: column;
    gap: 10px;
  }

  .quick-links .links .btn {
    width: 100%;           /* Makes buttons full width for easier tapping */
    text-align: center;    /* Centers the text inside the button */
    padding: 14px;         /* Increases "tap target" size for mobile fingers */
  }
}



@media (max-width: 500px) {
  .quick-links .links {
    display: flex;
    flex-direction: column; /* Stacks buttons vertically */
    gap: 12px;             /* Adds clean spacing between buttons */
  }

  .quick-links .links .btn {
    width: 100%;           /* Makes buttons full width for easier tapping */
    text-align: center;    /* Centers the text inside the button */
    padding: 14px;         /* Increases "tap target" size for mobile fingers */
  }
}
