/* ============================================================
   admin.css — Portal Administración Harmant
   ============================================================ */

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

: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);
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  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);
  min-width: 0;
}

.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;
  flex-shrink: 0;
}

@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;
  white-space: nowrap;
}

/* ── 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 ── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ── 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: 12px 14px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}

.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: 12px 14px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  min-width: 0;
}

.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;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

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

.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); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

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

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

.btn-download {
  background: var(--green);
  color: white;
  font-size: 0.78rem;
  padding: 8px 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); }
.btn-download:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }

.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;
  white-space: nowrap;
}

.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;
  flex-shrink: 0;
}

@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;
  line-height: 1.4;
}

@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: 160px; }

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

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

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

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

.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 — TABLET (768px)
   ============================================================ */
@media (max-width: 768px) {
  main {
    padding: 1.5rem 1rem;
    align-items: flex-start;
  }

  #loginPanel,
  #buscarPanel {
    max-width: 100%;
  }
}

/* ============================================================
   RESPONSIVE — MÓVIL (480px)
   ============================================================ */
@media (max-width: 480px) {
  header { padding: 0 1rem; height: 52px; }

  .logo { font-size: 0.82rem; gap: 7px; }
  .header-tag { font-size: 0.58rem; padding: 2px 6px; letter-spacing: 0.06em; }

  main { padding: 1rem 0.75rem; align-items: flex-start; }

  .panel-title { font-size: 1.3rem; }
  .panel-sub   { font-size: 0.8rem; margin-bottom: 1.25rem; }

  .card { padding: 1.25rem; border-radius: 10px; }

  /* Login inputs */
  .field input {
    font-size: 16px; /* evita zoom en iOS */
    padding: 14px;
  }

  /* Búsqueda */
  .search-row { flex-direction: column; gap: 0.5rem; }
  .search-row input { font-size: 16px; padding: 14px; }
  .btn-search { width: 100%; padding: 14px; }

  /* Top bar */
  .top-bar { flex-direction: column; align-items: flex-start; }
  .btn-logout { align-self: flex-end; }

  /* Exam cards */
  .exam-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
  }

  .exam-info { min-width: 100%; }
  .exam-codigo { font-size: 0.7rem; }
  .exam-paciente { font-size: 0.9rem; }

  .badge { font-size: 0.62rem; }
  .btn-download { width: 100%; justify-content: center; padding: 10px; }

  footer { padding: 0.75rem 1rem; }
}
/* ── BOTÓN VISOR ── */
.btn-viewer {
  background: var(--blue-dim);
  color: white;
  font-size: 0.78rem;
  padding: 7px 16px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(31,111,235,0.25);
  white-space: nowrap;
}

.btn-viewer:hover:not(:disabled) { background: var(--blue); }
.btn-viewer:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }

/* ── BOTÓN VISOR ── */
.btn-viewer {
  background: var(--blue-dim);
  color: white;
  font-size: 0.78rem;
  padding: 7px 16px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(31,111,235,0.25);
  white-space: nowrap;
}

.btn-viewer:hover:not(:disabled) { background: var(--blue); }
.btn-viewer:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }

/* ── BOTÓN VISOR ── */
.btn-viewer {
  background: var(--blue-dim);
  color: white;
  font-size: 0.78rem;
  padding: 7px 16px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(31,111,235,0.25);
  white-space: nowrap;
}

.btn-viewer:hover:not(:disabled) { background: var(--blue); }
.btn-viewer:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }
