/* css/header.css */

/* ===================================
   DASHBOARD HEADER - ESTRUCTURA BASE
   =================================== */
.dashboard-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  border-radius: 14px;
  color: var(--cream);
  flex-shrink: 0;
  height: 56px;
  gap: 12px;
  
  border: 1px solid rgba(202, 161, 90, 0.30);
  box-shadow: var(--shadow-2);

  background:
    radial-gradient(900px 320px at 50% 0%, rgba(255, 205, 140, 0.22), transparent 65%),
    radial-gradient(700px 320px at 80% 60%, rgba(59, 183, 255, 0.10), transparent 65%),
    linear-gradient(135deg, rgba(43, 27, 19, 0.92), rgba(26, 18, 13, 0.92));
  
  overflow: hidden;
}

/* Veta sutil de madera */
.dashboard-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0px,
    rgba(255, 255, 255, 0.04) 1px,
    rgba(0, 0, 0, 0) 10px,
    rgba(0, 0, 0, 0) 22px
  );
  opacity: 0.10;
  pointer-events: none;
  z-index: 0;
}

/* ===================================
   CONTENEDOR IZQUIERDO (LOGOUT)
   =================================== */
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  z-index: 2;
}

/* ===================================
   BOTÓN DE LOGOUT (IZQUIERDA)
   =================================== */
.logout-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 22px;
  background: linear-gradient(135deg, 
    rgba(198, 62, 72, 0.95) 0%, 
    rgba(151, 34, 43, 0.95) 100%
  );
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 4px 12px rgba(198, 62, 72, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
  z-index: 2;
  line-height: 1;
}

/* Efecto de brillo interno */
.logout-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.logout-button:hover::before {
  left: 100%;
}

.logout-button:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 6px 16px rgba(198, 62, 72, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  filter: brightness(1.08);
  border-color: rgba(255, 255, 255, 0.35);
}

.logout-button:active {
  transform: translateY(0);
  box-shadow: 
    0 2px 8px rgba(198, 62, 72, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Icono del botón logout */
.logout-icon {
  font-size: 1.1em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Texto del botón logout */
.logout-text {
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

/* ===================================
   TÍTULO CENTRAL
   =================================== */
.dashboard-header h1 {
  margin: 0;
  font-family: Cinzel, serif;
  letter-spacing: 0.06em;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  text-align: center;
  white-space: nowrap;
  color: var(--cream);
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===================================
   CONTENEDOR DERECHO (ADMIN NAME)
   =================================== */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  z-index: 2;
  margin-left: auto;
}

/* ===================================
   NOMBRE DEL ADMIN
   =================================== */
.admin-name {
  display: flex;
  align-items: center;
  font-size: clamp(0.85rem, 2vw, 1rem);
  font-weight: 600;
  color: rgba(244, 234, 220, 0.95);
  z-index: 2;
  white-space: nowrap;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.admin-name span {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===================================
   ESPACIADOR (legacy - oculto)
   =================================== */
.header-spacer {
  display: none;
}

/* ===================================
   BOTÓN BACK (legacy - por compatibilidad)
   =================================== */
.back-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  color: white;
  padding: 9px 16px;
  border-radius: 22px;
  font-size: 0.9rem;
  font-weight: 700;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: linear-gradient(135deg, 
    rgba(198, 62, 72, 0.95) 0%, 
    rgba(151, 34, 43, 0.95) 100%
  );
  z-index: 2;
  white-space: nowrap;
  box-shadow: 
    0 4px 12px rgba(198, 62, 72, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.back-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.back-button:hover::before {
  left: 100%;
}

.back-button:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, 
    rgba(198, 62, 72, 1) 0%, 
    rgba(151, 34, 43, 1) 100%
  );
  box-shadow: 
    0 6px 16px rgba(198, 62, 72, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.35);
}

.back-button:active {
  transform: translateY(0);
  box-shadow: 
    0 2px 8px rgba(198, 62, 72, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ===================================
   RESPONSIVE - TABLETS
   =================================== */
@media (max-width: 768px) {
  .dashboard-header {
    height: 48px;
    padding: 6px 12px;
    gap: 0px;
    border-radius: 12px;
  }

  .dashboard-header h1 {
    font-size: clamp(1rem, 3vw, 1.4rem);
    max-width: 35%;
  }

  .admin-name {
    font-size: clamp(0.75rem, 2vw, 0.9rem);
  }

  .admin-name span {
    max-width: 100px;
  }

  .logout-button,
  .back-button {
    padding: 7px 12px;
    font-size: 0.8rem;
    gap: 5px;
    border-radius: 18px;
  }

  .logout-icon {
    font-size: 1em;
  }
}

/* ===================================
   RESPONSIVE - MÓVILES
   =================================== */
@media (max-width: 480px) {
  .dashboard-header {
    height: 44px;
    padding: 6px 10px;
    gap: 0px;
    border-radius: 10px;
  }

  .dashboard-header h1 {
    font-size: clamp(0.9rem, 4vw, 1.2rem);
    max-width: 45%;
    position: static;
    transform: none;
    flex: 1;
    text-align: center;
  }

  .header-left {
    gap: 8px;
  }

  .header-right {
    gap: 8px;
  }

  .admin-name {
    display: none; /* Ocultar en pantallas muy pequeñas */
  }

  .logout-button,
  .back-button {
    padding: 7px 10px;
    font-size: 0.75rem;
    border-radius: 16px;
    gap: 4px;
  }

  .logout-text {
    display: none; /* Solo mostrar icono en móviles */
  }

  .logout-icon {
    font-size: 1.3em;
  }
}

/* ===================================
   RESPONSIVE - MÓVILES MUY PEQUEÑOS
   =================================== */
  @media (max-width: 480px) {
  .dashboard-header {
    height: 40px;
    padding: 4px 7%;
    gap: 0px;
    border-radius: 8px;
  }

  .dashboard-header h1 {
    font-size: 0.85rem;
    max-width: 50%;
  }

  .logout-button,
  .back-button {
    padding: 6px 9px;
    border-radius: 14px;
  }

  .logout-icon {
    font-size: 1.2em;
  }
}

/* ===================================
   LANDSCAPE EN MÓVILES
   =================================== */
@media (max-width: 768px) and (orientation: landscape) {
  .dashboard-header {
    height: 40px;
    padding: 4px 10px;
  }

  .dashboard-header h1 {
    font-size: 0.9rem;
  }

  .logout-button,
  .back-button {
    padding: 5px 10px;
    font-size: 0.7rem;
  }

  .admin-name {
    font-size: 0.7rem;
  }
}

/* ===================================
   ACCESIBILIDAD
   =================================== */
@media (prefers-reduced-motion: reduce) {
  .logout-button,
  .back-button,
  .logout-button::before,
  .back-button::before {
    transition: none;
  }
}

/* Focus visible para accesibilidad con teclado */
.logout-button:focus-visible,
.back-button:focus-visible {
  outline: 2px solid rgba(244, 234, 220, 0.8);
  outline-offset: 2px;
}

/* ===================================
   DARK MODE (opcional)
   =================================== */
@media (prefers-color-scheme: dark) {
  .dashboard-header {
    background:
      radial-gradient(900px 320px at 50% 0%, rgba(255, 205, 140, 0.15), transparent 65%),
      radial-gradient(700px 320px at 80% 60%, rgba(59, 183, 255, 0.08), transparent 65%),
      linear-gradient(135deg, rgba(20, 15, 12, 0.95), rgba(15, 10, 8, 0.95));
  }
}