/* Reset básico */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Tipografía y layout base */
html, body {
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  background: var(--bg);
  color: var(--fg);
}

/* Estructura SPA */
#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

header, footer {
  padding: 1rem;
}

main {
  flex: 1;
  padding: 1rem;
}

/* Navegación */
nav a {
  margin-right: 1rem;
  text-decoration: none;
  color: var(--link);
}

nav a:hover {
  text-decoration: underline;
}

/* Tema claro por defecto */
:root {
  --bg: #f6f7f9;
  --fg: #1e1e1e;

  --header-bg: #ffffff;
  --footer-bg: #ffffff;

  --border: #dddddd;
  --link: #005bbb;
}

/* y lo aplicamos */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

/* Tema oscuro por defecto */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --fg: #e0e0e0;

    --header-bg: #1a1a1a;
    --footer-bg: #1a1a1a;

    --border: #2a2a2a;
    --link: #6ca8ff;
  }
}

/* Estilo para el estado  */
#status {
  margin-top: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* Estilos para la infobar */
#info-bar[data-type="info"] {
  background: var(--header-bg);
}

#info-bar[data-type="success"] {
  background: #1f3d2b;
}

#info-bar[data-type="warn"] {
  background: #3d3520;
}

#info-bar[data-type="error"] {
  background: #3d1f1f;
}

#info-bar {
  transition:
    opacity 0.4s ease,
    transform 0.4s ease,
    background-color 0.4s ease;
}

/* Estados */
.status.info {
  background: rgba(0, 0, 0, 0.05);
}

.status.ok {
  background: rgba(0, 128, 0, 0.1);
}

.status.warn {
  background: rgba(255, 165, 0, 0.15);
}

.status.error {
  background: rgba(255, 0, 0, 0.15);
}

/* Panel dev */
#dev-panel {
  position: fixed;
  bottom: 0;
  right: 0;
  padding: 0.75rem;
  font-size: 0.75rem;
  max-width: 260px;
  opacity: 0.85;
  border-top-left-radius: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
}

#dev-panel strong {
  color: #6ca8ff;
}

button {
  margin-top: 1rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  border-radius: 4px;
}

button:hover {
  opacity: 0.8;
}

/* registros de eventos del timer */
.event-item {
  border: 1px solid var(--border);
  padding: 0.6rem;
  margin-bottom: 0.6rem;
  border-radius: 6px;
}

.event-item.expired {
  opacity: 0.6;
  background: rgba(255, 0, 0, 0.1);
}

.event-item button {
  margin-top: 0.4rem;
}

/* estilos user y dibujo de silueta */
#user-indicator {
  width: 28px;
  height: 28px;
  position: relative;
  cursor: default;
}

/* cabeza */
#user-indicator::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 50%;
  width: 10px;
  height: 10px;
  background: var(--fg);
  border-radius: 50%;
  transform: translateX(-50%);
}

/* cuerpo */
#user-indicator::after {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 50%;
  width: 18px;
  height: 10px;
  background: var(--fg);
  border-radius: 50% 50% 40% 40%;
  /* transform: translateX(-50%) rotate(-8deg); */
  transform: translateX(-50%) rotate(-6deg) scaleX(1.1);
}

/* estilo tooltip de usuario */
#user-tooltip {
  position: absolute;
  top: 36px;
  right: 0;
  background: var(--header-bg);
  border: 1px solid var(--border);
  padding: 0.5rem 0.7rem;
  font-size: 0.8rem;
  white-space: nowrap;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  z-index: 10;
}

#user-tooltip strong:first-child {
  font-size: 0.9rem;
}

#user-tooltip span {
  font-size: 0.75rem;
}
