/* Admin Page Layout Styles */

/* ====== Layout & Grid ====== */
.admin-wrap {
  padding: 4.5rem 1.5rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Amélioration responsive pour écrans moyens */
@media (max-width: 1200px) {
  .admin-wrap {
    padding: 4.5rem 1rem 2rem;
  }
  .grid {
    gap: 1rem;
  }
}

@media (max-width: 768px) {
  .admin-wrap {
    padding: 4rem 0.75rem 1.5rem;
  }
}

/* ====== Cards ====== */
.card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 1rem;
  padding: 1rem 1rem 1.1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
  width: 100%;
}

.card:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06), 0 12px 28px rgba(0, 0, 0, 0.06);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.2rem 0 0.8rem;
}

.card-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 0.6rem;
  background: linear-gradient(135deg, var(--clr-accent), #7c3aed);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  font-weight: 800;
}

.card-title {
  margin: 0;
  color: var(--clr-primary);
  font-size: 1.15rem;
}

.card-sub {
  margin: 0;
  color: var(--clr-subtle);
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .card {
    padding: 0.75rem;
  }
}

/* ====== Filters Section ====== */
.filters-section {
  margin: 1rem 0;
  padding: 0.75rem;
  background: var(--clr-panel);
  border-radius: 0.75rem;
  border: 1px solid var(--clr-border);
}

.filters-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--clr-subtle);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.filter-label .material-symbols-outlined {
  font-size: 1rem;
  color: var(--clr-accent);
}

.filter-input,
.filter-select {
  border: 1px solid var(--clr-border);
  border-radius: 0.55rem;
  background: var(--clr-surface);
  color: var(--clr-text);
  padding: 0.55rem 0.7rem;
  font-size: 0.95rem;
  outline: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease,
    background 0.15s ease, transform 0.1s ease;
  width: 100%;
}

/* Enhanced styling specifically for select dropdowns */
.filter-select {
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 16px;
  cursor: pointer;
  font-weight: 500;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.filter-input:focus,
.filter-select:focus {
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--clr-accent) 25%, transparent);
  background: var(--clr-surface);
  transform: translateY(-1px);
}

.filter-input:hover,
.filter-select:hover {
  border-color: #94a3b8;
}

.filter-select:hover {
  border-color: var(--clr-accent);
  background-color: color-mix(in oklab, var(--clr-accent) 5%, var(--clr-surface));
}

.filter-select:active {
  transform: translateY(0);
}

@media (max-width: 1024px) {
  .filters-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .filters-section {
    padding: 0.6rem;
  }

  .filters-row {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .filter-input,
  .filter-select {
    padding: 0.5rem 0.6rem;
    font-size: 0.9rem;
  }

  .filter-select {
    padding-right: 2.2rem;
    background-size: 14px;
    background-position: right 0.6rem center;
  }

  .filter-label {
    font-size: 0.78rem;
  }
}

/* ====== Actions Toolbar ====== */
.actions-toolbar {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin: 0.75rem 0;
}

@media (max-width: 768px) {
  .actions-toolbar {
    margin: 0.6rem 0;
  }
}

/* ====== Toolbar (Legacy - Keep for backward compatibility) ====== */
.toolbar {
  display: flex;
  gap: 0.5rem;
  margin: 0.7rem 0 0.8rem;
  flex-wrap: wrap;
}

.toolbar-spacer {
  flex: 1;
  min-width: 0.5rem;
}

.toolbar input,
.toolbar select {
  border: 1px solid var(--clr-border);
  border-radius: 0.55rem;
  background: var(--clr-surface);
  color: var(--clr-text);
  padding: 0.45rem 0.6rem;
  font-size: 0.95rem;
  outline: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.toolbar input:focus,
.toolbar select:focus {
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--clr-accent) 25%, transparent);
}

