/* ============================================================
   admin.css — Portal Administración Harmant
   Estilo oscuro, profesional, consistente con medico.html
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700&family=DM+Mono:wght@400;500&display=swap');

/* ── VARIABLES ── */
:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --surface2:  #1c2330;
  --border:    #21262d;
  --border-hi: #30363d;
  --blue:      #2f81f7;
  --blue-dim:  #1f6feb;
  --green:     #3fb950;
  --green-dim: #2d8c3e;
  --red:       #f85149;
  --yellow:    #d29922;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --mono:      'DM Mono', monospace;
  --sans:      'Syne', sans-serif;
  --radius:    10px;
  --shadow:    0 8px 24px rgba(0,0,0,0.4);
}

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

/* ── BODY ── */
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Textura sutil de fondo */
  background-image: radial-gradient(
    ellipse at 20% 50%,
    rgba(47, 129, 247, 0.04) 0%,
    transparent 60%
  ),
  radial-gradient(
    ellipse at 80% 20%,
    rgba(63, 185, 80, 0.03) 0%,
    transparent 50%
  );
}

/* ── HEADER ── */
header {
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--text);
}

.logo-dot {
  width: 9px;
  height: 9px;
  background: var(--yellow);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(210, 153, 34, 0.6);
  animation: pulse-dot 2.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 6px rgba(210,153,34,0.5); }
  50%       { box-shadow: 0 0 14px rgba(210,153,34,0.9); }
}

.header-tag {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--yellow);
  background: rgba(210, 153, 34, 0.1);
  border: 1px solid rgba(210, 153, 34, 0.25);
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.1em;
}

/* ── MAIN ── */
main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
}

/* ── PANELS ── */
#loginPanel {
  width: 100%;
  max-width: 420px;
  animation: fadeIn 0.4s ease;
}

#buscarPanel {
  width: 100%;
  max-width: 760px;
  display: none;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── TÍTULOS ── */
.panel-title {
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.panel-sub {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 2rem;
  line-height: 1.5;
}

/* ── TOP BAR (panel búsqueda) ── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ── CARD ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.75rem;
  box-shadow: var(--shadow);
  transition: border-color 0.2s;
}

.card:hover {
  border-color: var(--border-hi);
}

/* ── FIELDS ── */
.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 7px;
}

.field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 11px 14px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 129, 247, 0.15);
}

.field input::placeholder { color: var(--border-hi); }

/* ── BÚSQUEDA ROW ── */
.search-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.search-row input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 11px 14px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-row input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 129, 247, 0.15);
}

.search-row input::placeholder { color: var(--border-hi); }

/* ── BOTONES ── */
.btn {
  padding: 11px 22px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  letter-spacing: 0.01em;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

/* Login */
.btn-primary {
  width: 100%;
  background: var(--blue);
  color: white;
  margin-top: 0.75rem;
  box-shadow: 0 4px 14px rgba(47, 129, 247, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: var(--blue-dim);
  box-shadow: 0 4px 18px rgba(47, 129, 247, 0.45);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* Buscar */
.btn-search {
  background: var(--blue);
  color: white;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(47, 129, 247, 0.25);
}

.btn-search:hover {
  background: var(--blue-dim);
}

/* Descargar */
.btn-download {
  background: var(--green);
  color: white;
  font-size: 0.78rem;
  padding: 7px 16px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(63, 185, 80, 0.25);
  white-space: nowrap;
}

.btn-download:hover:not(:disabled) {
  background: var(--green-dim);
  box-shadow: 0 3px 12px rgba(63, 185, 80, 0.4);
}

.btn-download:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

/* Logout */
.btn-logout {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 7px 14px;
  border: 1px solid var(--border-hi);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}

.btn-logout:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(248, 81, 73, 0.08);
}

/* ── SPINNER ── */
.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: none;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── TOASTS ── */
.toast {
  margin-top: 1rem;
  padding: 11px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  display: none;
  align-items: center;
  gap: 8px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.toast.ok {
  display: flex;
  background: rgba(63, 185, 80, 0.1);
  border: 1px solid rgba(63, 185, 80, 0.35);
  color: var(--green);
}

.toast.err {
  display: flex;
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.35);
  color: var(--red);
}

.toast.info {
  display: flex;
  background: rgba(47, 129, 247, 0.1);
  border: 1px solid rgba(47, 129, 247, 0.3);
  color: var(--blue);
}

/* ── RESULTADOS ── */
.results-title {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.exam-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── EXAM CARD ── */
.exam-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  transition: border-color 0.2s, background 0.2s;
  animation: fadeUp 0.35s ease both;
}

.exam-card:hover {
  border-color: var(--border-hi);
  background: rgba(30, 40, 56, 0.8);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.exam-info {
  flex: 1;
  min-width: 180px;
}

.exam-codigo {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--blue);
  font-weight: 500;
  margin-bottom: 3px;
  letter-spacing: 0.03em;
}

.exam-paciente {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.exam-meta {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--mono);
  line-height: 1.5;
}

/* ── BADGES ── */
.badge {
  font-family: var(--mono);
  font-size: 0.68rem;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-archivado {
  background: rgba(63, 185, 80, 0.12);
  border: 1px solid rgba(63, 185, 80, 0.3);
  color: var(--green);
}

.badge-activo {
  background: rgba(47, 129, 247, 0.12);
  border: 1px solid rgba(47, 129, 247, 0.3);
  color: var(--blue);
}

.badge-expirado {
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.3);
  color: var(--red);
}

.badge-pendiente {
  background: rgba(210, 153, 34, 0.1);
  border: 1px solid rgba(210, 153, 34, 0.3);
  color: var(--yellow);
}

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  padding: 1rem 2rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  header { padding: 0 1rem; }

  .panel-title { font-size: 1.4rem; }

  .search-row { flex-direction: column; }
  .search-row input { width: 100%; }
  .btn-search { width: 100%; }

  .exam-card { flex-direction: column; align-items: flex-start; }
  .btn-download { width: 100%; justify-content: center; }
}
