/* Layout General */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header & Barra Superior */
.main-header {
  background: rgba(16, 22, 34, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 24px;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Logotipo */
.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
}

.logo-sun {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-gradient-sun);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.4);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: var(--color-gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Navegación por Módulos */
.main-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-link:hover {
  color: var(--text-main);
  background: var(--bg-card);
}

.nav-link.active {
  color: #ffffff;
  background: var(--bg-card);
  border-color: var(--border-sun);
  box-shadow: 0 2px 10px rgba(255, 107, 0, 0.15);
}

.nav-link.active .nav-icon {
  transform: scale(1.1);
}

.nav-badge-target {
  background: rgba(250, 204, 21, 0.2);
  color: var(--color-exact-gold);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

/* Perfil de Usuario en Header */
.user-menu-wrapper {
  position: relative;
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px 14px 4px 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-profile-btn:hover {
  border-color: var(--border-sun);
  background: var(--bg-card-hover);
}

.user-avatar-small {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--color-sun-primary);
}

.user-alias-label {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 110;
  animation: fadeIn 0.2s ease forwards;
}

.user-dropdown.show {
  display: flex;
}

.dropdown-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}

.dropdown-user-alias {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
}

.dropdown-user-role {
  font-size: 11px;
  color: var(--text-sun);
  font-weight: 600;
  text-transform: uppercase;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background: var(--bg-surface);
  color: var(--text-main);
}

.dropdown-item.danger:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

/* Contenido Principal */
.main-content {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

/* Modales */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 12, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease forwards;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: 80vh;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(13, 18, 28, 0.4);
}

/* Notificaciones Toast */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.success { border-color: var(--color-success); }
.toast.error { border-color: var(--color-danger); }
.toast.warning { border-color: var(--color-warning); }

/* Footer */
.app-footer {
  text-align: center;
  padding: 24px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-dim);
  font-size: 13px;
}

/* Responsive */
@media (max-width: 860px) {
  .header-inner {
    height: auto;
    padding: 14px 0;
    flex-wrap: wrap;
  }
  .main-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 6px;
  }
  .user-alias-label {
    display: none;
  }
}
