/* ==========================================================================
   MetaProxy v2 — Portal de Autenticación y Catálogo Institucional
   Identidad Oficial: MetaBiblioteca S.A.S. · Haciendo Ciencia
   ========================================================================== */

:root {
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-dark: #042f2e;
  --primary-light: #ccfbf1;
  --secondary: #f0fdfa;
  --accent: #52c4ce;
  --accent-blue: #6a8ac6;
  --fg: #0f172a;
  --muted: #475569;
  --muted-light: #94a3b8;
  --card: #ffffff;
  --card-hover: #f8fafc;
  --border: #e2e8f0;
  --border-focus: #0d9488;
  --err: #dc2626;
  --err-bg: #fef2f2;
  --bg: #f8fafc;
  --radius: 10px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  font-size: 100%;
}

/* Modos de Accesibilidad (WCAG 2.1 AA) */
html.lg { font-size: 125%; }
html.hc {
  --primary: #000000;
  --primary-hover: #1e293b;
  --primary-dark: #000000;
  --primary-light: #ffffff;
  --secondary: #ffffff;
  --fg: #000000;
  --muted: #000000;
  --card: #ffffff;
  --border: #000000;
  --bg: #ffffff;
}

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

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color: var(--fg);
  background: var(--bg);
  background-image: var(--bg-img, none);
  background-size: cover;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Enlace de salto accesible */
.skip {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  width: auto;
  height: auto;
  background: #000;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  z-index: 9999;
  font-weight: 700;
}

/* Barra Superior Institucional */
header.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 2rem;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #0d9488, #52c4ce);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.25);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

/* Herramientas de Accesibilidad */
.top-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.a11y-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  background: #f1f5f9;
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all 0.15s ease;
}
.a11y-pill:hover, .a11y-pill:focus {
  background: var(--secondary);
  color: var(--primary);
  border-color: var(--primary);
}

/* Contenido Principal */
main#main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2.5rem 1.25rem;
}

/* Tarjetas Principales */
.card-auth {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2.25rem;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.card-auth::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0d9488, #52c4ce, #6a8ac6);
}

.auth-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--secondary);
  color: var(--primary);
  margin-bottom: 0.85rem;
  border: 1px solid rgba(13, 148, 136, 0.2);
}

h1.auth-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

p.auth-lead {
  font-size: 0.88rem;
  color: var(--muted);
}

/* Formulario */
.form-group {
  margin-bottom: 1.2rem;
}

label.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #334155;
}

input[type=text], input[type=password], input[type=url] {
  width: 100%;
  padding: 0.75rem 0.95rem;
  font-size: 0.92rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--fg);
  transition: all 0.15s ease;
}

input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

button.btn-primary {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.8rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 4px rgba(13, 148, 136, 0.2);
}
button.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.error-banner {
  background: var(--err-bg);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: var(--err);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auth-help {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ==========================================================================
   Catálogo A-Z de Recursos (Home tras autenticación)
   ========================================================================== */
.catalog-container {
  max-width: 1100px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.catalog-header {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.user-welcome h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}
.user-welcome p {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.catalog-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

button.btn-logout {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
button.btn-logout:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* Barra de Búsqueda de Recursos */
.search-bar {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.search-bar input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 0.95rem;
  color: var(--fg);
  padding: 0.2rem 0;
}
.search-bar input:focus {
  outline: none;
  box-shadow: none;
}

/* Grilla de Recursos */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.res-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}
.res-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(13, 148, 136, 0.35);
}

.res-card-top {
  margin-bottom: 1rem;
}

.res-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  background: var(--secondary);
  color: var(--primary);
  border: 1px solid rgba(13, 148, 136, 0.25);
  margin-bottom: 0.65rem;
}

.res-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.res-provider {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: 0.5rem;
}

.res-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.res-action {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid #f1f5f9;
}

a.btn-access {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--primary);
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s ease;
}
a.btn-access:hover {
  background: var(--primary-hover);
}

/* Abrir URL Directa */
.direct-open-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-sm);
  margin-top: 0.5rem;
}
.direct-open-card h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.35rem;
}
.direct-open-card p {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

.direct-form-row {
  display: flex;
  gap: 0.75rem;
}
.direct-form-row input {
  flex: 1;
}
.direct-form-row button {
  white-space: nowrap;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.direct-form-row button:hover {
  background: var(--primary-hover);
}

/* Pie de Página Institucional */
footer.foot {
  padding: 1.75rem 2rem;
  background: #ffffff;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  margin-top: auto;
}

.foot-brand {
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.35rem;
}

.foot-links a {
  color: var(--primary);
  text-decoration: none;
  margin: 0 0.5rem;
  font-weight: 500;
}
.foot-links a:hover {
  text-decoration: underline;
}

.foot-rid {
  display: block;
  font-size: 0.72rem;
  color: var(--muted-light);
  margin-top: 0.5rem;
  font-family: monospace;
}
