/* ==========================================================================
   VIREON BY THE CLOOCK'S - SISTEMA DE DISEÑO CLÍNICO RESPONSIVE & WCAG AA
   ========================================================================== */

:root {
  --bg-color: #fcfbf9;
  --bg-card: #ffffff;
  --bg-subtle: #f5f1ed;
  --text-main: #2e1d19;
  --text-light: #5d4037;
  --text-muted: #6d4c41;

  --accent-primary: #6d4c41;   /* Contraste > 6.5:1 con texto blanco */
  --accent-hover: #4e342e;
  --accent-secondary: #d7ccc8;
  --accent-soft: rgba(109, 76, 65, 0.08);

  --success: #2e7d32;
  --warning: #b26a00;
  --danger: #c62828;

  --filter-weak: #e53935;
  --filter-strong: #0097a7;

  --glass-border: #e6dfd9;
  --panel-shadow: 0 6px 20px rgba(46, 29, 25, 0.07);
  --radius-md: 12px;
  --radius-lg: 16px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Roboto', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Accesibilidad: foco visible y skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent-hover);
  color: #ffffff;
  padding: 10px 16px;
  z-index: 9999;
  border-radius: 0 0 8px 0;
  text-decoration: none;
  font-weight: 700;
}
.skip-link:focus { left: 10px; top: 10px; }

:focus-visible {
  outline: 3px solid #1565c0;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Top Navbar */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--glass-border);
  padding: 0.75rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.site-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
}

.brand-link img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Main Layout */
.main-shell {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.25rem;
}

.main-shell--narrow {
  max-width: 520px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Cards / Panels */
.glass-panel {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  box-shadow: var(--panel-shadow);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

h1, h2, h3, h4 {
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.25;
}

.text-accent { color: var(--accent-primary); }
.text-muted { color: var(--text-light); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1.15rem;
  min-height: 44px;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.15s, box-shadow 0.2s;
  border: 2px solid transparent;
  text-decoration: none;
  text-align: center;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(109, 76, 65, 0.3);
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}
.btn-success:hover:not(:disabled) {
  background-color: #1b5e20;
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}
.btn-danger:hover:not(:disabled) {
  background-color: #8e0000;
}

.btn-outline {
  background: #ffffff;
  color: var(--accent-primary);
  border: 2px solid var(--accent-primary);
}
.btn-outline:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.btn-sm {
  min-height: 36px;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.1rem;
  width: 100%;
}

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--text-light);
  font-weight: 600;
  font-size: 0.88rem;
}

.form-control {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #bcaaa4;
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
}

.form-control::placeholder {
  color: #795548;
  opacity: 0.75;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(109, 76, 65, 0.2);
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 0.75rem;
}
.alert-error { background: #ffebee; color: #b71c1c; border: 1px solid #ef9a9a; }
.alert-success { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }
.alert-info { background: #e3f2fd; color: #0d47a1; border: 1px solid #90caf9; }

/* Honeypot anti-spam invisible */
.hp-field {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Tabs */
.tabs-nav {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.tab-btn {
  flex: 1;
  min-height: 48px;
  padding: 0.8rem 1rem;
  border: none;
  background: transparent;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text-light);
  border-bottom: 3px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.tab-btn.active {
  color: var(--text-main);
  background: var(--bg-subtle);
  border-bottom-color: var(--accent-primary);
}

/* Dashboard Grids */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--accent-secondary);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  cursor: pointer;
  background: transparent;
  border: none;
  text-align: left;
  font-family: inherit;
  padding: 0.25rem;
  border-radius: 10px;
}
.user-profile:hover { background: var(--bg-subtle); }

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--accent-hover);
  flex-shrink: 0;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  background: var(--bg-subtle);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}
.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}
.kpi-label {
  font-size: 0.82rem;
  color: var(--text-light);
  font-weight: 500;
}

.binocular-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.summary-eye-card {
  background: #ffffff;
  border: 1px solid var(--glass-border);
  border-top: 4px solid var(--accent-primary);
  padding: 0.9rem;
  border-radius: 10px;
}

/* Activity Library Grid */
.activities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.activity-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-left: 5px solid var(--accent-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--panel-shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.activity-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(46, 29, 25, 0.11);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-light);
  border: 1px solid var(--glass-border);
}
.badge-success { background: #e8f5e9; color: #1b5e20; border-color: #a5d6a7; }
.badge-warn { background: #fff8e1; color: #8d4e00; border-color: #ffe082; }
.badge-danger { background: #ffebee; color: #b71c1c; border-color: #ef9a9a; }

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 10, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 2000;
}
.modal-overlay.open { display: flex; }

.modal-content {
  background: #ffffff;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
}

/* Eye Preview */
.eye-preview-box {
  background: #ece7e2;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.25rem;
  text-align: center;
}
.eye-sockets-row {
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.eye-socket {
  width: 96px;
  height: 70px;
  background: #ffffff;
  border: 2px solid #9e9e9e;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.12);
}
.eye-iris {
  width: 38px;
  height: 38px;
  background: radial-gradient(circle, #222 30%, #5d4037 70%);
  border-radius: 50%;
  position: absolute;
}

/* Tables (Admin) */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 680px;
}
.data-table th, .data-table td {
  padding: 0.75rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}
.data-table th {
  background: var(--bg-subtle);
  color: var(--text-main);
  font-weight: 700;
}

/* Game Runner Responsive Viewport */
.game-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #efebe9;
}
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.65rem 1.25rem;
  background: #ffffff;
  border-bottom: 2px solid var(--glass-border);
  z-index: 100;
}
.game-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}
#game-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}
#game-container {
  position: relative;
  background-color: #ffffff;
  width: 100%;
  max-width: 1160px;
  height: clamp(340px, 76vh, 690px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
}
#game-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Legal Pages */
.legal-article h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
.legal-article h2 { font-size: 1.2rem; margin-top: 1.5rem; margin-bottom: 0.5rem; color: var(--accent-hover); }
.legal-article p, .legal-article li { margin-bottom: 0.65rem; color: var(--text-light); }
.legal-article ul { padding-left: 1.25rem; }

/* Footer & Cookie Banner */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--glass-border);
  padding: 1.25rem;
  margin-top: 2rem;
  font-size: 0.85rem;
  color: var(--text-light);
}
.site-footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.footer-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-links a, .footer-links button {
  color: var(--accent-primary);
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
}

.cookie-banner {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  max-width: 680px;
  margin: 0 auto;
  background: #ffffff;
  border: 2px solid var(--accent-primary);
  border-radius: 14px;
  padding: 1.15rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  z-index: 3000;
  display: none;
}
.cookie-banner.visible { display: block; }

/* Responsive Breakpoints (320px - 1920px) */
@media (max-width: 768px) {
  .main-shell { padding: 0.85rem; }
  .glass-panel { padding: 1.1rem; }
  .binocular-summary-grid { grid-template-columns: 1fr; }
  .two-col-grid { grid-template-columns: 1fr !important; }
  #game-wrapper { padding: 0.4rem; }
  #game-container { height: clamp(300px, 74vh, 560px); border-radius: 8px; }
}

@media (max-width: 420px) {
  .site-header-inner { justify-content: center; }
  .tab-btn { font-size: 0.84rem; padding: 0.65rem 0.5rem; }
  .activities-grid { grid-template-columns: 1fr; }
  .modal-content { padding: 1rem; }
}
