/*
Theme Name: Internal Team Dashboard Pro
Version: 4.2
*/

:root {
  --primary: #0078d5;
  --secondary: #004275;
  --white: #ffffff;
  --bg: #f4f7fb;
  --text: #1d1d1d;
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 75px;
}

body.dark-mode {
  --bg: #0f1720;
  --text: #ffffff;
  --white: #1a2633;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s, color 0.3s;
}

/* BARRA SUPERIOR EXCLUSIVA MÓVIL */
.itd-mobile-navbar {
  display: none; /* Oculta en escritorio */
  width: 100%;
  height: 60px;
  background: #004275;
  color: #fff;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  position: sticky;
  top: 0;
  z-index: 3000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.itd-nav-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.itd-nav-btn:active {
  background: rgba(255, 255, 255, 0.3);
}

.itd-mobile-title {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.5px;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: rgba(255, 80, 80, 0.2);
  color: #ff6b6b;
}

body.login {
  background: #f4f7fb !important;
}

#login {
  width: 100% !important;
  max-width: none !important;
  padding: 0 !important;
  display: flex;
  min-height: 100vh;
  flex-direction: row;
}

.login h1 {
  display: none;
}

.login-left {
  width: 40%;
  background: linear-gradient(135deg, #004275, #001d36);
  color: white;
  padding: 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.login-left:before {
  content: '';
  position: absolute;
  width: 700px;
  height: 700px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .04);
  bottom: -250px;
  left: -100px;
}

.brand h2 {
  font-size: 42px;
  margin: 0;
  letter-spacing: 3px;
}

.brand p {
  color: #d9e8ff;
  font-size: 18px;
}

.login-right {
  width: 60%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.login-card {
  width: 100%;
  max-width: 520px;
  background: white;
  border-radius: 28px;
  padding: 50px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .08);
}

.login-card h1 {
  display: block;
  text-align: center;
  color: #002f5e;
  margin-bottom: 10px;
  font-size: 36px;
}

.login-card p {
  text-align: center;
  color: #666;
  margin-bottom: 40px;
}

.login form {
  margin-top: 0 !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.login label {
  color: #002f5e !important;
  font-weight: 600;
}

.login input[type=text],
.login input[type=password] {
  border-radius: 14px !important;
  border: 1px solid #dbe5ef !important;
  padding: 14px !important;
  height: auto !important;
}

.wp-core-ui .button-primary {
  background: #0078d5 !important;
  border: none !important;
  width: 100%;
  border-radius: 14px !important;
  padding: 14px !important;
  height: auto !important;
  font-size: 18px !important;
}

.login #nav,
.login #backtoblog {
  text-align: center;
}

.dashboard-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

.sidebar {
  width: var(--sidebar-w);
  background: #004275;
  color: white;
  padding: 24px 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 100;
  position: sticky;   
  top: 0;              
  height: 100vh;      
  overflow-y: auto;  
}

.sidebar h2 {
  margin: 0 0 20px 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: opacity 0.2s;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
  flex-grow: 1;
}

.sidebar li {
  margin: 8px 0;
}

.sidebar a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-weight: 500;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 12px;
  transition: all 0.2s;
}

.sidebar a:hover, .sidebar li.active a {
  color: white;
  background: rgba(255, 255, 255, 0.15);
}

.sidebar-toggle {
  cursor: pointer;
  font-size: 24px;
  margin-bottom: 25px;
  display: inline-block;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.switch-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.switch-label {
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.2s;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 30px;
  transition: .3s;
}

.slider:before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: .3s;
}

input:checked + .slider {
  background: #0078d5;
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.main-content {
  flex: 1;
  padding: 40px;
  background: var(--bg);
  transition: background 0.3s;
  max-width: 95%!important;
}

.main-content h1 {
  margin-top: 0;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 30px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 28px;
}

.card {
  background: var(--white);
  border-radius: 24px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .04);
  transition: background 0.3s, transform 0.2s;
}

.card h2 {
  margin-top: 0;
  font-size: 20px;
  margin-bottom: 15px;
}

.calendar-box {
  min-height: 350px;
  border: 2px dashed #0078d5;
  border-radius: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 24px;
  background: rgba(0, 120, 213, 0.02);
}

.sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
}

.sidebar.collapsed h2,
.sidebar.collapsed .switch-label,
.sidebar.collapsed span {
  opacity: 0;
  pointer-events: none;
  height: 0;
  margin: 0;
  overflow: hidden;
}

.sidebar.collapsed a span {
  display: none;
}

/* ==========================================================================
   MEDIA QUERIES INTEGRADAS (Dashboard + Ajuste de Menús)
   ========================================================================== */

@media (max-width: 992px) {
  #login {
    flex-direction: column;
  }
  .login-left {
    width: 100%;
    min-height: auto;
    padding: 40px;
  }
  .login-right {
    width: 100%;
    padding: 24px 16px;
  }
  .login-card {
    padding: 35px 24px;
    border-radius: 20px;
  }
  .brand h2 {
    font-size: 32px;
  }
}

@media (max-width: 768px) {
  /* Activamos el Navbar superior visible en dispositivos móviles */
  .itd-mobile-navbar {
    display: flex;
  }

  .dashboard-layout {
    flex-direction: column;
    min-height: 100vh;
  }

  /* El Menú del Dashboard ahora es un panel flotante que sale desde la IZQUIERDA */
  .sidebar {
    position: fixed;
    top: 60px; /* Debajo de nuestra barra móvil */
    left: -100%; /* Escondido por defecto */
    width: 280px;
    height: calc(100vh - 60px);
    z-index: 2500;
    box-shadow: 5px 0 20px rgba(0,0,0,0.2);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Clase activa para abrir el menú con JavaScript */
  .sidebar.mobile-open {
    left: 0 !important;
  }

  /* Evitamos que los estilos de colapsado rompan el comportamiento en móviles */
  .sidebar.collapsed {
    left: -100%;
    width: 280px;
  }
  
  .sidebar.collapsed h2,
  .sidebar.collapsed .switch-label,
  .sidebar.collapsed span,
  .sidebar.collapsed a span {
    opacity: 1;
    pointer-events: auto;
    height: auto;
    display: flex;
    overflow: visible;
  }

  .sidebar-toggle {
    display: none;
  }

  /* El área de contenido se adapta al espacio exacto móvil */
  .main-content {
    padding: 0px; /* Quitamos paddings globales para que el chat use todo el marco */
    width: 100%;
  }

  .main-content h1 {
    font-size: 22px;
    padding: 15px 15px 0 15px;
    margin-bottom: 10px;
  }

  .card-grid {
    grid-template-columns: 1fr;
    padding: 15px;
    gap: 16px;
  }
}