/* --- VARIABLES LAYOUT --- */
:root {
  --sidebar-bg: #ffffff;
  --sidebar-text: #64748b;
  --sidebar-title: #94a3b8;
  --sidebar-hover: #f1f5f9;
  --sidebar-active-bg: #ffe4e6;
  --sidebar-active-text: #e11d48;
  --sidebar-btn-bg: #e11d48;
  --sidebar-border: #e2e8f0;
  --transition-speed: 0.3s;

  --sidebar-width-expanded: 280px;
  --sidebar-width-compact: 80px;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #f8fafc;
  font-family: 'Inter', sans-serif;
}

.app-layout {
  display: flex;
  flex-grow: 1;
  overflow: hidden;
  height: 100vh;
  position: relative;
}

.content-wrapper {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
}

/* --- TOP BAR (Rediseñado para ser elegante) --- */
.top-bar {
  display: flex; /* Mantiene la fila */
  flex-direction: row; /* Fuerza a que sea siempre una fila */
  flex-wrap: nowrap; /* Prohíbe que los elementos salten abajo */
  align-items: center;
  justify-content: flex-start;
  gap: 15px;
  padding: 25px 20px;
  background-color: #ffffff;
  border-bottom: 1px solid #ddd;
}

.top-bar h1 {
  margin: 0;
  font-size: 1.5rem;
  /* Estas 3 líneas son clave para el responsive horizontal */
  white-space: nowrap;    /* El texto no se divide en dos líneas */
  overflow: hidden;       /* Si no cabe, se corta en lugar de empujar */
  text-overflow: ellipsis; /* Si se corta, pone "..." (opcional) */
}

/* --- AJUSTE RESPONSIVE --- */
@media (max-width: 600px) {
  .top-bar {
    gap: 8px; /* Reducimos el espacio entre botón y texto en móviles */
    padding: 8px 12px;
  }

  .top-bar h1 {
    padding: 8px 12px;
    font-size: 1.2rem; /* Reducción de letra para que quepa en pantallas mini */
  }
}

/* Título de la Top Bar (Se usa en la Opción A) */
.top-bar-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0;
  display: none; /* Oculto en escritorio por defecto */
}

/* Texto dentro del botón (Se usa en la Opción B) */
.toggle-btn-text {
  display: none;
  font-weight: 600;
  font-size: 1rem;
  margin-left: 10px;
}

/* Estilo premium del botón */
.toggle-btn {
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border: 1px solid var(--sidebar-border);
  border-radius: 12px;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--sidebar-text);
  transition: all var(--transition-speed) ease;
  font-size: 1.2rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.04);
}

.toggle-btn:hover {
  background: #ffffff;
  color: var(--sidebar-active-text);
  border-color: #cbd5e1;
  box-shadow: 0 2px 3px rgba(225, 29, 72, 0.15);
}

/* --- MAIN CONTENT --- */
main {
  flex-grow: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}

.content-box {
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  padding: 50px;
  text-align: center;
  max-width: 800px;
  width: 100%;
  max-height: 99%;
}

.content-box h2 {
  color: var(--sidebar-active-text);
  font-size: 2.5rem;
  font-weight: 900;
  margin-top: 0;
}

.content-box p {
  color: var(--sidebar-text);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.5;
}

.content-box i.main-icon {
  font-size: 5rem;
  color: #e2e8f0;
  margin-bottom: 20px;
}

/* --- ESTILO RESPONSIVE (MÓVIL) Y VARIANTES DEL TOP BAR --- */
@media (max-width: 768px) {
  main {
    padding: 20px;
  }
  .content-box {
    padding: 30px 20px;
  }
  .content-box h2 {
    font-size: 1.8rem;
  }
  .content-box p {
    font-size: 1.1rem;
  }
  .content-box i.main-icon {
    font-size: 3.5rem;
  }

  /* OPCIÓN A: Botón en esquina + Título centrado (Layout Corner) */
  .top-bar.layout-corner {
    padding: 12px 20px;
    justify-content: flex-start;
  }
  .top-bar.layout-corner .top-bar-title {
    display: block;
    flex-grow: 1;
    text-align: center;
    padding-right: 45px; /* Compensa el ancho del botón para que el texto quede 100% centrado */
  }

  /* OPCIÓN B: Botón Ancho Completo (Layout Full) */
  .top-bar.layout-full {
    padding: 15px 20px;
  }
  .top-bar.layout-full .toggle-btn {
    width: 100%;
    height: 50px;
    background: var(--sidebar-active-text); /* Fondo rojo llamativo */
    color: #ffffff; /* Icono blanco */
    border: none;
    box-shadow: 0 4px 15px rgba(225, 29, 72, 0.3);
  }
  .top-bar.layout-full .toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(225, 29, 72, 0.4);
  }
  .top-bar.layout-full .toggle-btn-text {
    display: inline-block; /* Muestra el texto "Menú" o similar */
  }
  .top-bar.layout-full .top-bar-title {
    display: none; /* Ocultamos el título suelto */
  }
}