:root[data-theme='dark'] {
  --bg-color: #121212;
  --text-color: #ffffff;
  --accent-color: #d9d9d9;
}

:root[data-theme='light'] {
  --bg-color: #f5f5f5;
  --text-color: #1a1a1a;
  --accent-color: #333333;
}

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden; /* evita doble scroll del body */
}

body {
  margin: 0;
  font-family: sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%; /* ✅ fuerza ancho total */
  overflow: hidden;
  background: var(--bg-color);
  color: var(--text-color);
}

.login-container, .offline-container {
  text-align: center;
}

.login-container form {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.login-container input,
.login-container button {
  width: 80%;
  max-width: 300px;
  margin: 8px 0;
  padding: 10px;
  border-radius: 8px;
  border: none;
  font-size: 1rem;
  box-sizing: border-box; /* ✅ asegura que padding no cambie el ancho */
}

.login-container input {
  background: #fff;
  color: #000;
}

.login-container button {
  background: var(--accent-color);
  color: var(--bg-color);
  cursor: pointer;
  transition: opacity 0.2s ease-in-out;
  text-align: center;
}

.login-container button:hover {
  opacity: 0.9;
}



button {
  background: var(--accent-color);
  color: var(--bg-color);
  cursor: pointer;
}

.logo {
  width: 100px;
  margin-bottom: 20px;
}



.menu-toggle {
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1001;
  background: var(--accent-color);
  color: var(--bg-color);
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 1.2rem;
  cursor: pointer;
}

.sidebar {
  position: fixed;
  top: 35px; /* ✅ deja espacio para el header */
  left: 0;
  width: 220px;
  height: calc(100% - 83px); /* ✅ ocupa todo el alto restante */
  background: var(--accent-color);
  color: var(--bg-color);
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out;
  z-index: 1001; /* ✅ debajo del header (1002) pero encima del contenido */
  display: flex;
  flex-direction: column;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  text-align: center;
  padding: 10px 10px 0 10px;
}

.logo-sidebar {
  width: 100px;
  margin-bottom: 10px;
}

.sidebar-menu {
  flex-grow: 1; /* ✅ ocupa todo el espacio disponible entre header y footer */
  padding: 0 10px;
}

.sidebar-menu button {
  width: 100%;
  padding: 10px;
  margin: 8px 0;
  border-radius: 8px;
  border: none;
  background: var(--bg-color);
  color: var(--accent-color);
  cursor: pointer;
  font-weight: 500;
}

.sidebar-footer {
  padding: 5px;
  border-top: 1px solid var(--bg-color);
}


.sidebar-footer button {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: var(--bg-color);
  color: var(--accent-color);
  cursor: pointer;
}

.main-content {
  margin-top: 35px; /* deja espacio al header */
  height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--bg-color);
  color: var(--text-color);
  overflow: hidden; /* evita doble scroll */
}
/*.main-content {
  margin-top: 56px; /* Altura del header 
  padding: 20px;
  overflow-y: auto;
  height: calc(100vh - 56px);
}*/
.main-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%; /* ✅ fuerza ancho total */
  overflow: hidden;
}

/*main {
  flex: 1;
  padding: 20px;
}*/
/* ======== BUSCADOR CON BOTÓN LIMPIAR ======== */
.article-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-color);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

/* === CONTENEDOR INPUT + BOTÓN CLEAR === */
.search-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-wrapper input {
  width: 100%;
  padding: 10px 38px 10px 12px; /* espacio derecho para el botón */
  border-radius: 8px;
  border: none;
  outline: none;
  background: #222;
  color: #fff;
  font-size: 1rem;
  -webkit-appearance: none; /* ✅ evita estilos automáticos de iOS */
}

/* Botón de borrar (✕) */
#clearSearchBtn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
}

#clearSearchBtn:hover {
  background: rgba(255, 255, 255, 0.3);
}

#clearSearchBtn:active {
  transform: translateY(-50%) scale(0.9);
}

