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

html, body {
  height: 100%;
  font-family: 'Segoe UI', Verdana, sans-serif;
}

img,
canvas {
  max-width: 100%;
}

body {
  background: #f4f6f9;
  color: #222;
}

:root {
  --sidebar-w: 260px;
  --bg: #f5f7fb;
  --accent: #0078d4;
  --text: #222;
  --green: #007a3d;
  --soft-gray: #e5e7eb;
  --white: #fff;
}

/* Login */
.login-container {
  background: url(../Img/sbc_Fondo.png) no-repeat center center;
  background-size: cover;
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 16px;
}

.overlay {
  position: absolute;
  inset: 0;
  background-color: transparent;
  z-index: 1;
}

.login-form {
  position: relative;
  z-index: 2;
  background-color: #fff;
  padding: clamp(20px, 5vw, 40px);
  border-radius: 8px;
  width: min(100%, 400px);
  max-width: 400px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.login-form h1 {
  color: var(--green);
  margin-bottom: 10px;
  font-size: clamp(1.5rem, 5vw, 2rem);
}

.login-form h2 {
  font-size: 18px;
  color: #333;
}

.login-form p {
  margin-bottom: 20px;
  color: #666;
}

.login-form label {
  display: block;
  text-align: left;
  margin: 10px 0 5px;
  font-weight: bold;
  color: #333;
}

.login-form input {
  width: 100%;
  padding: 12px;
  background: #fff;
  color: #000;
  border: 1px solid #cbd5d1;
  border-radius: 4px;
  font: inherit;
  font-weight: bold;
  transition: background-color 0.3s ease;
}

.password-field {
  position: relative;
}

.login-form .password-field input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #555;
  cursor: pointer;
  transform: translateY(-50%);
}

.password-toggle:hover {
  color: var(--green);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.eye-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.login-form .botton:hover {
  background-color: #005f2e;
}

.botton {
  width: 100%;
  font-size: 14px;
  border-radius: 4px;
  text-align: center;
  font-weight: bold;
  padding: 12px 16px;
  margin-top: 20px;
  background: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.contenido main {
  padding: 20px;
}

/* Layout sidebar */
.layout {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, #7BE0A5, #1c1f26);
  color: #F9FAFB;
  padding: 20px;
}

.logo {
  text-align: center;
  margin-bottom: 30px;
}

.logo img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-bottom: 10px;
}

.logo h3 {
  font-size: 16px;
}

.sidebar ul {
  list-style: none;
}

.sidebar ul li {
  padding: 12px 15px;
  margin-bottom: 5px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.3s;
}

.sidebar ul li.has-submenu {
  display: block;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar ul li:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar ul li.active {
  background: #149062;
}

.submenu {
  max-height: 0;
  overflow: hidden;
  list-style: none;
  margin-top: 5px;
  padding-left: 35px;
  transition: max-height 0.3s ease-in-out;
}

.has-submenu.open .submenu {
  max-height: 200px;
}

.submenu li {
  padding: 8px 15px;
  margin-bottom: 2px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.3s;
}

.submenu li:hover {
  background: rgba(255, 255, 255, 0.2);
}

.contenido {
  flex: 1;
  min-width: 0;
  background: #f8f9fb;
  padding: 30px;
}

.contenido h1 {
  font-size: 28px;
  margin-bottom: 5px;
}

.contenido p {
  color: #888;
}

/* Documentos PDF / panel manuales */
.title-pdf {
  text-align: center;
  margin: 20px 0;
  color: var(--green);
  font-size: 24px;
  font-weight: bold;
  text-shadow: cornflowerblue 1px 1px 2px;
}

#manual-title {
  text-align: center;
}

.parrafos-estilos {
  text-align: center;
  margin: 10px 20px;
  color: #333333;
  font-size: 16px;
  font-weight: bold;
  gap: 5px;
}

.manual-description {
  line-height: 1.5;
}

.topbar-title {
  font-weight: 600;
  margin-left: 8px;
}

.pdf-reader {
  display: grid;
  justify-items: center;
  gap: 16px;
  width: 100%;
  min-width: 0;
  padding: clamp(8px, 2vw, 16px);
  background: var(--soft-gray);
}

.pdf-reader-status {
  margin: 0;
  color: #333;
  text-align: center;
}

.pdf-reader-page {
  width: min(100%, 900px);
  min-width: 0;
  margin: 0;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.pdf-reader-page canvas {
  display: block;
  width: 100%;
  height: auto;
}

#pdf-container button {
  margin: 10px;
  padding: 10px 20px;
  background-color: var(--green);
  color: #fff;
  border: none;
  cursor: pointer;
}

#pdf-container span {
  margin-bottom: 10px;
}

