/* frontend/pages/mascotas/mascotas.css */
/* =========================================================
   Rasta Pets – Mascotas
   Diseño Veterinario Minimalista / Soft UI
   ========================================================= */

:root {
  /* Fondos */
  --bg-body: #f6f9fc;
  --bg-card: #ffffff;
  --bg-soft: #f4fcfa;
  --bg-input: #f8fbfd;

  /* Textos */
  --text-main: #102a56;
  --text-secondary: #7b8ba8;
  --text-placeholder: #a6b3c9;

  /* Colores */
  --color-primary: #22c7a9;
  --color-primary-hover: #16a88e;
  --color-primary-soft: #e9fbf7;

  --color-blue: #2563eb;
  --color-blue-soft: #eff6ff;

  --color-green: #22c55e;
  --color-green-soft: #ecfdf5;

  --color-orange: #f59e0b;
  --color-orange-soft: #fffbeb;

  --color-purple: #8b5cf6;
  --color-purple-soft: #f3efff;

  --color-red: #ef4444;
  --color-red-soft: #fff1f2;

  /* Bordes */
  --border-soft: #e3eaf3;
  --border-light: #eef3f8;

  /* Sombras */
  --shadow-soft: 0 14px 35px rgba(16, 42, 86, 0.06);
  --shadow-hover: 0 20px 48px rgba(16, 42, 86, 0.10);
  --shadow-focus: 0 0 0 4px rgba(34, 199, 169, 0.16);
  --shadow-primary: 0 12px 26px rgba(34, 199, 169, 0.22);

  /* Radius */
  --radius-xl: 28px;
  --radius-l: 20px;
  --radius-m: 16px;
  --radius-s: 12px;
  --radius-round: 999px;

  /* Tipografía */
  --font-family: "Inter", "DM Sans", system-ui, sans-serif;
}

/* =========================================================
   Layout general
   ========================================================= */

.page.mascotas {
  min-height: 100vh;

  display: flex;
  flex-direction: column;
  gap: 26px;

  padding: 28px 36px;

  background:
    radial-gradient(circle at top right, rgba(34, 199, 169, 0.10), transparent 32%),
    var(--bg-body);

  color: var(--text-main);
  font-family: var(--font-family);
}

/* =========================================================
   Header
   ========================================================= */

.page__header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 18px;
  flex-wrap: wrap;

  padding-bottom: 0;
  border-bottom: none;
}

.page__header h1 {
  margin: 0;

  color: var(--text-main);
  font-size: 34px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.page__header .muted {
  margin-top: 7px;

  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

/* Botón superior */
.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.header-actions .btn-primary {
  min-height: 46px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 12px 22px;

  background: var(--color-primary);
  color: #ffffff;

  border: 1px solid var(--color-primary);
  border-radius: var(--radius-m);

  font-size: 13.5px;
  font-weight: 800;
  text-decoration: none;

  box-shadow: var(--shadow-primary);

  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.header-actions .btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  transform: translateY(-1px);
}

/* =========================================================
   Cards
   ========================================================= */

.page.mascotas .card {
  position: relative;
  display: block;
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  overflow: visible; /* Prevent clipping of absolute-positioned dropdown select options */
}

.page.mascotas .card::before {
  content: "";
  position: absolute;
  top: 22px;
  right: 24px;

  width: 52px;
  height: 52px;

  border-radius: 20px;

  background:
    radial-gradient(circle at center, rgba(34, 199, 169, 0.16), transparent 62%);

  pointer-events: none;
}

.page.mascotas .card h2 {
  position: relative;
  z-index: 1;

  margin: 0 0 24px;

  color: var(--text-main);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* =========================================================
   Selección de cliente
   ========================================================= */

.client-select {
  position: relative;

  display: flex;
  flex-direction: column;
  gap: 8px;

  margin-bottom: 24px;
}

.client-select label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 800;
}

.client-input {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  width: 100%;
}

.client-input input[type="search"] {
  width: 100%;
  min-height: 50px;
  padding: 12px 42px 12px 15px;
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-m);
  font-size: 13.5px;
  font-weight: 600;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.client-input input[type="search"]::placeholder {
  color: var(--text-placeholder);
  font-weight: 500;
}

.client-input input[type="search"]:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}

.btn-clear-client {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.btn-clear-client:hover {
  color: var(--color-red);
  transform: scale(1.15);
}

/* Sugerencias autocomplete */
.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;

  display: none;

  max-height: 220px;
  overflow-y: auto;

  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-m);

  box-shadow: var(--shadow-hover);
  z-index: 10;
}

.suggestions.show {
  display: block;
}

.suggestions .item {
  padding: 12px 16px;

  color: var(--text-main);
  font-size: 13.5px;
  font-weight: 600;

  border-bottom: 1px solid var(--border-light);

  cursor: pointer;

  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.suggestions .item:last-child {
  border-bottom: none;
}

.suggestions .item:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary-hover);
}

