/* ============================================================
   CLÍNICA EDRIA — Admin Panel Styles
   ============================================================ */

/* ── Layout ───────────────────────────────────────────────── */

.admin-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--beige-light);
  font-family: var(--font-body);
}

/* ── Sidebar ──────────────────────────────────────────────── */

.admin-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--white);
  border-right: 1.5px solid var(--gray-border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.admin-sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--gray-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-sidebar-clinic {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--black);
  letter-spacing: 0.02em;
}

.admin-sidebar-subtitle {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

/* ── Nav ──────────────────────────────────────────────────── */

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 12px 8px;
  border-bottom: 1px solid var(--gray-border);
}

.admin-nav-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--gray);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  letter-spacing: 0.03em;
}

.admin-nav-btn:hover {
  background: var(--beige-light);
  color: var(--black);
}

.admin-nav-btn.is-active {
  background: var(--beige);
  color: var(--black);
  font-weight: 600;
}

.admin-nav-logout {
  margin-top: 4px;
  color: #999;
}

.admin-nav-logout:hover {
  color: #CC3333;
  background: #FFF5F5;
}

/* ── Search ───────────────────────────────────────────────── */

.admin-search {
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--gray-border);
}

.admin-search input[type="search"] {
  width: 100%;
  padding: 9px 12px;
  background: var(--beige-light);
  border: 1.5px solid var(--gray-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.84rem;
  color: var(--black);
  outline: none;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.admin-search input[type="search"]::placeholder {
  color: var(--gray-light);
}

.admin-search input[type="search"]:focus {
  border-color: var(--gold);
  background: var(--white);
}

/* ── Patient list ─────────────────────────────────────────── */

.patient-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.patient-list-empty {
  padding: 20px 16px;
  font-size: 0.82rem;
  color: var(--gray);
  text-align: center;
}

/* ── Patient item ─────────────────────────────────────────── */

.patient-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.patient-item:hover {
  background: var(--beige-light);
}

.patient-item.is-active {
  background: var(--beige);
  border-left-color: var(--gold);
}

.patient-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.patient-item-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.patient-item-plan {
  font-size: 0.72rem;
  color: var(--gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Avatar (small) ───────────────────────────────────────── */

.patient-avatar-sm {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  background: var(--gold-gradient);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.03em;
}

/* ── Status dot ───────────────────────────────────────────── */

.patient-status-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
  background: var(--gray-light);
}

.patient-status-dot.active   { background: #22C55E; }
.patient-status-dot.invited  { background: var(--gold); }
.patient-status-dot.inactive { background: var(--gray-light); }

/* ── Sidebar footer ───────────────────────────────────────── */

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--gray-border);
}

.sidebar-footer .btn-primary {
  font-size: 0.75rem;
  padding: 11px 16px;
}

/* ── Main area ────────────────────────────────────────────── */

.admin-main {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.admin-empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray);
  font-size: 0.95rem;
  font-family: var(--font-body);
}

.admin-loading,
.admin-error {
  padding: 32px;
  text-align: center;
  color: var(--gray);
  font-size: 0.9rem;
}

.admin-error {
  color: #991B1B;
}

/* ── Main header ──────────────────────────────────────────── */

.admin-main-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.admin-main-header-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-patient-name {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--black);
  margin: 0;
  line-height: 1.2;
}

.admin-patient-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--gray);
}

/* ── Status badge ─────────────────────────────────────────── */

.admin-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-status-badge.active   { background: #DCFCE7; color: #166534; }
.admin-status-badge.invited  { background: #FEF9EC; color: #92400E; }
.admin-status-badge.inactive { background: var(--beige); color: var(--gray); }

/* ── 2-column grid ────────────────────────────────────────── */

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

/* ── Modules toggle grid ──────────────────────────────────── */

.modules-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--beige-light);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-border);
}

.toggle-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.toggle-item-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--black);
}

.toggle-item-desc {
  font-size: 0.72rem;
  color: var(--gray);
  line-height: 1.3;
}

/* ── New patient form ─────────────────────────────────────── */

.new-patient-form {
  max-width: 720px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .input-group {
  flex: 1;
  min-width: 0;
}

/* ── Toast notifications ──────────────────────────────────── */

.admin-toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-card);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 9999;
  max-width: 360px;
  line-height: 1.4;
}

.admin-toast--visible {
  opacity: 1;
  transform: translateY(0);
}

.admin-toast--success {
  background: #F0FDF4;
  border: 1.5px solid #BBF7D0;
  color: #166534;
}

.admin-toast--error {
  background: #FEF2F2;
  border: 1.5px solid #FECACA;
  color: #991B1B;
}

/* ── Mobile responsive ────────────────────────────────────── */

@media (max-width: 900px) {
  .admin-layout {
    flex-direction: column;
    height: auto;
    overflow: auto;
  }

  .admin-sidebar {
    width: 100%;
    min-width: unset;
    height: auto;
    border-right: none;
    border-bottom: 1.5px solid var(--gray-border);
    overflow: visible;
  }

  .patient-list {
    max-height: 260px;
    overflow-y: auto;
  }

  .admin-main {
    padding: 20px 16px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-grid .full {
    grid-column: 1;
  }

  .modules-toggles {
    grid-template-columns: 1fr;
  }

  .form-row {
    flex-direction: column;
    gap: 12px;
  }

  .admin-patient-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .admin-toast {
    bottom: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
  }
}