#pdf-viewer {
  border: 1px solid #ccc;
}

/* Panel lateral del menú de manuales */
.sidebar-panel {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  padding: 20px;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
}

.brand h1 {
  font-size: 1rem;
  margin: 0;
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

nav li {
  margin: 6px 0;
}

.menu-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 10px 12px;
  background: #e8f5ed;
  color: #176b45;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.menu-group-toggle::after {
  content: "▾";
  margin-left: 8px;
  transition: transform 0.2s ease;
}

.menu-group-toggle[aria-expanded="false"]::after {
  transform: rotate(-90deg);
}

.menu-group-toggle:hover {
  background: #d8eddf;
}

.menu-submenu {
  margin-top: 4px;
  padding-left: 10px;
  border-left: 2px solid #dce9e0;
}

.menu-submenu[hidden] {
  display: none;
}

nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 6px;
}

nav a:hover {
  background: rgba(0, 0, 0, 0.04);
}

nav a.active {
  background: linear-gradient(90deg, var(--accent), #2aa1ff);
  color: #fff;
}

.content {
  margin-left: var(--sidebar-w);
  padding: 28px;
  min-height: 100vh;
  min-width: 0;
}

.topbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 56px;
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  align-items: center;
  padding: 0 12px;
  z-index: 8;
}

.toggle {
  background: transparent;
  border: 0;
  font-size: 22px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 6px;
}

@media (max-width: 860px) {
  .layout {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    width: 100%;
    flex: 0 0 auto;
    padding: 16px;
  }

  .sidebar .logo {
    margin-bottom: 16px;
  }

  .sidebar .logo img {
    width: 64px;
    height: 64px;
  }

  .contenido {
    width: 100%;
    padding: 24px 20px;
  }

  .sidebar-panel {
    position: fixed;
    width: 100%;
    height: auto;
    top: 56px;
    bottom: auto;
    left: 0;
    transform: translateY(-120%);
    transition: transform 0.25s ease;
    z-index: 9;
    max-height: calc(100vh - 56px);
    max-height: calc(100dvh - 56px);
  }

  .sidebar-panel.open {
    transform: translateY(0);
    overflow-y: auto;
  }

  .content {
    margin-left: 0;
    padding-top: 76px;
    padding-right: clamp(16px, 4vw, 28px);
    padding-bottom: 24px;
    padding-left: clamp(16px, 4vw, 28px);
  }

  .topbar {
    display: flex;
  }
}

@media (max-width: 560px) {
  .login-container {
    align-items: flex-start;
    padding: 24px 12px;
  }

  .login-form {
    margin: auto 0;
  }

  .login-form h2 {
    font-size: 1rem;
  }

  .contenido {
    padding: 20px 16px;
  }

  .contenido h1 {
    font-size: clamp(1.5rem, 7vw, 1.75rem);
  }

  .title-pdf {
    margin: 12px 0;
    font-size: clamp(1.25rem, 6vw, 1.5rem);
    overflow-wrap: anywhere;
  }

  #manual-title {
    font-size: 1.2rem;
    overflow-wrap: anywhere;
  }

  .parrafos-estilos {
    margin: 10px 0;
    font-size: 0.95rem;
  }

  .pdf-reader {
    gap: 10px;
  }

  .sidebar-panel {
    padding: 16px;
  }

  .brand h1 {
    font-size: 0.9rem;
  }

  .topbar-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}