/* Cliente elegido */
.chosen {
  padding: 16px 18px;

  background:
    linear-gradient(135deg, #e9fbf7 0%, #f3efff 100%);

  color: var(--text-main);

  border: 1px solid rgba(34, 199, 169, 0.18);
  border-radius: var(--radius-l);

  font-size: 13.5px;
  font-weight: 600;

  box-shadow: 0 12px 28px rgba(16, 42, 86, 0.05);
}

.chosen strong {
  margin-right: 4px;

  color: var(--color-primary-hover);
  font-weight: 900;
}

.chosen.hidden {
  display: none;
}

/* =========================================================
   Formulario de mascota
   ========================================================= */

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

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

.field label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 800;
}

input[type="text"],
select,
input[type="tel"] {
  width: 100%;
  min-height: 50px;

  box-sizing: border-box;

  padding: 12px 15px;

  background: var(--bg-input);
  color: var(--text-main);

  border: 1px solid var(--border-soft);
  border-radius: var(--radius-m);

  font-size: 13.5px;
  font-weight: 600;

  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

input[type="text"]::placeholder,
input[type="tel"]::placeholder {
  color: var(--text-placeholder);
  font-weight: 500;
}

input:focus,
select:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}

/* Acciones formulario */
.form-actions {
  grid-column: 1 / -1;

  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 14px;

  margin-top: 24px;
  padding-top: 24px;

  border-top: 1px solid var(--border-light);
}

.form-error {
  grid-column: 1 / -1;

  min-height: 18px;

  color: var(--color-red);
  font-size: 13px;
  font-weight: 700;

  opacity: 0;
  transition: opacity 0.2s ease;
}

.form-error.visible {
  opacity: 1;
}

/* =========================================================
   Listado de mascotas
   ========================================================= */

.list-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;

  margin-bottom: 24px;
}

.list-toolbar input[type="search"] {
  flex: 1;
  min-width: 250px;
  min-height: 50px;

  padding: 12px 15px;

  background: var(--bg-input);
  color: var(--text-main);

  border: 1px solid var(--border-soft);
  border-radius: var(--radius-m);

  font-size: 13.5px;
  font-weight: 600;

  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.list-toolbar input[type="search"]::placeholder {
  color: var(--text-placeholder);
}

.list-toolbar input[type="search"]:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}

.list-toolbar .muted {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

/* =========================================================
   Tabla
   ========================================================= */

.table-wrap {
  overflow-x: auto;

  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-l);
}

.table {
  width: 100%;
  min-width: 600px;

  border-collapse: separate;
  border-spacing: 0;

  font-size: 13.5px;
}

.table th,
.table td {
  padding: 16px 20px;

  text-align: left;
  white-space: nowrap;
}

.table th {
  background: var(--color-primary-soft);
  color: var(--color-primary-hover);

  font-size: 12.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;

  border-bottom: 1px solid rgba(34, 199, 169, 0.12);
}

.table td {
  color: var(--text-main);
  font-size: 13.5px;
  font-weight: 600;

  border-bottom: 1px solid var(--border-light);
}

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

.table tr:hover td {
  background: rgba(34, 199, 169, 0.045);
}

/* =========================================================
   Botones reutilizables
   ========================================================= */

.btn {
  min-height: 46px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 12px 20px;

  border: 1px solid transparent;
  border-radius: var(--radius-m);

  cursor: pointer;

  font-size: 13.5px;
  font-weight: 800;
  text-decoration: none;

  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-primary);
}

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

.btn-sec {
  background: var(--bg-input);
  color: var(--text-main);
  border-color: var(--border-soft);
}

.btn-sec:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary-hover);
  border-color: rgba(34, 199, 169, 0.32);
}

/* =========================================================
   Scrollbar
   ========================================================= */

.page.mascotas::-webkit-scrollbar,
.suggestions::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.page.mascotas::-webkit-scrollbar-track,
.suggestions::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.page.mascotas::-webkit-scrollbar-thumb,
.suggestions::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(123, 139, 168, 0.30);
  border-radius: 999px;
}

.page.mascotas::-webkit-scrollbar-thumb:hover,
.suggestions::-webkit-scrollbar-thumb:hover,
.table-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(123, 139, 168, 0.50);
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 980px) {
  .page.mascotas {
    padding: 22px 18px;
    gap: 22px;
  }

  .page__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page__header h1 {
    font-size: 28px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .form-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .page.mascotas {
    padding: 18px 14px;
  }

  .page.mascotas .card {
    padding: 22px;
    border-radius: 22px;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
  }

  .list-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .list-toolbar input[type="search"] {
    min-width: 100%;
  }
}