@media (max-width: 768px) {
  .toolbar {
    gap: 0.4rem;
  }
  .toolbar input,
  .toolbar select {
    padding: 0.4rem 0.5rem;
    font-size: 0.9rem;
  }
}

/* ====== Buttons ====== */
.btn {
  border: none;
  border-radius: 0.6rem;
  padding: 0.48rem 0.75rem;
  cursor: pointer;
  font-weight: 700;
  transition: filter 0.2s ease;
}

.btn-primary {
  background: var(--clr-accent);
  color: #fff;
}

.btn-primary:hover {
  filter: saturate(1.1) brightness(1.03);
}

.btn-secondary {
  background: #e0e7ff;
  color: #3730a3;
}

.btn-danger {
  background: #fee2e2;
  color: #991b1b;
}

.btn-danger:hover {
  background: #fecaca;
  filter: brightness(0.95);
}

.btn-ghost {
  background: #eef2ff;
  color: #312e81;
}

.btn-icon {
  padding: 0.48rem 0.6rem;
  min-width: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon i {
  font-size: 0.95rem;
}

/* ====== Actions Cell ====== */
.actions-cell {
  text-align: right;
}

/* ====== Table Container ====== */
.table-container {
  overflow-x: auto;
  margin: 0 -0.1rem;
}

.table-container::-webkit-scrollbar {
  height: 6px;
}

.table-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ====== Table Footer ====== */
.table-footer {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
}

.limit-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--clr-primary);
  cursor: pointer;
}

.limit-selector span {
  color: var(--clr-subtle);
}

.limit-selector select {
  border: 1px solid var(--clr-border);
  border-radius: 0.55rem;
  background: var(--clr-surface);
  color: var(--clr-text);
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.limit-selector select:focus {
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--clr-accent) 25%, transparent);
}

.limit-selector select:hover {
  border-color: #9ca3af;
}

/* ====== Badges & Chips ====== */
.badge {
  display: inline-block;
  padding: 0.18rem 0.45rem;
  border-radius: 0.45rem;
  font-weight: 800;
  font-size: 0.78rem;
}

.badge-open {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-closed {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.chip {
  display: inline-block;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.78rem;
  border: 1px solid var(--clr-border);
}

.chip-coach {
  background: #eef2ff;
  color: #3730a3;
  border-color: #c7d2fe;
}

.chip-routine {
  background: #ecfeff;
  color: #155e75;
  border-color: #a5f3fc;
}

/* ====== Loading Screen ====== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  font-size: 1.2rem;
  color: var(--clr-subtle);
}

/* ====== Dark Mode Overrides ====== */
body.dark-mode .card-title {
  color: var(--clr-text);
}

body.dark-mode .btn-secondary {
  background: #312e81;
  color: #e0e7ff;
}

body.dark-mode .btn-danger {
  background: #7f1d1d;
  color: #fecaca;
}

body.dark-mode .btn-danger:hover {
  background: #991b1b;
}

body.dark-mode .btn-ghost {
  background: #1e293b;
  color: #e0e7ff;
}

body.dark-mode .badge-open {
  background: #064e3b;
  color: #a7f3d0;
  border-color: #065f46;
}

body.dark-mode .badge-closed {
  background: #7f1d1d;
  color: #fecaca;
  border-color: #991b1b;
}

body.dark-mode .chip-coach {
  background: #312e81;
  color: #c7d2fe;
  border-color: #4338ca;
}

body.dark-mode .chip-routine {
  background: #164e63;
  color: #a5f3fc;
  border-color: #0e7490;
}

body.dark-mode .table-container::-webkit-scrollbar-track {
  background: #1e293b;
}

body.dark-mode .table-container::-webkit-scrollbar-thumb {
  background: #475569;
}

body.dark-mode .table-container::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

body.dark-mode .filter-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b5cf6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

body.dark-mode .filter-select:hover {
  background-color: color-mix(in oklab, var(--clr-accent) 8%, var(--clr-surface));
}