.search-wrapper button {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: #bbb;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  border-radius: 50%;
  transition: color 0.2s;
}

.search-wrapper button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Botón de modo (Ver todos / Filtrar) */
.article-search #toggleModeBtn {
  background: var(--accent-color);
  color: var(--bg-color);
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s, opacity 0.2s;
}

.article-search #toggleModeBtn:hover {
  opacity: 0.9;
}


/* === Buscador fijo old === */
/*.article-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-color);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.article-search input {
  flex: 1;
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  border: none;
  outline: none;
  background: #222;
  color: #fff;
  font-size: 1rem;
  width: 100%;
}

.article-search button {
  background: var(--accent-color);
  color: var(--bg-color);
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s, opacity 0.2s;
}

.article-search button:hover {
  opacity: 0.9;
}*/

/* === Listado scrollable === */
.article-list {
  flex-grow: 1;
  overflow-y: auto;
  width: 100%;
  padding: 10px 0;
  box-sizing: border-box;
}

.article-item {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
  box-sizing: border-box;
}

.article-item .descripcion {
  font-weight: 600;
  font-size: 1rem;
  color: #fff;
  margin-bottom: 4px;
  word-break: break-word;
}

.article-item .info-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #ccc;
}

.article-item .info-line span {
  margin-right: 10px;
}

.article-item .pvp1 {
  font-weight: bold;
  color: var(--accent-color);
}

.no-results {
  text-align: center;
  padding: 20px;
  color: #999;
  font-style: italic;
}


.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 35px;
  background: var(--accent-color);
  color: var(--bg-color);
  display: flex;
  align-items: center;
  justify-content: center; /* Centra el título */
  padding: 0 16px;
  z-index: 1002;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.app-header h1 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
  text-align: center;
}

/* === Botón del menú lateral === */
.menu-toggle {
  position: absolute;
  left: 16px;
  background: none;
  border: none;
  color: var(--bg-color);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

/* === Contenedor para acciones (por ejemplo, “Sincronizar”) === */
.header-actions {
  position: absolute;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-actions button {
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  background: var(--bg-color);
  color: var(--accent-color);
  cursor: pointer;
  font-size: 0.9rem;
  transition: opacity 0.2s;
}

.header-actions button:hover {
  opacity: 0.85;
}
/* ======== INDICADOR DE ESTADO ======== */
.indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-left: 8px;
  transition: color 0.3s ease, transform 0.3s ease;
}

.indicator.online {
  color: #4caf50; /* 🟢 */
}

.indicator.offline {
  color: #f44336; /* 🔴 */
}

.indicator.syncing {
  color: #ffeb3b; /* 🟡 */
}
.indicator:active {
  transform: scale(0.9);
  opacity: 0.8;
}
/* ======== FOOTER FIJO GLOBAL ======== */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 48px;
  background: #111;
  color: #ddd;
  display: flex;
  align-items: center;
  justify-content: flex-start; /* 🔹 Texto alineado a la izquierda */
  gap: 10px;
  font-size: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0 16px; /* 🔹 margen lateral para separar del borde */
  z-index: 9999; /* 🔹 más alto que sidebar y header */
}

/* Icono indicador de estado */
.indicator {
  font-size: 1.2rem;
  flex-shrink: 0; /* 🔹 evita que el icono se mueva si el texto se alarga */
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.indicator:active {
  transform: scale(0.9);
  opacity: 0.8;
}

.indicator.online { color: #4caf50; }   /* 🟢 */
.indicator.offline { color: #f44336; }  /* 🔴 */
.indicator.syncing { color: #ffeb3b; }  /* 🟡 */

/* Texto de estado — ocupa todo el espacio disponible */
.sync-status {
  flex-grow: 1;
  color: #ccc;
  font-size: 0.85rem;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Espacio inferior del contenido para no solaparse */
.main-content,
.article-list {
  padding-bottom: 60px;
}
@media (max-width: 400px) {
  .sync-status {
    font-size: 0.75rem;
  }
}
