/* === RESET BASICO === */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #f4f6f8;
  overflow: hidden;
  color: #333;
  box-sizing: border-box;
}

/* === WRAPPER PRINCIPAL === */
#WRAPPER__MAILMANAGER {
  display: flex;
  flex-direction: row; /* tres columnas */
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* === SIDEBAR === */
#layout-sidebar {
  width: 240px;
  background-color: #2f3640;
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid #444;
  padding: 0.5rem 0;
  transition: left 0.3s ease;
}

#layout-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

#layout-sidebar li.mailbox a {
  display: flex;
  align-items: center;
  padding: 0.6rem 1rem;
  color: #ddd;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  font-size: 0.95rem;
}

#layout-sidebar li.mailbox a:hover {
  background-color: #3b4252;
  color: #fff;
}

#layout-sidebar i.fa {
  margin-right: 10px;
  width: 18px;
  text-align: center;
}

#layout-sidebar ul[role="group"] {
  padding-left: 1rem;
  border-left: 1px solid rgba(255,255,255,0.1);
  margin-left: 0.5rem;
}

.badge.unreadcount {
  background-color: #e74c3c;
  color: #fff;
  border-radius: 12px;
  font-size: 0.8rem;
  padding: 2px 7px;
  margin-left: auto;
}

/* === LISTADO DE MENSAJES === */
#layout-list {
  width: 360px;
  display: flex;
  flex-direction: column;
  height: 100%;
  border-right: 1px solid #ddd;
  background-color: #fff;
}

#layout-list .listing-info {
  display: flex;             
  justify-content: center;   
  align-items: center;       
  font-weight: bold;         
  height: 100vh;               
  text-align: center;         
}

#messages_container {
  flex: 1;
  overflow-y: auto;
}

.message {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e1e4e8;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 0.95rem;
}

.message:hover {
  background-color: #f2f6fa;
}

.message .header-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}

.message .subject {
  margin-top: 0.3rem;
  color: #333;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message .fromto {
  flex: 2;
  font-weight: 600;
  color: #222;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message .date {
  flex: 1;
  text-align: right;
  color: #666;
  font-size: 0.9rem;
  white-space: nowrap;
}

.message .size {
  flex: 0.5;
  text-align: right;
  color: #999;
  font-size: 0.85rem;
  white-space: nowrap;
}

.message .subject.seen {
  font-weight: normal;
  color: #777;
}

/* === FOOTER DE PAGINACION === */
#footer-paginate {
  height: 50px;
  flex-shrink: 0;
  background-color: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 0.5rem;
  box-sizing: border-box;
}

#footer-paginate .paginate-msg-info {
  overflow: hidden;
  text-overflow: ellipsis;
  color: #737677;
  flex-grow: 4;
  font-size: 80%;
}

#footer-paginate a {
  color: #555;
  cursor: pointer;
  transition: color 0.2s;
}

#footer-paginate a:hover {
  color: #000;
}

#footer-paginate input.paginate-current-page {
  width: 3rem;
  max-width: 5rem;
  font-size: 90%;
  text-align: center;
  max-height: 1.6rem;
  margin: 0 .2rem;
}

/* === PANEL DE CONTENIDO === */
#layout-content {
  flex: 1;
  background-color: #fdfdfd;
  border-left: 1px solid #ddd;
  padding: 1rem 1.5rem;
  overflow-y: auto;
}

/* === SCROLLBAR PERSONALIZADA === */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-thumb {
  background: #bbb;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #888;
}

/* === RESPONSIVE === */

/* Oculta panel de contenido en pantallas medianas */
@media (max-width: 1000px) {
  #layout-content {
    display: none;
  }
}

/* MODO MÓVIL */
@media (max-width: 700px) {
  #layout-sidebar {
    position: fixed;
    left: -240px; /* fuera de pantalla */
    top: 0;
    height: 100%;
    z-index: 1000;
  }

  #layout-sidebar.active {
    left: 0; /* visible */
  }

  #layout-list {
    width: 100%;
  }

  /* BOTÓN HAMBURGUESA */
  #menu-toggle {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1100;
    background-color: #2f3640;
    color: #fff;
    border: none;
    padding: 0.5rem 0.7rem;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 4px;
  }

  #menu-toggle.active {
    background-color: #3b4252;
  }

  /* oscurece el fondo al abrir el menú */
  body.sidebar-open::after {
    content: "";
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 900;
  }
}
